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.

Document the front door and the way back

bca53bdad334204063f07158d6885e22c5eb69ff · Keenan Nemetz · 16d ago · parent 09610c0f

Document the front door and the way back

The feature works and the package ships it, and nothing tells anyone. This is the
deploy page's half: what the front door is, the four steps that turn it on, how to
move an existing instance onto it, and how to move back.

The cloud-init templates needed a fix before they could be documented. SSH_PORT
alone only changed the port in the rendered configuration, so SSH_PORT=22 produced
a machine whose Vole tried to bind 22 itself and lost to sshd on first boot. The
render now derives the mode as well: ssh_listen = "socket", sshd's public host key,
and a guarded block in the first-boot script that appends the Include, runs sshd
-t and reloads. It checks for the drop-in before writing anything, so a package
without it leaves the machine alone with the reason in the log.

The rest is prose that had to become true: the port table, the troubleshooting
rows, the clone-URL examples, the runner's remote and ssh-keyscan in both shapes,
the backup gaining /etc/ssh/ssh_host_ed25519_key, the quickstart saying why a
development instance stays on 2222, and the architecture page naming one SSH
endpoint per instance as a choice.

check-deploy renders both flavours and fails if the front-door one still names
2222, keeps Vole's own listener, or omits any of the three settings that make the
mode work.

The design document itself is not here: #268 has not landed, so there is no
docs/design/sshd-front-door.md on main to mark accepted, and a link to it would be
a dead relative link that check-links rejects.

docs/deploy/index.md +148−4

