#36571 contrib/init: add systemd hardening directives

ReviewabilityReviewsAgreementSize
#36571 jpk68 contrib/init: add systemd hardening directivesReady0Strong0 + 49 tests
  • Improve defense-in-depth isolation for Linux systems running the contrib systemd service file
  • Restrict daemon access to kernel tunables, clock settings, namespaces, and unnecessary syscalls
  • Ready for review
  • No review verdicts recorded
  • Substantive support with no open objections (Hamza1610)
  • Verified with systemd security analysis, improving exposure score from 7.7 to 1.6 (Hamza1610)
  • 0 lines added or modified outside tests
  • 49 lines added or modified in tests
  • 1 lines removed in total
  • 1 files, 1 commits
Tools and scripts#14 of 16
P3 · new feature
  • P3 because it hardens the daemon attack surface for Linux systemd deployments
  • Defense-in-depth benefit is confined to an optional contrib example service file
  • Can be deferred without affecting core node functionality
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Adds several systemd sandboxing directives to contrib/init/bitcoind.service, including kernel tunables/logs/modules protection, clock and hostname restrictions, proc visibility controls, namespace restrictions, and an empty capability bounding set. It also restricts socket address families to AF_INET, AF_INET6, AF_UNIX, and AF_NETLINK, applies system call filtering, and updates the ExecStartPre chgrp prefix modifier from ! to + so pre-exec operations retain required privileges under the new capability limits.

Problem: Linux systems deploying bitcoind using the contrib systemd service file lack defense-in-depth isolation, granting the daemon access to kernel tunables, clock settings, unneeded namespaces, and unconstrained syscalls that are unnecessary for normal operation.

Evidence of importance:

  • PR description: 'Adds sandboxing options that `bitcoind` doesn't need to be exempt from... Also switches the `ExecStartPre` `chgrp` from "!" to "+", since "!" only lifts `User=`/`Group=`, and the new syscall filter and capability bounding set would block it otherwise.'

Risk of a mistake: low (other). Modifies only an optional example systemd service file in contrib; an overly restrictive directive could cause bitcoind startup or socket communication to fail on systems using that unit.

Reviewability

Ready

Nothing known that would invalidate a review now.

Waiting on (from the thread read):

  • nothing

Agreement

Strong

substantive support, no open objection (Hamza1610)

Thread notes: Record initialized with a Tested ACK from Hamza1610 testing systemd security analysis score improvements. / Initial record. Hamza1610 provided a substantive Tested ACK based on systemd security analysis.

Objections, suggestions, and questions: none recorded.

Support:

  • Hamza1610 (none) (Tested ACK, 2026-10-21) [both: contrib/init/bitcoind.service]: increases the security of bitcoind, improving systemd security analysis score from 7.7 to 1.6

Participants:

  • Hamza1610 (none, support, 1 statements 2026-10-21 to 2026-10-21): Tested ACK, verified security improvement with systemd-analyze

Files

50 lines under test/bench/ci.

  • contrib/init/bitcoind.service +49/-1

Card

The short text the ranking pass compares across PRs.

Adds systemd hardening and sandboxing directives to the example bitcoind service unit in contrib/init, including syscall filters, namespace restrictions, an empty capability set, and socket address family limits. Deployments relying on the provided unit currently run without defense-in-depth process sandboxing, leaving unnecessary system interfaces accessible if the daemon process is compromised. The PR also changes the ExecStartPre prefix so permission adjustments on the config directory succeed under the new restrictions.

Data

dossier JSON · extract JSON · model ledger, generated 2026-10-22T01:16, confidence high, input hash aaae7117f3d10331
thread read through 2026-10-21 (1 statements), head ad2600eb3e
labels: none

Categories

Tools and scripts

P3 · new feature

Adds systemd sandboxing directives to reduce daemon attack surface for Linux systemd deployments. While it improves defense-in-depth isolation, it is an optional contrib deployment hardening configuration that can be deferred without affecting core functionality.

Membership: Modifies contrib/init/bitcoind.service, which is an operator deployment configuration script maintained in contrib.

Factors: security/stability 1, bug 0, performance 0, user value 1, leverage 0