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
1# Deploy on Linux
2
3Set up a public forge on a dedicated Linux machine. You need `sudo` access, a
4DNS name such as `forge.example.com`, and the SSH public key for the first
5instance administrator. Open ports 80, 443, and 2222 as described below, and
6point the DNS name at the machine before starting Vole.
7
8The service examples use systemd. Package installation supports Debian, Ubuntu,
9Fedora, RHEL, Rocky, AlmaLinux, and Arch Linux; the runner setup below is
10specific to Debian and Ubuntu.
11
12## Install the package
13
14Install 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
33The packages depend on Git and nothing else. SQLite is compiled into the binary
34by a pure-Go driver, so the executable is static and no package names a runtime
35database library. That is also what lets the release publish one Linux binary
36and 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
40Installation creates the `vole` service account, creates a `git` account for the
41SSH front door, and initializes the data directory. It does not create an
42instance admin, enable the forge service, or touch `/etc/ssh`: putting sshd in
43front of Vole is a change to your sshd, so the drop-in is shipped and not
44installed. `/usr/share/vole/sshd/vole.conf` opens with the four steps.
45
46Run local administration as the service user so new files retain the correct
47ownership:
48
49```sh
50sudo -u vole vole admin --config /etc/vole/vole.toml account list
51```
52
53
54## Configure the service
55
56Write `/etc/vole/vole.toml`:
57
58```toml
59data_dir = "/var/lib/vole/data"
60http_addr = ":80"
61https_addr = ":443"
62public_url = "https://forge.example.com"
63acme_email = "you@example.com"
64ssh_addr = "0.0.0.0:2222"
65```
66
67The hardened unit needs one capability to bind ports 80 and 443:
68
69```sh
70sudo install -d -m 0755 /etc/systemd/system/vole.service.d
71sudo tee /etc/systemd/system/vole.service.d/bind.conf >/dev/null <<'EOF'
72[Service]
73CapabilityBoundingSet=CAP_NET_BIND_SERVICE
74AmbientCapabilities=CAP_NET_BIND_SERVICE
75EOF
76sudo systemctl daemon-reload
77```
78
79If 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
85The forge unit drops capabilities, sets `UMask=0027`, provides private temporary
86and device trees, hides other processes, and makes `/var/lib/vole` its only
87writable 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
89port 22. `MemoryDenyWriteExecute=true` is appropriate because the forge
90runs no JIT.
91
92To 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]
97CapabilityBoundingSet=CAP_NET_BIND_SERVICE
98AmbientCapabilities=CAP_NET_BIND_SERVICE
99```
100
101Run `systemctl daemon-reload` and restart Vole after creating that drop-in. Do
102not run the forge as root or relax its unit for CI; the runner has a separate
103unit and security model.
104
105## Open the firewall
106
107The package does not change firewall rules. Open SSH and HTTP/HTTPS in the host
108firewall or provider security group. Open 2222 only while Vole's own SSH listener
109is in use; with the sshd front door, inbound 22 is the only SSH port.
110
111```sh
112# ufw
113sudo ufw allow 22/tcp
114sudo ufw allow 80/tcp
115sudo ufw allow 443/tcp
116sudo ufw allow 2222/tcp # only for Vole's own SSH listener
117```
118
119Or, on a firewalld host:
120
121```sh
122sudo firewall-cmd --permanent --add-service=ssh
123sudo firewall-cmd --permanent --add-service=http
124sudo firewall-cmd --permanent --add-service=https
125sudo firewall-cmd --permanent --add-port=2222/tcp
126sudo firewall-cmd --reload
127```
128
129## Create the first admin
130
131Copy your public key to the server, then create the admin and start Vole:
132
133```sh
134sudo -u vole vole admin --config /etc/vole/vole.toml \
135 account create admin --key /tmp/your-key.pub --role admin
136sudo systemctl enable --now vole
137```
138
139Open `https://forge.example.com`. The first request can take a few seconds while
140Vole obtains its certificate. Issue the admin's one-time passkey enrollment link
141from your computer:
142
143```sh
144vole admin --remote ssh://git@forge.example.com:2222 account invite admin
145```
146
147With the sshd front door the remote is `ssh://git@forge.example.com`; drop the
148port. Open the link in a private browser window and register a passkey.
149
150## Verify
151
152Create and clone a repository from your computer:
153
154```sh
155vole admin --remote ssh://git@forge.example.com:2222 repo create demo
156vole admin --remote ssh://git@forge.example.com:2222 \
157 acl set-default-role demo reader
158git clone ssh://git@forge.example.com:2222/demo.git
159```
160
161Omit `set-default-role` if `demo` should remain private.
162
163## Put sshd in front of Vole (optional) {: #put-sshd-in-front-of-vole }
164
165Vole's own SSH listener answers on 2222, so every clone URL carries `:2222`.
166Letting the system sshd authenticate and hand the session to Vole removes the
167port and keeps one SSH endpoint on the host.
168
169The system sshd can do the authentication and keep Vole behind it:
170
171```
172client --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
182A key is still a Vole account; sshd asks `vole ssh-authorized-keys` whether it is,
183and 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
185in any URL, and `git clone ssh://git@forge.example.com/demo.git` works.
186
187### An existing instance
188
189The 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
1931. 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
1972. 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
2123. 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
2244. Restart Vole:
225
226 ```sh
227 sudo systemctl restart vole
228 ```
229
230Then check the three answers that matter:
231
232```sh
233ssh git@forge.example.com # refused: this account runs no shell
234vole whoami --remote ssh://git@forge.example.com/demo.git
235git 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
259To go back, reverse the four steps: set `ssh_listen = "tcp"` and `ssh_addr` to the
260built-in listener's address, remove the `Include` line, `sshd -t`, reload the SSH
261service (`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
266Install Vole with the
267[Debian or Ubuntu package repository](../install.md#debian-or-ubuntu). Then
268install rootless Podman and create a dedicated account:
269
270```sh
271sudo apt install podman slirp4netns fuse-overlayfs uidmap
272sudo useradd --create-home --home-dir /var/lib/vole-runner \
273 --shell /usr/sbin/nologin ci-runner
274sudo usermod --add-subuids 100000-165535 \
275 --add-subgids 100000-165535 ci-runner
276sudo install -d -o ci-runner -g ci-runner -m 0700 \
277 /var/lib/vole-runner/.ssh
278sudo -u ci-runner ssh-keygen -q -t ed25519 -N '' \
279 -f /var/lib/vole-runner/.ssh/id_ed25519
280```
281
282Pin the forge's host key. Confirm the fingerprint through a trusted channel
283before relying on it. Without the front door Vole's own listener answers on 2222;
284with it, sshd answers on 22 and the entry is a plain host name:
285
286```sh
287ssh-keyscan -p 2222 forge.example.com \
288 | sudo tee /etc/vole/runner_known_hosts
289```
290
291```sh
292ssh-keyscan forge.example.com \
293 | sudo tee /etc/vole/runner_known_hosts
294```
295
296Write `/etc/vole/runner.env`. Drop the port from `--remote` on a front-door
297instance:
298
299```sh
300sudo tee /etc/vole/runner.env >/dev/null <<'EOF'
301VOLE_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
302EOF
303sudo systemctl daemon-reload
304sudo systemctl enable --now vole-runner
305```
306
307Add `--jobs <n>` for concurrent jobs and size the machine for that many
308containers. 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
310probe and connection failures.
311
312Register and authorize the runner under [Runners](../runner.md#register-and-authorize-the-runner).
313
314## Troubleshooting
315
316Start with the service journal and the port that the clone URL names. These are
317the 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.
335