@@ -30,10 +30,16 @@ HOSTNAME=forge.example.com \
30 30 ADMIN_ACCOUNT=admin \
31 31 ADMIN_EMAIL=you@example.com \
32 32 ADMIN_SSH_KEY="$(cat ~/.ssh/id_ed25519.pub)" \
33 SSH_PORT=22 \
33 34 VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \
34 35 ./render.sh > user-data.yaml
35 36 ```
36 37
38 `SSH_PORT=22` puts the system sshd in front of Vole, which is what makes every
39 clone URL portless. Omit it to use Vole's own listener on 2222 instead; the rest
40 of this page works either way, and
41 [Put sshd in front of Vole](#put-sshd-in-front-of-vole) says what changes.
42
37 43 Inspect `user-data.yaml` before giving it to a provider. It contains the public
38 44 SSH key, package URL, and complete first-boot configuration.
39 45
@@ -46,6 +52,7 @@ SSH key, package URL, and complete first-boot configuration.
46 52 | `ADMIN_EMAIL` | empty | Contact address for the certificate authority |
47 53 | `INSTANCE_NAME` | `Vole` | Display name for this forge |
48 54 | `TLS_MODE` | `acme` | `acme` manages certificates; `proxy` serves loopback HTTP for your TLS proxy |
55 | `SSH_PORT` | `2222` | `22` lets the system sshd authenticate and drops the port from clone URLs; anything else is Vole's own listener |
49 56
50 57 For `TLS_MODE=proxy`, configure the proxy and client-IP header as described in
51 58 [Running behind a proxy](../configuration.md#running-behind-a-proxy).
@@ -73,12 +80,16 @@ user data.
73 80
74 81 | Direction | TCP port | Allowed source | Purpose |
75 82 |---|---:|---|---|
76 | Inbound | 22 | Your administrators | Shell access |
77 | Inbound | 2222 | People who push | Vole Git over SSH |
83 | Inbound | 22 | Your administrators | Shell access, and Git over SSH when sshd is the front door |
84 | Inbound | 2222 | People who push | Vole Git over SSH when Vole's own listener serves it |
78 85 | Inbound | 80 | Anywhere | ACME challenge and HTTPS redirect |
79 86 | Inbound | 443 | Anywhere | Forge over HTTPS |
80 87 | Outbound | any | Package and certificate providers | Installation and renewal |
81 88
89 With `SSH_PORT=22` there is no inbound 2222 to open: sshd already answers on 22,
90 and Vole is reached only through it and over the local socket. Keep 2222 closed
91 unless you also run the built-in listener.
92
82 93 Use the provider firewall or AWS security group. Hetzner and DigitalOcean servers
83 94 can be open until a firewall is attached; AWS instances normally require inbound
84 95 rules. For `TLS_MODE=proxy`, expose only the ports your arrangement needs and
@@ -104,6 +115,10 @@ From your computer, issue the admin's one-time passkey enrollment link:
104 115 vole admin --remote ssh://git@forge.example.com:2222 account invite admin
105 116 ```
106 117
118 With `SSH_PORT=22` the remote is `ssh://git@forge.example.com` — no port. The
119 examples below keep `:2222` for the built-in listener; drop it for the front
120 door.
121
107 122 Open the link in a private browser window and register a passkey. Then create and
108 123 clone a repository:
109 124
@@ -162,6 +177,132 @@ For a proxy setup, leave `https_addr` empty, use
162 177 `http_addr = "127.0.0.1:8080"`, and follow
163 178 [Running behind a proxy](../configuration.md#running-behind-a-proxy).
164 179
180 ## Put sshd in front of Vole
181
182 Vole's own SSH listener answers on 2222 so it does not fight sshd, and every clone
183 URL then carries `:2222`. The other arrangement is to let the system sshd do the
184 authentication and keep Vole behind it:
185
186 ```
187 client --ssh:22--> system sshd
188 | AuthorizedKeysCommand -> vole ssh-authorized-keys
189 | forced command -> vole ssh-exec --session <token>
190 v
191 vole ssh-exec (the git account; no data access)
192 | one framed request over a local socket
193 v
194 vole serve (the only writer)
195 ```
196
197 A key is still a Vole account; sshd asks `vole ssh-authorized-keys` whether it is,
198 and the forced command it runs hands the session to the running service over
199 `/run/vole/ssh.sock`. Because sshd owns 22, `ssh_addr = "0.0.0.0:22"` puts no port
200 in any URL, and `git clone ssh://git@forge.example.com/demo.git` works.
201
202 Nothing else about the instance moves: `vole serve` is still the only writer, and
203 Vole's own listener stays the default for development.
204
205 ### A fresh cloud-init instance
206
207 `SSH_PORT=22` renders the front-door configuration, adds `ssh_listen = "socket"`,
208 and appends the sshd include on first boot:
209
210 ```sh
211 SSH_PORT=22 ./render.sh > user-data.yaml
212 ```
213
214 ### An existing instance
215
216 The package creates the `git` account and ships the drop-in at
217 `/usr/share/vole/sshd/vole.conf`; it does not install it, and it never edits
218 `/etc/ssh`. Four steps, in this order:
219
220 1. Read the drop-in. It names the `git` account the package created. If you set
221 `ssh_user` to something else, change its `Match User` line to that account and
222 give the account `/usr/lib/vole/ssh-shell` as its shell.
223
224 2. Append one line at the **end** of `/etc/ssh/sshd_config`:
225
226 ```
227 Include /usr/share/vole/sshd/vole.conf
228 ```
229
230 It must be last. A `Match` block applies to everything after it, so an include
231 placed above other settings would silently scope them to the `git` account.
232
233 ```sh
234 echo 'Include /usr/share/vole/sshd/vole.conf' | sudo tee -a /etc/ssh/sshd_config
235 sudo sshd -t && sudo systemctl reload sshd
236 ```
237
238 3. Set the three settings in `/etc/vole/vole.toml`:
239
240 ```toml
241 ssh_listen = "socket"
242 ssh_addr = "0.0.0.0:22"
243 ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub"
244 ```
245
246 `ssh_addr` is now only what generated clone URLs say; Vole binds no TCP port
247 of its own. `ssh_socket` defaults to `/run/vole/ssh.sock`, which is the path
248 the package creates for it.
249
250 4. Restart Vole:
251
252 ```sh
253 sudo systemctl restart vole
254 ```
255
256 Then check the three answers that matter:
257
258 ```sh
259 ssh git@forge.example.com # refused: this account runs no shell
260 vole whoami --remote ssh://git@forge.example.com
261 git clone ssh://git@forge.example.com/demo.git
262 ```
263
264 `vole whoami` returning your account name means sshd resolved your key to it and
265 the forced command reached the service.
266
267 Every remote command takes the same portless URL, because they all use the same
268 SSH endpoint:
269
270 ```sh
271 vole admin --remote ssh://forge.example.com account invite admin
272 vole secret list demo --remote ssh://forge.example.com
273 vole change show 42 --remote ssh://forge.example.com
274 vole run list --remote ssh://forge.example.com
275 vole runner --remote ssh://forge.example.com
276 ```
277
278 A `:2222` in an example elsewhere on this site belongs to Vole's own listener;
279 drop it for an instance whose sshd is the front door.
280
281 ### Migrate an existing instance
282
283 - Nothing changes until you opt in. An instance that keeps `ssh_listen = "tcp"`
284 behaves exactly as before, on 2222.
285 - Clients need a new `known_hosts` entry for the host on 22. The old
286 `[host]:2222` entry becomes unused and does no harm:
287 `ssh-keyscan forge.example.com >> ~/.ssh/known_hosts`.
288 - Remotes drop the port:
289 `git remote set-url origin ssh://git@forge.example.com/demo.git`. A remote
290 still naming `:2222` keeps working only while the built-in listener is up, so
291 change the remotes before you switch.
292 - Runners: replace `--remote ssh://git@host:2222` with
293 `--remote ssh://git@host`, and re-pin `runner_known_hosts` with `ssh-keyscan
294 host` (no `-p`). The packaged runner template renders both shapes with
295 `SSH_PORT`. A runner that keeps `:2222` fails its first lease with a
296 connection error, not an authentication error.
297 - CI jobs that act as a bot change nothing: the host key they verify comes from
298 the lease, and in this mode that is sshd's key.
299 - Backups change: `/etc/ssh/ssh_host_ed25519_key` is now part of what must
300 survive a restore, and `data/ssh_host_ed25519_key` is only used by direct mode.
301
302 To go back, reverse the four steps: set `ssh_listen = "tcp"` and `ssh_addr` to the
303 built-in listener's address, remove the `Include` line, `sshd -t`, reload sshd,
304 restart Vole, and put `:2222` back in the remotes and runner arguments.
305
165 306 ## Troubleshoot
166 307
167 308 | Symptom | Check |
@@ -169,8 +310,11 @@ For a proxy setup, leave `https_addr` empty, use
169 310 | Every connection times out | Public address, provider firewall, and security-group rules |
170 311 | Certificate warning or failure | `dig +short forge.example.com`, ports 80 and 443, and `journalctl -u vole` for ACME errors |
171 312 | First boot did not configure Vole | `/var/log/vole-first-boot.log`, package URL, and package architecture |
172 | Git cannot connect on 2222 | Inbound port 2222 and the SSH service listener |
173 | Push is refused | `vole whoami --remote ssh://git@forge.example.com:2222` and the public key rendered into user data |
313 | Git cannot connect on 2222 | Inbound port 2222 and `ssh_listen`; with the front door there is no 2222 |
314 | `ssh git@forge.example.com` says "this account runs no shell" | Correct: the front-door account runs only the forced command |
315 | Push is refused with `Permission denied (publickey)` | `journalctl -u sshd` for `AuthorizedKeysCommand` errors, `vole whoami`, and the key rendered into user data |
316 | Push fails but fetch works | The remote still names `:2222` while the built-in listener is off |
317 | A clone verifies the wrong host key | A stale `[host]:2222` entry in `known_hosts`; the front door's entry is plain `host` |
174 318
175 319 Editing user data after creation does not rerun cloud-init. Change
176 320 `/etc/vole/vole.toml` and restart Vole for configuration updates: