Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Validate the configuration and harden what a deployment creates

ed1812123cd9e9df0f34fdaf0d2511a340c2aaa6 · Keenan Nemetz · 13d ago · parent 13cff33f

Validate the configuration and harden what a deployment creates

Two ways an instance used to run in a state it should have refused.

The configuration was never checked. `dev_login` was guarded only by a loopback
listener, so a proxy that rewrites Host to 127.0.0.1 inherited a credential-free
session; open registration could be enabled on a plain-HTTP origin WebAuthn would
never accept; a public_url could carry a path or credentials; a size could be
negative. Config.Validate now runs before anything is opened and reports every
problem at once, and dev_login requires an explicit dev_only opt-in next to a
loopback listener with no public address. The per-request check no longer trusts
Host at all: it must name the configured listener, and a request carrying a
forwarding header gets no session.

The files were never checked either. directories were created 0755 and the audit
log 0644, and a file keeps the mode it was created with, so an upgraded instance
stayed exposed. internal/secure creates secrets at 0600 in directories at 0700,
tightens what an existing install left, keeps group access for a shared backup
group, and refuses to start when a mode cannot be changed. Every audit writer and
the account backup go through it. The service unit drops all capabilities,
sets UMask=0027, disables core dumps, hides other processes and devices, and
restricts address families; docs/operations.md now states the production
baseline.

docs/packaging.md +19−2

@@ -30,11 +30,28 @@ package's.
30 30 The shipped config listens on `0.0.0.0:2222` for SSH and `127.0.0.1:8080` for the
31 31 web. Open 2222 in the firewall, set `public_url` before anyone signs in with a
32 32 passkey, and either terminate TLS in a proxy in front of 8080 or use `https_addr`
33 to let Vole obtain certificates itself. For ports 80 and 443, add
34 `AmbientCapabilities=CAP_NET_BIND_SERVICE` to the unit. See
33 to let Vole obtain certificates itself. See
35 34 [Configuration § Automatic HTTPS with ACME](configuration.md#automatic-https-with-acme)
36 35 and [Configuration § Running behind a proxy](configuration.md#running-behind-a-proxy).
37 36
37 The unit is written for the packaged layout and is safe to use as shipped: it
38 drops all capabilities, sets `UMask=0027`, gives the service a private `/tmp` and
39 device tree, hides other processes, and makes `/var/lib/vole` the only writable
40 path. If you need to bind a port below 1024 — SSH on 2222 does not, HTTP on 80 and
41 HTTPS on 443 do — add the one capability with a drop-in, which must widen the
42 bounding set as well:
43
44 ```ini
45 # /etc/systemd/system/vole.service.d/bind.conf
46 [Service]
47 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
48 AmbientCapabilities=CAP_NET_BIND_SERVICE
49 ```
50
51 `MemoryDenyWriteExecute=true` is safe for the forge because it runs no JIT. A CI
52 runner executes repository code in containers and is a separate process with its
53 own unit; do not relax this unit to accommodate it.
54
38 55 ## First steps after install
39 56
40 57 ```sh