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.
Mint a one-use session for each front door connection
e075258f0e4456f654680eeb7ba246e80d6c9a97 · Keenan Nemetz · 16d ago · parent 5ff8dfc9
Mint a one-use session for each front door connection sshd can authenticate a Vole key and then hand the request to something else. This adds the two ends of that handoff, plus the capability that crosses it. `vole ssh-authorized-keys` is sshd's AuthorizedKeysCommand. It opens the roster and the run credentials without running a schema or a migration — a write on the path sshd takes before it knows who is connecting is a write nobody watches — and for an active key prints the client's key back with `restrict,command=` and a token. An unknown key, a retired account, and an expired credential all produce no line and no row, so sshd refuses before any Vole process runs. The token is 256 random bits, stored only as a SHA-256 hash, good for one use and sixty seconds, and bound to the client endpoint sshd reports for the connection. That binding is what closes the one weakness of a capability in argv: `/proc` lets another local user read the forced command, but not spend it from their own connection. A token that turns up at the wrong endpoint is deleted, not left for the rest of its minute. `vole ssh-exec` is the forced command, and `vole ssh-shell` is the account's login shell. sshd runs a forced command *through* the login shell with `-c`, so a shell that refuses everything would break every command it fronts: this one recognises the single line ssh-authorized-keys printed, execs it directly, and refuses anything else, including an interactive session. Generating that line therefore refuses a config path containing whitespace rather than quoting it into shell syntax. The wire between them is `internal/sshwire`: one hello, one accept or refusal, then length-prefixed stdin, stdout, stderr and exit frames over the Unix socket, so the streams stay separate and backpressure is a blocked writer rather than a buffer. `ssh_socket` is where that socket lives; it is absolute-only because sshd's working directory is not the instance's. The socket listener, the token sweeper, and the configuration that enables the mode are #305. Until then nothing here runs unless sshd is wired to it.
forge/config/config.go +13
| @@ -44,6 +44,12 @@ type Config struct { | |||
| 44 | 44 | // SSH handshake, so a client that opens a socket and says nothing cannot hold a | |
| 45 | 45 | // connection slot indefinitely. Zero means 20. | |
| 46 | 46 | SSHHandshakeTimeoutSeconds int `toml:"ssh_handshake_timeout_seconds"` | |
| 47 | // SSHSocket is the Unix socket `vole serve` listens on for the front door's | ||
| 48 | // forced command, and the address `vole ssh-exec` connects to. It sits outside | ||
| 49 | // data_dir on purpose: the `git` account must reach the socket without | ||
| 50 | // reaching the repositories, the roster, or the host key. It is unused unless | ||
| 51 | // the operator has enabled the front door by wiring sshd to it. | ||
| 52 | SSHSocket string `toml:"ssh_socket"` | ||
| 47 | 53 | // MaxBlobBytes rejects individual objects in pre-receive. | |
| 48 | 54 | MaxBlobBytes int64 `toml:"max_blob_bytes"` | |
| 49 | 55 | // GitHTTP enables the anonymous smart-HTTP read transport: clone, fetch and | |
| @@ -174,6 +180,7 @@ func defaults() *Config { | |||
| 174 | 180 | SSHMaxConnections: 64, | |
| 175 | 181 | SSHMaxGitProcesses: 16, | |
| 176 | 182 | SSHHandshakeTimeoutSeconds: 20, | |
| 183 | SSHSocket: "/run/vole/ssh.sock", | ||
| 177 | 184 | MaxBlobBytes: 100 << 20, // 100 MiB per blob | |
| 178 | 185 | ReceiveMaxBytes: 1 << 30, // 1 GiB per push | |
| 179 | 186 | ||
| @@ -379,6 +386,12 @@ http_addr = "127.0.0.1:8080" | |||
| 379 | 386 | # The only write githttp. Identity is the SSH key presented at handshake. | |
| 380 | 387 | ssh_addr = "127.0.0.1:2222" | |
| 381 | 388 | ||
| 389 | # Where the front door's forced command reaches the service when the system sshd | ||
| 390 | # is doing the authentication. It belongs outside data_dir: the account sshd runs | ||
| 391 | # must reach the socket without reaching the repositories, the roster, or the | ||
| 392 | # host key. | ||
| 393 | # ssh_socket = "/run/vole/ssh.sock" | ||
| 394 | |||
| 382 | 395 | # Where a browser reads this instance. Set it to the canonical https URL to | |
| 383 | 396 | # enable passkey login; WebAuthn is bound to this origin. The CLI also uses it to | |
| 384 | 397 | # print the page for something it just created. Trailing slash is ignored. | |