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/vole.yaml +18−4

@@ -42,7 +42,15 @@ write_files:
42 42 acme_email = "${admin_email}"
43 43
44 44 # The only write transport: Git over SSH, authenticated by key.
45 ssh_addr = "0.0.0.0:2222"
45 ssh_addr = "0.0.0.0:${ssh_port}"
46
47 # Or put the system sshd in front, so no clone URL carries a port. The
48 # package creates the `git` account and ships the sshd drop-in but does not
49 # install it: /usr/share/vole/sshd/vole.conf on the machine has the four
50 # steps. Then uncomment these and set ssh_addr to 0.0.0.0:22.
51 #
52 # ssh_listen = "socket"
53 # ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub"
46 54
47 55 instance_name = "${instance_name}"
48 56
@@ -60,7 +68,13 @@ write_files:
60 68 # git_http_client_ip_header = "X-Forwarded-For"
61 69
62 70 # The only write transport: Git over SSH, authenticated by key.
63 ssh_addr = "0.0.0.0:2222"
71 ssh_addr = "0.0.0.0:${ssh_port}"
72
73 # See the note in vole.acme.toml: ssh_listen = "socket" moves SSH behind
74 # sshd, and then ssh_addr names port 22.
75 #
76 # ssh_listen = "socket"
77 # ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub"
64 78
65 79 instance_name = "${instance_name}"
66 80
@@ -131,5 +145,5 @@ runcmd:
131 145
132 146 final_message: >-
133 147 Vole is up. Open https://${hostname} to sign in, or clone
134 ssh://git@${hostname}:2222/ once you have created a repository. Setup output is
135 in /var/log/vole-first-boot.log.
148 ssh://git@${hostname}${ssh_url_port}/ once you have created a repository. Setup
149 output is in /var/log/vole-first-boot.log.