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 the front door without installing it

09610c0f2f7abc5c729973a6a8680d25ed41571f · Keenan Nemetz · 16d ago · parent c5f2c5d4

Ship the front door without installing it

The front door works, but nothing puts it on a machine. This adds the account,
the login shell, the socket directory, the sshd drop-in, and the two deployment
templates, and it leaves every one of them opt-in.

The drop-in is rendered, not written twice. internal/sshdconfig produces the
whole file, the package ships the output for the default account and paths, and a
test compares the two, so the Match block, the account, the binary and the config
path cannot drift from what ssh-authorized-keys is given. The file is shipped at
/usr/share/vole/sshd/vole.conf and never installed: putting a Match block in
somebody's sshd is their decision, and the header says where it must go — appended
last, because everything after a Match block applies only to that match.

The account's shell is a wrapper, /usr/lib/vole/ssh-shell, because ssh_user is an
account name and a shell is a path. It execs `vole ssh-shell` with its arguments
untouched; sshd runs a forced command through the login shell, so that subcommand
has to be reachable from an account whose pw_shell cannot hold a command line.

postinstall creates git:git with no access to /var/lib/vole, creates /run/vole as
vole:git 2770, and adds vole to the group. An existing `git` account is left
exactly as it is, shell included: taking it over would break whatever forge put
it there, and the install says so and points at ssh_user. The setgid bit on
/run/vole is what gives the socket the group both sides share, and the unit gets
ReadWritePaths=/run/vole because ProtectSystem=strict would otherwise make /run
read-only — the front door needs no capability, since sshd owns 22.

The cloud-init templates take SSH_PORT, defaulting to 2222. With 2222 they render
exactly what they rendered before. With 22 they name no port at all: the runner's
--remote, its ssh-keyscan, the forge's ssh_addr and its final clone URL all switch,
and check-deploy renders both flavours and fails if anything still says 2222. The
forge templates also carry the commented front-door block, and packaging/vole.toml
documents the four settings.

check-deploy now also parses the four packaging files after one account name, and
`sh -n`s the postinstall and the shell wrapper: both run as root or as a login
shell, where a syntax error is found at the worst possible moment.

The documentation and migration are #307.

deploy/cloud-init/render.sh +23−2

@@ -39,6 +39,27 @@ render() {
39 39 printf '%s\n' "$rendered"
40 40 }
41 41
42 # ssh_port is the port the instance's SSH answers on. 22 means the system sshd is
43 # the front door, and then nothing rendered here may name a port: a clone URL with
44 # :22 works but is not what the mode is for, and anything still pointing at :2222
45 # points at a listener that does not exist.
46 : "${SSH_PORT:=2222}"
47 case "$SSH_PORT" in
48 "" | *[!0-9]*)
49 echo "SSH_PORT must be a port number, got $SSH_PORT" >&2
50 exit 2
51 ;;
52 22)
53 ssh_url_port=""
54 ssh_scan_args=""
55 ;;
56 *)
57 ssh_url_port=":$SSH_PORT"
58 ssh_scan_args="-p $SSH_PORT"
59 ;;
60 esac
61 export ssh_port="$SSH_PORT" ssh_url_port ssh_scan_args
62
42 63 case "$what" in
43 64 vole)
44 65 : "${HOSTNAME:?set HOSTNAME to the DNS name the instance will answer on}"
@@ -65,7 +86,7 @@ vole)
65 86 export tls_mode="$TLS_MODE"
66 87 export vole_package_url="$VOLE_PACKAGE_URL"
67 88
68 render vole.yaml hostname admin_account admin_ssh_key admin_email instance_name tls_mode vole_package_url
89 render vole.yaml hostname admin_account admin_ssh_key admin_email instance_name tls_mode vole_package_url ssh_port ssh_url_port
69 90 ;;
70 91 runner)
71 92 : "${FORGE_HOST:?set FORGE_HOST to the instance's DNS name}"
@@ -107,7 +128,7 @@ runner)
107 128 export runner_labels="$labels"
108 129 export vole_package_url="$VOLE_PACKAGE_URL"
109 130
110 render runner.yaml runner_hostname forge_host runner_runtime runner_network runner_dir runner_jobs runner_labels runner_memory runner_pids runner_tmpfs runner_disk_reserve vole_package_url
131 render runner.yaml runner_hostname forge_host runner_runtime runner_network runner_dir runner_jobs runner_labels runner_memory runner_pids runner_tmpfs runner_disk_reserve vole_package_url ssh_port ssh_url_port ssh_scan_args
111 132 ;;
112 133 *)
113 134 echo "unknown template $what; use vole or runner" >&2