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.

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/codebrowser.go +5−2

@@ -433,14 +433,17 @@ func (w *Web) siteURL(r *http.Request, name string) string {
433 433 // because that is the port the listener answers on. Without a public_url there
434 434 // is no configured name, so the listener's own address is all there is.
435 435 func (w *Web) sshURL(name string) string {
436 host, port := "", ""
436 host, port, user := "", "", "git"
437 437 if w.Cfg != nil {
438 438 host, port = splitSSHAddr(w.Cfg.SSHAddr)
439 if w.Cfg.SSHUser != "" {
440 user = w.Cfg.SSHUser
441 }
439 442 if u, err := config.ParsePublicURL(w.Cfg.PublicURL); err == nil && u != nil {
440 443 host = u.Hostname()
441 444 }
442 445 }
443 return fmt.Sprintf("ssh://git@%s/%s.git", netJoin(host, port), name)
446 return fmt.Sprintf("ssh://%s@%s/%s.git", user, netJoin(host, port), name)
444 447 }
445 448
446 449 // splitSSHAddr separates a listen address into the host and the port, tolerating