Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Code

527 commit(s) on main

Put job execution behind an interface Keenan Nemetz · 2h ago de3eec16
source preview history blame raw 13.3 KiB

Deploy on Linux

Set up a public forge on a dedicated Linux machine. You need sudo access, a DNS name such as forge.example.com, and the SSH public key for the first instance administrator. Open ports 80, 443, and 2222 as described below, and point the DNS name at the machine before starting Vole.

The service examples use systemd. Package installation supports Debian, Ubuntu, Fedora, RHEL, Rocky, AlmaLinux, and Arch Linux; the runner setup below is specific to Debian and Ubuntu.

Install the package

Install Vole with the Debian or Ubuntu package repository, the Fedora, RHEL, or Rocky repository, or the Arch Linux repository. The package installs the binary, systemd units, and /etc/vole/vole.toml; it does not create an instance admin or enable the service.

What the package installs

Path Purpose
/usr/bin/vole Vole binary with the release version embedded
/usr/lib/systemd/system/vole.service Hardened forge service
/usr/lib/systemd/system/vole-runner.service Runner service, disabled until configured
/etc/vole/vole.toml Forge configuration, preserved as a conffile or Arch backup entry
/etc/vole/runner.env Runner arguments, preserved as a conffile or Arch backup entry
/etc/containers/registries.conf.d/50-vole-runner.conf Short-name registry resolution for rootless Podman
/etc/containers/containers.conf.d/50-vole-runner.conf cgroupfs configuration for the system runner unit
/usr/share/vole/sshd/vole.conf sshd drop-in for the front door; shipped, never installed
/usr/lib/vole/ssh-shell Login shell of the git account: runs one command, refuses the rest
/usr/lib/tmpfiles.d/vole.conf Creates /run/vole as vole:git mode 2770 at boot
/usr/share/doc/vole/ LICENSE and NOTICE
/var/lib/vole/data Repositories, databases, objects, logs, secrets, and host key

The packages depend on Git and nothing else. SQLite is compiled into the binary by a pure-Go driver, so the executable is static and no package names a runtime database library. That is also what lets the release publish one Linux binary and two macOS binaries that run without a matching system SQLite; see Install a release binary and Install on macOS.

Installation creates the vole service account, creates a git account for the SSH front door, and initializes the data directory. It does not create an instance admin, enable the forge service, or touch /etc/ssh: putting sshd in front of Vole is a change to your sshd, so the drop-in is shipped and not installed. /usr/share/vole/sshd/vole.conf opens with the four steps.

Run local administration as the service user so new files retain the correct ownership:

sudo -u vole vole admin --config /etc/vole/vole.toml account list

Configure the service

Write /etc/vole/vole.toml:

data_dir = "/var/lib/vole/data"
http_addr  = ":80"
https_addr = ":443"
public_url = "https://forge.example.com"
acme_email = "you@example.com"
ssh_addr = "0.0.0.0:2222"

The hardened unit needs one capability to bind ports 80 and 443:

sudo install -d -m 0755 /etc/systemd/system/vole.service.d
sudo tee /etc/systemd/system/vole.service.d/bind.conf >/dev/null <<'EOF'
[Service]
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
EOF
sudo systemctl daemon-reload

If another service terminates TLS, leave https_addr empty, use http_addr = "127.0.0.1:8080", and follow Running behind a proxy.

Service sandbox

The forge unit drops capabilities, sets UMask=0027, provides private temporary and device trees, hides other processes, and makes /var/lib/vole its only writable path. The front door adds one exception, /run/vole, for the socket sshd’s forced command connects to; it needs no capability because sshd owns port 22. MemoryDenyWriteExecute=true is appropriate because the forge runs no JIT.

To bind HTTP port 80 or HTTPS port 443, add only CAP_NET_BIND_SERVICE:

# /etc/systemd/system/vole.service.d/bind.conf
[Service]
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE

Run systemctl daemon-reload and restart Vole after creating that drop-in. Do not run the forge as root or relax its unit for CI; the runner has a separate unit and security model.

