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.

Give a hand-run instance the file modes and socket directory Linux packaging provides

8f24ae1f8c7873da346344c2686b02aac6df781b · Keenan Nemetz · 12d ago · parent a4a6d1e9

Give a hand-run instance the file modes and socket directory Linux packaging provides

Three things a Vole forge gets from its Linux package are missing when it runs
on macOS, and all three are silent.

The systemd unit sets UMask=0027. launchd has no equivalent, so SQLite, git, the
CI spool, and the ACME client would create group- and world-readable files. The
data directory is 0700, so it is contained, but the defence is the unit's today.
internal/secure.Restrict sets the umask in the long-running commands instead: a
packaged Linux install already has it, and setting it where the unit did is
harmless.

The front-door socket lives in /run/vole, which exists because tmpfiles.d and the
post-install script create it. A hand-run instance has nothing to do that, so
`ssh_listen = "socket"` failed with ENOENT before any clone could try. The
listener now creates the directory (0750) when it is missing and warns that the
sshd account still needs access to it. An existing directory is untouched: its
group and setgid bit are the installer's decision.

macOS puts /var behind a symlink to /private/var, so the same config file reached
two ways compared unequal and `vole admin init` printed a --config hint it did
not need. The comparison resolves symlinks on the directory, which also works for
a file that does not exist yet.

Closes: 01M7ZVF0E8YXKD6A8TNX1MW8B3

internal/secure/umask_unix.go +19

@@ -0,0 +1,19 @@
1 //go:build unix
2
3 package secure
4
5 import "syscall"
6
7 // Restrict sets the process umask so everything this process creates is at most
8 // group-readable: the service account writes, its group reads, everybody else
9 // gets nothing.
10 //
11 // Vole creates its own secrets at FileMode regardless. The umask is what covers
12 // the files other programs create on its behalf — SQLite's databases, git's
13 // objects and logs, the CI spool, and the ACME client's cache. A packaged Linux
14 // install gets it from the systemd unit; launchd has no equivalent, so the
15 // long-running commands set it themselves. Setting it where the unit already did
16 // is harmless: a umask belongs to the process, not to the unit.
17 func Restrict() {
18 syscall.Umask(0o027)
19 }