radicle-heartwood-lfs/crates/radicle-node/src
Lorenz Leutgeb ac572e64e5 node: Support systemd credential for passphrase
While it is possible to pass the passphrase via the environment, e.g.
`EnvironmentFile=<path to file that contains "RAD_PASSPHRASE=…">`
this is less secure than passing it via a file, because the environment
is inherited down the process tree.

Thus, allow using a systemd credential. The ID of the credential must be

    xyz.radicle.node.passphrase

and is not user-configurable.

Passing the passphrase via file is now possible with
`LoadCredential=xyz.radicle.node.passphrase:<path to file that contains passphrase>`

This requires just a bit of plumbing in `radicle-node`.

Because this mechanism is more secure than using the environment
variable `RAD_PASSPHRASE`, it takes priority. That is, if both the
systemd credential is available, *and* the environment variable
`RAD_PASSPHRASE` is set, the former is preferred.

Heads-up:
 1. The contents of the file must be valid UTF-8 (see documentation of
    `std::fs::read_to_string`). Assuming that the passphrase is at some
    point chosen by the user and typed on a keyboard, this does not
    seem like a severe restriction.
 2. The contents of the file are not processed otherwise, i.e. line
    breaks (notably at the end of the file) are not stripped.

The related `issue/8bd040e9de05e7fc27e373ebc1649ff4ad930e7a` asked for a
very similar feature: Passing the passphrase via a file named by the
value of the of the environment variable `RAD_PASSPHRASE_FILE`.
It was also briefly discussed at
<https://radicle.zulipchat.com/#narrow/channel/369277-heartwood/topic/.60RAD_PASSPHRASE_FILE.60/with/529104447>.
2025-10-09 10:03:21 +01:00
..
runtime node: Report sync status for given namespaces 2025-10-09 07:55:11 +02:00
test node: Report sync status for given namespaces 2025-10-09 07:55:11 +02:00
tests node: Report sync status for given namespaces 2025-10-09 07:55:11 +02:00
worker storage: Rewrite temporary repositories for clones 2025-10-06 11:52:42 +02:00
control.rs node: Report sync status for given namespaces 2025-10-09 07:55:11 +02:00
fingerprint.rs node: Make location of secret key configurable 2025-09-26 13:03:57 +01:00
lib.rs node: mark modules as private 2025-10-06 18:57:30 +02:00
main.rs node: Support systemd credential for passphrase 2025-10-09 10:03:21 +01:00
runtime.rs node/systemd: Check that received sockets are AF_UNIX 2025-08-25 17:17:34 +01:00
test.rs node, protocol: Refactor 2025-07-16 21:15:52 +02:00
tests.rs Introduce a node event for canonical reference updates 2025-08-25 18:49:43 +01:00
wire.rs node: mark modules as private 2025-10-06 18:57:30 +02:00
worker.rs Replace unit-returning-closure with drop() 2025-08-19 10:57:37 +01:00