fix(system_baseline): persist sysctls in an own sysctl.d drop-in #513

Open
Claude wants to merge 1 commits from fix/510-sysctl-dropin into main
pull from: fix/510-sysctl-dropin
Owner

What and why

systemd-sysctl on Debian 13 does not read /etc/sysctl.conf, where system_baseline kept its values, so the hardened sysctls were lost on reboot.

  • The role now writes them to its own drop-in, /etc/sysctl.d/99-zz-system-baseline.conf. The new optional input system_baseline_sysctl_file changes the path.
  • It applies the live values in a separate step, which reports changed only when a live value differs.
  • It removes its own keys from /etc/sysctl.conf and leaves the other lines alone.

The first run after the upgrade reports changed once on every host.

Closes #510

Verified

  • The pre-commit hooks passed on the commit.
  • Local runs of the task files against temporary files and a fake sysctl: check mode, a second run without changes, duplicate keys, a refused write, a missing /etc/sysctl.conf.
  • Molecule: see the CI run of this pull request.

Not verified

  • A successful write of a live value by the real sysctl: the molecule containers have a read-only /proc/sys.
  • A reboot that loads the drop-in.
  • The role on Debian 13.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code:claude-opus-5-5

## What and why `systemd-sysctl` on Debian 13 does not read `/etc/sysctl.conf`, where `system_baseline` kept its values, so the hardened sysctls were lost on reboot. - The role now writes them to its own drop-in, `/etc/sysctl.d/99-zz-system-baseline.conf`. The new optional input `system_baseline_sysctl_file` changes the path. - It applies the live values in a separate step, which reports `changed` only when a live value differs. - It removes its own keys from `/etc/sysctl.conf` and leaves the other lines alone. The first run after the upgrade reports `changed` once on every host. Closes #510 ## Verified - The pre-commit hooks passed on the commit. - Local runs of the task files against temporary files and a fake `sysctl`: check mode, a second run without changes, duplicate keys, a refused write, a missing `/etc/sysctl.conf`. - Molecule: see the CI run of this pull request. ## Not verified - A successful write of a live value by the real `sysctl`: the molecule containers have a read-only `/proc/sys`. - A reboot that loads the drop-in. - The role on Debian 13. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code:claude-opus-5-5
Claude added 1 commit 2026-12-03 17:24:41 +00:00
fix(system_baseline): persist sysctls in an own sysctl.d drop-in
Build / build (pull_request) Successful in 1m5s
Lint / lint (pull_request) Successful in 4m54s
Molecule / select (pull_request) Successful in 3s
Molecule / scenarios (pull_request) Successful in 18m54s
Molecule / Result (pull_request) Successful in 0s
d88e5d237a
systemd-sysctl on Debian 13 does not read /etc/sysctl.conf, so the
hardened values were lost on reboot. The role now applies the live values
on their own, writes them to a drop-in under /etc/sysctl.d and removes its
keys from /etc/sysctl.conf.

Refs #510

Assisted-by: Claude Code:claude-opus-5-5
All checks were successful
Build / build (pull_request) Successful in 1m5s
Required
Details
Lint / lint (pull_request) Successful in 4m54s
Required
Details
Molecule / select (pull_request) Successful in 3s
Molecule / scenarios (pull_request) Successful in 18m54s
Molecule / Result (pull_request) Successful in 0s
Required
Details
This pull request is blocked because it's outdated.
You are not authorized to merge this pull request.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/510-sysctl-dropin:fix/510-sysctl-dropin
git checkout fix/510-sysctl-dropin
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#513