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.
docs/cli.md +52
| @@ -640,6 +640,8 @@ See [Workflows](workflows.md), [Workflow reference](reference/workflow-reference | |||
| 640 | 640 | ||
| 641 | 641 | ## Internal | |
| 642 | 642 | ||
| 643 | ### hook | ||
| 644 | |||
| 643 | 645 | ```sh | |
| 644 | 646 | vole hook pre-receive|post-receive | |
| 645 | 647 | ``` | |
| @@ -647,6 +649,56 @@ vole hook pre-receive|post-receive | |||
| 647 | 649 | Installed in each repository's hooks directory and run by git, not by hand. | |
| 648 | 650 | Anything the pre-receive hook cannot verify is a rejected push. | |
| 649 | 651 | ||
| 652 | ### ssh-authorized-keys | ||
| 653 | |||
| 654 | ```sh | ||
| 655 | vole ssh-authorized-keys --fingerprint <sha256> --type <type> --key <base64> --connection <endpoints> | ||
| 656 | ``` | ||
| 657 | |||
| 658 | Run by the system sshd, not by hand. On an active key it prints the client's | ||
| 659 | key back with `restrict,command=` and a token that is good for one session; | ||
| 660 | on an unknown key, a retired account, or an expired run credential it prints | ||
| 661 | nothing, so sshd refuses before any Vole process runs. | ||
| 662 | |||
| 663 | The token is bound to the connection endpoint sshd reports, because the forced | ||
| 664 | command's arguments are readable by other local users. | ||
| 665 | |||
| 666 | | Option | Used by | Meaning | | ||
| 667 | |---|---|---| | ||
| 668 | | `-c, --config <path>` | — | the vole.toml to read; default is ./vole.toml, then ~/.vole/vole.toml | | ||
| 669 | | `--fingerprint <sha256>` | — | the key's fingerprint, from sshd's %f | | ||
| 670 | | `--type <type>` | — | the key's type, from sshd's %t | | ||
| 671 | | `--key <base64>` | — | the key itself, from sshd's %k | | ||
| 672 | | `--connection <endpoints>` | — | the connection endpoints, from sshd's %C | | ||
| 673 | |||
| 674 | ### ssh-exec | ||
| 675 | |||
| 676 | ```sh | ||
| 677 | vole ssh-exec --session <token> | ||
| 678 | ``` | ||
| 679 | |||
| 680 | Run as the `git` account by the forced command an authorized_keys line names. | ||
| 681 | It reads SSH_ORIGINAL_COMMAND and SSH_CONNECTION, sends one request over the | ||
| 682 | `ssh_socket`, copies the streams, and exits with the session's status. It has | ||
| 683 | no access to the repositories, the roster, or the host key; vole serve is | ||
| 684 | still the only process that serves a command. | ||
| 685 | |||
| 686 | | Option | Used by | Meaning | | ||
| 687 | |---|---|---| | ||
| 688 | | `-c, --config <path>` | — | the vole.toml to read; default is ./vole.toml, then ~/.vole/vole.toml | | ||
| 689 | | `--session <token>` | — | the single-use token from ssh-authorized-keys | | ||
| 690 | |||
| 691 | ### ssh-shell | ||
| 692 | |||
| 693 | ```sh | ||
| 694 | vole ssh-shell | ||
| 695 | ``` | ||
| 696 | |||
| 697 | Installed as the `git` account's shell because sshd runs a forced command | ||
| 698 | through the login shell with `-c`. It recognises the single command | ||
| 699 | ssh-authorized-keys printed, `vole ssh-exec ...`, and execs it directly; | ||
| 700 | anything else, including an interactive session with no command, is refused. | ||
| 701 | |||
| 650 | 702 | ## Help and version | |
| 651 | 703 | ||
| 652 | 704 | ### help | |