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.
Rewrite documentation around reader tasks
d1f44d838966c0a4762073f12375ec7562582fdf · Keenan Nemetz · 21h ago · parent 9103f6a8
docs/deploy/linux.md +334
| @@ -0,0 +1,334 @@ | |||
| 1 | # Deploy on Linux | ||
| 2 | |||
| 3 | Set up a public forge on a dedicated Linux machine. You need `sudo` access, a | ||
| 4 | DNS name such as `forge.example.com`, and the SSH public key for the first | ||
| 5 | instance administrator. Open ports 80, 443, and 2222 as described below, and | ||
| 6 | point the DNS name at the machine before starting Vole. | ||
| 7 | |||
| 8 | The service examples use systemd. Package installation supports Debian, Ubuntu, | ||
| 9 | Fedora, RHEL, Rocky, AlmaLinux, and Arch Linux; the runner setup below is | ||
| 10 | specific to Debian and Ubuntu. | ||
| 11 | |||
| 12 | ## Install the package | ||
| 13 | |||
| 14 | Install Vole with the [Debian or Ubuntu package repository](../install.md#debian-or-ubuntu), the [Fedora, RHEL, or Rocky repository](../install.md#fedora-rhel-or-rocky), or the [Arch Linux repository](../install.md#arch-linux). The package installs the binary, systemd units, and `/etc/vole/vole.toml`; it does not create an instance admin or enable the service. | ||
| 15 | |||
| 16 | ## What the package installs | ||
| 17 | |||
| 18 | | Path | Purpose | | ||
| 19 | |---|---| | ||
| 20 | | `/usr/bin/vole` | Vole binary with the release version embedded | | ||
| 21 | | `/usr/lib/systemd/system/vole.service` | Hardened forge service | | ||
| 22 | | `/usr/lib/systemd/system/vole-runner.service` | Runner service, disabled until configured | | ||
| 23 | | `/etc/vole/vole.toml` | Forge configuration, preserved as a conffile or Arch backup entry | | ||
| 24 | | `/etc/vole/runner.env` | Runner arguments, preserved as a conffile or Arch backup entry | | ||
| 25 | | `/etc/containers/registries.conf.d/50-vole-runner.conf` | Short-name registry resolution for rootless Podman | | ||
| 26 | | `/etc/containers/containers.conf.d/50-vole-runner.conf` | `cgroupfs` configuration for the system runner unit | | ||
| 27 | | `/usr/share/vole/sshd/vole.conf` | sshd drop-in for the front door; shipped, never installed | | ||
| 28 | | `/usr/lib/vole/ssh-shell` | Login shell of the `git` account: runs one command, refuses the rest | | ||
| 29 | | `/usr/lib/tmpfiles.d/vole.conf` | Creates `/run/vole` as `vole:git` mode `2770` at boot | | ||
| 30 | | `/usr/share/doc/vole/` | `LICENSE` and `NOTICE` | | ||
| 31 | | `/var/lib/vole/data` | Repositories, databases, objects, logs, secrets, and host key | | ||
| 32 | |||
| 33 | The packages depend on Git and nothing else. SQLite is compiled into the binary | ||
| 34 | by a pure-Go driver, so the executable is static and no package names a runtime | ||
| 35 | database library. That is also what lets the release publish one Linux binary | ||
| 36 | and two macOS binaries that run without a matching system SQLite; see | ||
| 37 | [Install a release binary](../install.md#install-a-release-binary) and | ||
| 38 | [Install on macOS](../install.md#install-on-macos). | ||
| 39 | |||
| 40 | Installation creates the `vole` service account, creates a `git` account for the | ||
| 41 | SSH front door, and initializes the data directory. It does not create an | ||
| 42 | instance admin, enable the forge service, or touch `/etc/ssh`: putting sshd in | ||
| 43 | front of Vole is a change to your sshd, so the drop-in is shipped and not | ||
| 44 | installed. `/usr/share/vole/sshd/vole.conf` opens with the four steps. | ||
| 45 | |||
| 46 | Run local administration as the service user so new files retain the correct | ||
| 47 | ownership: | ||
| 48 | |||
| 49 | ```sh | ||
| 50 | sudo -u vole vole admin --config /etc/vole/vole.toml account list | ||
| 51 | ``` | ||
| 52 | |||
| 53 | |||
| 54 | ## Configure the service | ||
| 55 | |||
| 56 | Write `/etc/vole/vole.toml`: | ||
| 57 | |||
| 58 | ```toml | ||
| 59 | data_dir = "/var/lib/vole/data" | ||
| 60 | http_addr = ":80" | ||
| 61 | https_addr = ":443" | ||
| 62 | public_url = "https://forge.example.com" | ||
| 63 | acme_email = "you@example.com" | ||
| 64 | ssh_addr = "0.0.0.0:2222" | ||
| 65 | ``` | ||
| 66 | |||
| 67 | The hardened unit needs one capability to bind ports 80 and 443: | ||
| 68 | |||
| 69 | ```sh | ||
| 70 | sudo install -d -m 0755 /etc/systemd/system/vole.service.d | ||
| 71 | sudo tee /etc/systemd/system/vole.service.d/bind.conf >/dev/null <<'EOF' | ||
| 72 | [Service] | ||
| 73 | CapabilityBoundingSet=CAP_NET_BIND_SERVICE | ||
| 74 | AmbientCapabilities=CAP_NET_BIND_SERVICE | ||
| 75 | EOF | ||
| 76 | sudo systemctl daemon-reload | ||
| 77 | ``` | ||
| 78 | |||
| 79 | If another service terminates TLS, leave `https_addr` empty, use | ||
| 80 | `http_addr = "127.0.0.1:8080"`, and follow | ||
| 81 | [Running behind a proxy](../configuration.md#running-behind-a-proxy). | ||
| 82 | |||
| 83 | ## Service sandbox | ||
| 84 | |||
| 85 | The forge unit drops capabilities, sets `UMask=0027`, provides private temporary | ||
| 86 | and device trees, hides other processes, and makes `/var/lib/vole` its only | ||
| 87 | writable path. The front door adds one exception, `/run/vole`, for the socket | ||
| 88 | `sshd`'s forced command connects to; it needs no capability because `sshd` owns | ||
| 89 | port 22. `MemoryDenyWriteExecute=true` is appropriate because the forge | ||
| 90 | runs no JIT. | ||
| 91 | |||
| 92 | To bind HTTP port 80 or HTTPS port 443, add only `CAP_NET_BIND_SERVICE`: | ||
| 93 | |||
| 94 | ```ini | ||
| 95 | # /etc/systemd/system/vole.service.d/bind.conf | ||
| 96 | [Service] | ||
| 97 | CapabilityBoundingSet=CAP_NET_BIND_SERVICE | ||
| 98 | AmbientCapabilities=CAP_NET_BIND_SERVICE | ||
| 99 | ``` | ||
| 100 | |||
| 101 | Run `systemctl daemon-reload` and restart Vole after creating that drop-in. Do | ||
| 102 | not run the forge as root or relax its unit for CI; the runner has a separate | ||
| 103 | unit and security model. | ||
| 104 | |||
| 105 | ## Open the firewall | ||
| 106 | |||
| 107 | The package does not change firewall rules. Open SSH and HTTP/HTTPS in the host | ||
| 108 | firewall or provider security group. Open 2222 only while Vole's own SSH listener | ||
| 109 | is in use; with the sshd front door, inbound 22 is the only SSH port. | ||
| 110 | |||
| 111 | ```sh | ||
| 112 | # ufw | ||
| 113 | sudo ufw allow 22/tcp | ||
| 114 | sudo ufw allow 80/tcp | ||
| 115 | sudo ufw allow 443/tcp | ||
| 116 | sudo ufw allow 2222/tcp # only for Vole's own SSH listener | ||
| 117 | ``` | ||
| 118 | |||
| 119 | Or, on a firewalld host: | ||
| 120 | |||
| 121 | ```sh | ||
| 122 | sudo firewall-cmd --permanent --add-service=ssh | ||
| 123 | sudo firewall-cmd --permanent --add-service=http | ||
| 124 | sudo firewall-cmd --permanent --add-service=https | ||
| 125 | sudo firewall-cmd --permanent --add-port=2222/tcp | ||
| 126 | sudo firewall-cmd --reload | ||
| 127 | ``` | ||
| 128 | |||
| 129 | ## Create the first admin | ||
| 130 | |||
| 131 | Copy your public key to the server, then create the admin and start Vole: | ||
| 132 | |||
| 133 | ```sh | ||
| 134 | sudo -u vole vole admin --config /etc/vole/vole.toml \ | ||
| 135 | account create admin --key /tmp/your-key.pub --role admin | ||
| 136 | sudo systemctl enable --now vole | ||
| 137 | ``` | ||
| 138 | |||
| 139 | Open `https://forge.example.com`. The first request can take a few seconds while | ||
| 140 | Vole obtains its certificate. Issue the admin's one-time passkey enrollment link | ||
| 141 | from your computer: | ||
| 142 | |||
| 143 | ```sh | ||
| 144 | vole admin --remote ssh://git@forge.example.com:2222 account invite admin | ||
| 145 | ``` | ||
| 146 | |||
| 147 | With the sshd front door the remote is `ssh://git@forge.example.com`; drop the | ||
| 148 | port. Open the link in a private browser window and register a passkey. | ||
| 149 | |||
| 150 | ## Verify | ||
| 151 | |||
| 152 | Create and clone a repository from your computer: | ||
| 153 | |||
| 154 | ```sh | ||
| 155 | vole admin --remote ssh://git@forge.example.com:2222 repo create demo | ||
| 156 | vole admin --remote ssh://git@forge.example.com:2222 \ | ||
| 157 | acl set-default-role demo reader | ||
| 158 | git clone ssh://git@forge.example.com:2222/demo.git | ||
| 159 | ``` | ||
| 160 | |||
| 161 | Omit `set-default-role` if `demo` should remain private. | ||
| 162 | |||
| 163 | ## Put sshd in front of Vole (optional) {: #put-sshd-in-front-of-vole } | ||
| 164 | |||
| 165 | Vole's own SSH listener answers on 2222, so every clone URL carries `:2222`. | ||
| 166 | Letting the system sshd authenticate and hand the session to Vole removes the | ||
| 167 | port and keeps one SSH endpoint on the host. | ||
| 168 | |||
| 169 | The system sshd can do the authentication and keep Vole behind it: | ||
| 170 | |||
| 171 | ``` | ||
| 172 | client --ssh:22--> system sshd | ||
| 173 | | AuthorizedKeysCommand -> vole ssh-authorized-keys | ||
| 174 | | forced command -> vole ssh-exec --session <token> | ||
| 175 | v | ||
| 176 | vole ssh-exec (the git account; no data access) | ||
| 177 | | one framed request over a local socket | ||
| 178 | v | ||
| 179 | vole serve (the only writer) | ||
| 180 | ``` | ||
| 181 | |||
| 182 | A key is still a Vole account; sshd asks `vole ssh-authorized-keys` whether it is, | ||
| 183 | and the forced command it runs hands the session to the running service over | ||
| 184 | `/run/vole/ssh.sock`. Because sshd owns 22, `ssh_addr = "0.0.0.0:22"` puts no port | ||
| 185 | in any URL, and `git clone ssh://git@forge.example.com/demo.git` works. | ||
| 186 | |||
| 187 | ### An existing instance | ||
| 188 | |||
| 189 | The package creates the `git` account and ships the drop-in at | ||
| 190 | `/usr/share/vole/sshd/vole.conf`; it does not install it, and it never edits | ||
| 191 | `/etc/ssh`. Four steps, in this order: | ||
| 192 | |||
| 193 | 1. Read the drop-in. It names the `git` account the package created. If you set | ||
| 194 | `ssh_user` to something else, change its `Match User` line to that account and | ||
| 195 | give the account `/usr/lib/vole/ssh-shell` as its shell. | ||
| 196 | |||
| 197 | 2. Append one line at the **end** of `/etc/ssh/sshd_config`: | ||
| 198 | |||
| 199 | ``` | ||
| 200 | Include /usr/share/vole/sshd/vole.conf | ||
| 201 | ``` | ||
| 202 | |||
| 203 | **It must be last.** A `Match` block applies to everything after it, so an | ||
| 204 | include placed above other settings would silently scope them to the `git` | ||
| 205 | account. | ||
| 206 | |||
| 207 | ```sh | ||
| 208 | echo 'Include /usr/share/vole/sshd/vole.conf' | sudo tee -a /etc/ssh/sshd_config | ||
| 209 | sudo sshd -t && sudo systemctl reload ssh # on RHEL the unit is sshd | ||
| 210 | ``` | ||
| 211 | |||
| 212 | 3. Set the three settings in `/etc/vole/vole.toml`: | ||
| 213 | |||
| 214 | ```toml | ||
| 215 | ssh_listen = "socket" | ||
| 216 | ssh_addr = "0.0.0.0:22" | ||
| 217 | ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub" | ||
| 218 | ``` | ||
| 219 | |||
| 220 | `ssh_addr` is now only what generated clone URLs say; Vole binds no TCP port | ||
| 221 | of its own. `ssh_socket` defaults to `/run/vole/ssh.sock`, which is the path | ||
| 222 | the package creates for it. | ||
| 223 | |||
| 224 | 4. Restart Vole: | ||
| 225 | |||
| 226 | ```sh | ||
| 227 | sudo systemctl restart vole | ||
| 228 | ``` | ||
| 229 | |||
| 230 | Then check the three answers that matter: | ||
| 231 | |||
| 232 | ```sh | ||
| 233 | ssh git@forge.example.com # refused: this account runs no shell | ||
| 234 | vole whoami --remote ssh://git@forge.example.com/demo.git | ||
| 235 | git clone ssh://git@forge.example.com/demo.git | ||
| 236 | ``` | ||
| 237 | |||
| 238 | ### Migrate an existing instance | ||
| 239 | |||
| 240 | - Nothing changes until you opt in. An instance that keeps `ssh_listen = "tcp"` | ||
| 241 | behaves exactly as before, on 2222. | ||
| 242 | - Clients need a new `known_hosts` entry for the host on 22. The old | ||
| 243 | `[host]:2222` entry becomes unused and does no harm: | ||
| 244 | `ssh-keyscan forge.example.com >> ~/.ssh/known_hosts`. | ||
| 245 | - Remotes drop the port: | ||
| 246 | `git remote set-url origin ssh://git@forge.example.com/demo.git`. A remote | ||
| 247 | still naming `:2222` keeps working only while the built-in listener is up, so | ||
| 248 | change the remotes before you switch. | ||
| 249 | - Runners: replace `--remote ssh://git@host:2222` with | ||
| 250 | `--remote ssh://git@host`, and re-pin `runner_known_hosts` with `ssh-keyscan | ||
| 251 | host` (no `-p`). The packaged runner template renders both shapes with | ||
| 252 | `SSH_PORT`. A runner that keeps `:2222` fails its first lease with a | ||
| 253 | connection error, not an authentication error. | ||
| 254 | - CI jobs that act as a bot change nothing: the host key they verify comes from | ||
| 255 | the lease, and in this mode that is sshd's key. | ||
| 256 | - Backups change: `/etc/ssh/ssh_host_ed25519_key` is now part of what must | ||
| 257 | survive a restore, and `data/ssh_host_ed25519_key` is only used by direct mode. | ||
| 258 | |||
| 259 | To go back, reverse the four steps: set `ssh_listen = "tcp"` and `ssh_addr` to the | ||
| 260 | built-in listener's address, remove the `Include` line, `sshd -t`, reload the SSH | ||
| 261 | service (`ssh` on Debian and Ubuntu, `sshd` on RHEL), restart Vole, and put | ||
| 262 | `:2222` back in the remotes and runner arguments. | ||
| 263 | |||
| 264 | ## Set up a runner on Linux | ||
| 265 | |||
| 266 | Install Vole with the | ||
| 267 | [Debian or Ubuntu package repository](../install.md#debian-or-ubuntu). Then | ||
| 268 | install rootless Podman and create a dedicated account: | ||
| 269 | |||
| 270 | ```sh | ||
| 271 | sudo apt install podman slirp4netns fuse-overlayfs uidmap | ||
| 272 | sudo useradd --create-home --home-dir /var/lib/vole-runner \ | ||
| 273 | --shell /usr/sbin/nologin ci-runner | ||
| 274 | sudo usermod --add-subuids 100000-165535 \ | ||
| 275 | --add-subgids 100000-165535 ci-runner | ||
| 276 | sudo install -d -o ci-runner -g ci-runner -m 0700 \ | ||
| 277 | /var/lib/vole-runner/.ssh | ||
| 278 | sudo -u ci-runner ssh-keygen -q -t ed25519 -N '' \ | ||
| 279 | -f /var/lib/vole-runner/.ssh/id_ed25519 | ||
| 280 | ``` | ||
| 281 | |||
| 282 | Pin the forge's host key. Confirm the fingerprint through a trusted channel | ||
| 283 | before relying on it. Without the front door Vole's own listener answers on 2222; | ||
| 284 | with it, sshd answers on 22 and the entry is a plain host name: | ||
| 285 | |||
| 286 | ```sh | ||
| 287 | ssh-keyscan -p 2222 forge.example.com \ | ||
| 288 | | sudo tee /etc/vole/runner_known_hosts | ||
| 289 | ``` | ||
| 290 | |||
| 291 | ```sh | ||
| 292 | ssh-keyscan forge.example.com \ | ||
| 293 | | sudo tee /etc/vole/runner_known_hosts | ||
| 294 | ``` | ||
| 295 | |||
| 296 | Write `/etc/vole/runner.env`. Drop the port from `--remote` on a front-door | ||
| 297 | instance: | ||
| 298 | |||
| 299 | ```sh | ||
| 300 | sudo tee /etc/vole/runner.env >/dev/null <<'EOF' | ||
| 301 | 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 | ||
| 302 | EOF | ||
| 303 | sudo systemctl daemon-reload | ||
| 304 | sudo systemctl enable --now vole-runner | ||
| 305 | ``` | ||
| 306 | |||
| 307 | Add `--jobs <n>` for concurrent jobs and size the machine for that many | ||
| 308 | containers. The file is split at spaces, so keep all arguments on one line. | ||
| 309 | `systemctl status vole-runner` and `journalctl -u vole-runner` report runtime | ||
| 310 | probe and connection failures. | ||
| 311 | |||
| 312 | Register and authorize the runner under [Runners](../runner.md#register-and-authorize-the-runner). | ||
| 313 | |||
| 314 | ## Troubleshooting | ||
| 315 | |||
| 316 | Start with the service journal and the port that the clone URL names. These are | ||
| 317 | the failures that happen before the forge is reachable. | ||
| 318 | |||
| 319 | | Symptom | Check | | ||
| 320 | |---|---| | ||
| 321 | | Every connection times out | Public address, provider firewall, and security-group rules | | ||
| 322 | | Certificate warning or failure | `dig +short forge.example.com`, ports 80 and 443, and `journalctl -u vole` for ACME errors | | ||
| 323 | | First boot did not configure Vole | `/var/log/vole-first-boot.log`, package URL, and package architecture | | ||
| 324 | | Git cannot connect on 2222 | Inbound port 2222 and `ssh_listen`; with the front door there is no 2222 | | ||
| 325 | | `ssh git@forge.example.com` says "this account runs no shell" | Correct: the front-door account runs only the forced command | | ||
| 326 | | Push is refused with `Permission denied (publickey)` | `journalctl -u sshd` for `AuthorizedKeysCommand` errors, `vole whoami`, and the key rendered into user data | | ||
| 327 | | Push fails but fetch works | The remote still names `:2222` while the built-in listener is off | | ||
| 328 | | A clone verifies the wrong host key | A stale `[host]:2222` entry in `known_hosts`; the front door's entry is plain `host` | | ||
| 329 | |||
| 330 | ## Next | ||
| 331 | |||
| 332 | - [Cloud-init](cloud-init.md) — bootstrap a VPS or cloud instance on first boot. | ||
| 333 | - [Runners](../runner.md) — register and verify the runner. | ||
| 334 | - [Configuration](../configuration.md) — the full `vole.toml` surface. | ||