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.
Serve the front door from vole serve
c5f2c5d49be1d35a0a54fd70029ac9311647194e · Keenan Nemetz · 16d ago · parent e075258f
Serve the front door from vole serve The forced command had nothing to talk to. This gives `vole serve` the local listener, the token it consumes, and the host key a lease now carries. `ssh_listen` decides what serves SSH and is the only switch: "tcp" is the built-in listener on `ssh_addr` (the default, and unchanged), "socket" is the system sshd in front, "none" serves nothing. The socket path stays in `ssh_socket`, which #304 already added, so no value lives in two places. In socket mode `ssh_addr` only names the host and port clone URLs carry, which validation now enforces by refusing another port: the point of the mode is a clone URL with no port, and a leftover 2222 would silently break every link. The local listener speaks the framed protocol from `internal/sshwire` and turns it back into the Session the built-in listener produces, so `handleLocal` calls the same `exec` with the account and key from the token row and the same ACL, credential-scoping, and refusal code runs. A test proves it: every kind of handler — whoami, roster, both git pack services, the admin API, the run queue, release channels, a refused verb, and a job credential that may do less than its account — is driven over both transports and compared byte for byte, status included. A front-door instance has no signer, so `New` no longer creates a private host key it would never present: it reads sshd's public key from `ssh_public_host_key_file` into the same field a lease carries. A missing or unreadable file fails startup rather than handing a job a key that cannot verify its host, and `Serve` refuses outright when there is no host key. The transport's own details: a write larger than a frame is split rather than refused, stdout and stderr share one socket under one lock, expired tokens are swept every thirty seconds and once at startup so a mode switch leaves nothing behind, and the socket is created 0660 with a stale file replaced only after checking that nothing answers on it. `ssh_user` replaces the hardcoded `git` in generated clone URLs, which is what lets a host with another forge's `git` account keep both. Packaging and the sshd drop-in are #306; the documentation and migration are #307.
server/web/transport_test.go +9−5
| @@ -22,18 +22,22 @@ func TestSSHURLUsesTheConfiguredHost(t *testing.T) { | |||
| 22 | 22 | name string | |
| 23 | 23 | addr string | |
| 24 | 24 | public string | |
| 25 | user string | ||
| 25 | 26 | wantPrefix string | |
| 26 | 27 | }{ | |
| 27 | {"wildcard bind, configured name", "0.0.0.0:2222", "https://rodent.software", "ssh://git@rodent.software:2222/"}, | ||
| 28 | {"default port is not written", "0.0.0.0:22", "https://forge.example.com", "ssh://git@forge.example.com/"}, | ||
| 29 | {"no public_url falls back to the listener", "127.0.0.1:2222", "", "ssh://git@127.0.0.1:2222/"}, | ||
| 30 | {"ipv6 listener keeps its brackets", "[::1]:2222", "", "ssh://git@[::1]:2222/"}, | ||
| 28 | {"wildcard bind, configured name", "0.0.0.0:2222", "https://rodent.software", "", "ssh://git@rodent.software:2222/"}, | ||
| 29 | {"default port is not written", "0.0.0.0:22", "https://forge.example.com", "", "ssh://git@forge.example.com/"}, | ||
| 30 | {"no public_url falls back to the listener", "127.0.0.1:2222", "", "", "ssh://git@127.0.0.1:2222/"}, | ||
| 31 | {"ipv6 listener keeps its brackets", "[::1]:2222", "", "", "ssh://git@[::1]:2222/"}, | ||
| 32 | // A host that already has a `git` account for another forge names its own, | ||
| 33 | // and the link has to say so or every clone fails to log in. | ||
| 34 | {"a configured account name", "0.0.0.0:22", "https://forge.example.com", "vole-git", "ssh://vole-git@forge.example.com/"}, | ||
| 31 | 35 | } | |
| 32 | 36 | for _, c := range cases { | |
| 33 | 37 | c := c | |
| 34 | 38 | t.Run(c.name, func(t *testing.T) { | |
| 35 | 39 | t.Parallel() | |
| 36 | w := &Web{Cfg: &config.Config{SSHAddr: c.addr, PublicURL: c.public}} | ||
| 40 | w := &Web{Cfg: &config.Config{SSHAddr: c.addr, PublicURL: c.public, SSHUser: c.user}} | ||
| 37 | 41 | if got, want := w.sshURL("demo"), c.wantPrefix+"demo.git"; got != want { | |
| 38 | 42 | t.Fatalf("sshURL = %q, want %q", got, want) | |
| 39 | 43 | } | |