Files
jcoffey-dev 84d04513fd Relay: the installed relay binary is never run as root
The relay binary and its directory belong to the relay's user, so an
upgrade sent from the console can replace it in place. relay install
(dry runs too) and relay status nevertheless ran that binary as root
to ask its version. Code running as the relay user, for example after
a compromise of the internet-facing relay, could replace the binary
and have it run as root, outside the relay's sandbox, the next time
an administrator checked on it.

The version is now asked as the relay user, through runuser, as join,
status and reset already were. Everything the installer runs of the
installed binary also runs in a session of its own, so it no longer
has root's terminal as its controlling one and can't push input into
it. The freshly downloaded, checked binary is still tried as root,
from root's own temporary directory, before it is put in place.

Test: TestInstalledVersionDoesNotRunTheBinaryItself failed before (the
stand-in binary ran as the test's own user) and now passes;
TestTheInstalledBinaryRunsAsTheRelayUser is new.
2026-11-17 15:00:44 -07:00
..