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.

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/validate.go +6

@@ -17,6 +17,7 @@ import (
17 17 "fmt"
18 18 "net"
19 19 "net/url"
20 "path/filepath"
20 21 "regexp"
21 22 "strconv"
22 23 "strings"
@@ -54,6 +55,11 @@ func (c *Config) Validate() error {
54 55 if _, _, err := splitAddr("ssh_addr", c.SSHAddr); err != nil {
55 56 add("%v", err)
56 57 }
58 // The forced command runs with sshd's working directory, which is not the
59 // instance's: a relative socket path would point somewhere nobody meant.
60 if socket := strings.TrimSpace(c.SSHSocket); socket != "" && !filepath.IsAbs(socket) {
61 add("ssh_socket must be an absolute path, got %q", socket)
62 }
57 63 if strings.TrimSpace(c.HTTPSAddr) != "" {
58 64 if _, _, err := splitAddr("https_addr", c.HTTPSAddr); err != nil {
59 65 add("%v", err)