Open the firewall

The package does not change firewall rules. Open SSH and HTTP/HTTPS in the host firewall or provider security group. Open 2222 only while Vole’s own SSH listener is in use; with the sshd front door, inbound 22 is the only SSH port.

# ufw
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 2222/tcp   # only for Vole's own SSH listener

Or, on a firewalld host:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=2222/tcp
sudo firewall-cmd --reload

Create the first admin

Copy your public key to the server, then create the admin and start Vole:

sudo -u vole vole admin --config /etc/vole/vole.toml \
  account create admin --key /tmp/your-key.pub --role admin
sudo systemctl enable --now vole

Open https://forge.example.com. The first request can take a few seconds while Vole obtains its certificate. Issue the admin’s one-time passkey enrollment link from your computer:

vole admin --remote ssh://git@forge.example.com:2222 account invite admin

With the sshd front door the remote is ssh://git@forge.example.com; drop the port. Open the link in a private browser window and register a passkey.

Verify

Create and clone a repository from your computer:

vole admin --remote ssh://git@forge.example.com:2222 repo create demo
vole admin --remote ssh://git@forge.example.com:2222 \
  acl set-default-role demo reader
git clone ssh://git@forge.example.com:2222/demo.git

Omit set-default-role if demo should remain private.

Put sshd in front of Vole (optional) {: #put-sshd-in-front-of-vole }

Vole’s own SSH listener answers on 2222, so every clone URL carries :2222. Letting the system sshd authenticate and hand the session to Vole removes the port and keeps one SSH endpoint on the host.

The system sshd can do the authentication and keep Vole behind it:

client --ssh:22--> system sshd
                     | AuthorizedKeysCommand -> vole ssh-authorized-keys
                     | forced command        -> vole ssh-exec --session <token>
                     v
              vole ssh-exec (the git account; no data access)
                     | one framed request over a local socket
                     v
              vole serve (the only writer)

A key is still a Vole account; sshd asks vole ssh-authorized-keys whether it is, and the forced command it runs hands the session to the running service over /run/vole/ssh.sock. Because sshd owns 22, ssh_addr = "0.0.0.0:22" puts no port in any URL, and git clone ssh://git@forge.example.com/demo.git works.

An existing instance

The package creates the git account and ships the drop-in at /usr/share/vole/sshd/vole.conf; it does not install it, and it never edits /etc/ssh. Four steps, in this order:

  1. Read the drop-in. It names the git account the package created. If you set ssh_user to something else, change its Match User line to that account and give the account /usr/lib/vole/ssh-shell as its shell.

  2. Append one line at the end of /etc/ssh/sshd_config:

    Include /usr/share/vole/sshd/vole.conf
    

    It must be last. A Match block applies to everything after it, so an include placed above other settings would silently scope them to the git account.

    echo 'Include /usr/share/vole/sshd/vole.conf' | sudo tee -a /etc/ssh/sshd_config
    sudo sshd -t && sudo systemctl reload ssh    # on RHEL the unit is sshd
    
  3. Set the three settings in /etc/vole/vole.toml:

    ssh_listen = "socket"
    ssh_addr = "0.0.0.0:22"
    ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub"
    

    ssh_addr is now only what generated clone URLs say; Vole binds no TCP port of its own. ssh_socket defaults to /run/vole/ssh.sock, which is the path the package creates for it.

  4. Restart Vole:

    sudo systemctl restart vole
    

Then check the three answers that matter:

ssh git@forge.example.com          # refused: this account runs no shell
vole whoami --remote ssh://git@forge.example.com/demo.git
git clone ssh://git@forge.example.com/demo.git

Migrate an existing instance

  • Nothing changes until you opt in. An instance that keeps ssh_listen = "tcp" behaves exactly as before, on 2222.
  • Clients need a new known_hosts entry for the host on 22. The old [host]:2222 entry becomes unused and does no harm: ssh-keyscan forge.example.com >> ~/.ssh/known_hosts.
  • Remotes drop the port: git remote set-url origin ssh://git@forge.example.com/demo.git. A remote still naming :2222 keeps working only while the built-in listener is up, so change the remotes before you switch.
  • Runners: replace --remote ssh://git@host:2222 with --remote ssh://git@host, and re-pin runner_known_hosts with ssh-keyscan host (no -p). The packaged runner template renders both shapes with SSH_PORT. A runner that keeps :2222 fails its first lease with a connection error, not an authentication error.
  • CI jobs that act as a bot change nothing: the host key they verify comes from the lease, and in this mode that is sshd’s key.
  • Backups change: /etc/ssh/ssh_host_ed25519_key is now part of what must survive a restore, and data/ssh_host_ed25519_key is only used by direct mode.

To go back, reverse the four steps: set ssh_listen = "tcp" and ssh_addr to the built-in listener’s address, remove the Include line, sshd -t, reload the SSH service (ssh on Debian and Ubuntu, sshd on RHEL), restart Vole, and put :2222 back in the remotes and runner arguments.

Set up a runner on Linux

Install Vole with the Debian or Ubuntu package repository. Then install rootless Podman and create a dedicated account:

sudo apt install podman slirp4netns fuse-overlayfs uidmap
sudo useradd --create-home --home-dir /var/lib/vole-runner \
  --shell /usr/sbin/nologin ci-runner
sudo usermod --add-subuids 100000-165535 \
  --add-subgids 100000-165535 ci-runner
sudo install -d -o ci-runner -g ci-runner -m 0700 \
  /var/lib/vole-runner/.ssh
sudo -u ci-runner ssh-keygen -q -t ed25519 -N '' \
  -f /var/lib/vole-runner/.ssh/id_ed25519

Pin the forge’s host key. Confirm the fingerprint through a trusted channel before relying on it. Without the front door Vole’s own listener answers on 2222; with it, sshd answers on 22 and the entry is a plain host name:

ssh-keyscan -p 2222 forge.example.com \
  | sudo tee /etc/vole/runner_known_hosts
ssh-keyscan forge.example.com \
  | sudo tee /etc/vole/runner_known_hosts

Write /etc/vole/runner.env. Drop the port from --remote on a front-door instance:

sudo tee /etc/vole/runner.env >/dev/null <<'EOF'
VOLE_RUNNER_ARGS=--remote ssh://git@forge.example.com:2222 --container-runtime podman --container-network bridge --container-memory 4G --container-tmpfs 1G --disk-reserve 2G --dir /var/lib/vole-runner --known-hosts /etc/vole/runner_known_hosts --label linux
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now vole-runner

Add --jobs <n> for concurrent jobs and size the machine for that many containers. The file is split at spaces, so keep all arguments on one line. systemctl status vole-runner and journalctl -u vole-runner report runtime probe and connection failures.

Register and authorize the runner under Runners.

Troubleshooting

Start with the service journal and the port that the clone URL names. These are the failures that happen before the forge is reachable.

Symptom Check
Every connection times out Public address, provider firewall, and security-group rules
Certificate warning or failure dig +short forge.example.com, ports 80 and 443, and journalctl -u vole for ACME errors
First boot did not configure Vole /var/log/vole-first-boot.log, package URL, and package architecture
Git cannot connect on 2222 Inbound port 2222 and ssh_listen; with the front door there is no 2222
ssh git@forge.example.com says “this account runs no shell” Correct: the front-door account runs only the forced command
Push is refused with Permission denied (publickey) journalctl -u sshd for AuthorizedKeysCommand errors, vole whoami, and the key rendered into user data
Push fails but fetch works The remote still names :2222 while the built-in listener is off
A clone verifies the wrong host key A stale [host]:2222 entry in known_hosts; the front door’s entry is plain host

Next

  • Cloud-init — bootstrap a VPS or cloud instance on first boot.
  • Runners — register and verify the runner.
  • Configuration — the full vole.toml surface.