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.

Ship an sshd drop-in for each platform instead of rendering one at runtime

883ffcc941bdeb32f0587cf0574b0cfbdcd33695 · Keenan Nemetz · 12d ago · parent a4a6d1e9

Ship an sshd drop-in for each platform instead of rendering one at runtime

The drop-in was Linux-only prose: systemctl, useradd, /usr/lib/vole/ssh-shell,
/usr/bin/vole, /etc/vole/vole.toml. The Match block works on macOS, but every
operation around it differs — there is no sshd_config.d, reload is launchctl,
accounts come from sysadminctl, and the binary and config live wherever the
install put them. The only copy was rendered at build time from one fixed set of
paths, so a Mac had nothing to install.

Render two files from the same function instead: vole-linux.conf, which the
package still installs as /usr/share/vole/sshd/vole.conf, and vole-darwin.conf,
which the release publishes as vole-darwin-sshd.conf. The -update test rewrites
both and compares both, and Linux sshd parses the macOS file too because the
directives are identical and only the comments differ.

Options gain the platform, the destination the Include line names, the account
sshd runs AuthorizedKeysCommand as, the forced-command account's shell, and the
socket path. The header branches on platform; the Match block does not. The macOS
file names /usr/local paths and says so, with the one-line substitution a
Homebrew prefix needs.

check-deploy.py and nfpm.yaml follow the renamed Linux file; the package still
installs it as vole.conf, so nothing on a Debian host changes. The front-door
page gains the macOS steps, including that ssh_socket must be a directory both
accounts can reach.

Closes: 01M7ZVF5NWM5S9SV5AD00KFGC7

packaging/sshd/vole-darwin.conf +57

@@ -0,0 +1,57 @@
1 # The system sshd as Vole's front door.
2 #
3 # This file is rendered, not installed: Vole never edits /etc/ssh. To enable the
4 # front door:
5 #
6 # 1. Append this line at the END of /etc/ssh/sshd_config. It must be last: a
7 # Match block applies to everything after it, so an Include placed above
8 # other settings would silently scope them to the matched user.
9 #
10 # Include /etc/ssh/vole.conf
11 #
12 # 2. sudo sshd -t && sudo launchctl kickstart -k system/com.openssh.sshd
13 #
14 # Remote Login must be on: sudo systemsetup -setremotelogin on
15 #
16 # 3. In /usr/local/etc/vole/vole.toml set:
17 #
18 # ssh_listen = "socket"
19 # ssh_addr = "0.0.0.0:22"
20 # ssh_socket = "/usr/local/var/vole/ssh.sock"
21 # ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub"
22 #
23 # ssh_addr is what generated clone URLs carry: port 22 is omitted, so the
24 # URL is ssh://git@host/repo.git.
25 #
26 # 4. Restart vole serve the way it was started: brew services restart vole,
27 # or the launchd job or shell that runs it.
28 #
29 # If this instance uses a different ssh_user, change the Match line below to
30 # name it, and give that account this file as its shell:
31 #
32 # sudo sysadminctl -addUser git -shell /usr/local/lib/vole/ssh-shell ...
33 #
34 # The command below runs /usr/local/bin/vole with
35 # /usr/local/etc/vole/vole.toml, the paths of a system install. A Homebrew
36 # install uses the prefix "brew --prefix" prints (/opt/homebrew on Apple
37 # Silicon): change both paths to match, or sshd will run a binary that is not
38 # there.
39 #
40 # AuthorizedKeysCommandUser below names vole: the account that runs
41 # vole serve. Give the launchd job that name, or change this line to the account
42 # it uses, because sshd runs the roster lookup as it.
43 #
44 # That account reads the roster and mints a session token. The forced command
45 # runs as git, which has no access to the instance's data directory.
46 # AuthorizedKeysFile none means sshd never reads an authorized_keys file on this
47 # machine: the only keys it accepts are the ones Vole answers for.
48
49 Match User git
50 AuthorizedKeysFile none
51 AuthorizedKeysCommand /usr/local/bin/vole ssh-authorized-keys --config /usr/local/etc/vole/vole.toml --fingerprint %f --type %t --key %k --connection %C
52 AuthorizedKeysCommandUser vole
53 PasswordAuthentication no
54 KbdInteractiveAuthentication no
55 DisableForwarding yes
56 PermitTTY no
57 PermitUserRC no