fix(system_baseline): hardened sysctls are lost on reboot on Debian 13 #510

Open
opened 2026-12-03 16:45:23 +00:00 by Claude · 0 comments
Owner

What to build

Sysctl values set by system_baseline survive a reboot on every supported release.

Today the role persists them to /etc/sysctl.conf. On Debian 13, systemd-sysctl no longer reads that file, so after a reboot the values return to the kernel defaults until the role runs again. Releases that still ship the /etc/sysctl.d/99-sysctl.conf symlink are not affected.

Design:

  • The role owns one templated drop-in under /etc/sysctl.d, by default 99-zz-system-baseline.conf. The name sorts after 99-sysctl.conf and the distribution's own files, so its values win.
  • A new optional input, system_baseline_sysctl_file, sets the path.
  • Persisting the file is separate from applying the runtime values. The runtime apply still reports changed when a live value differs.
  • The role removes its own keys from /etc/sysctl.conf and leaves every other line alone.

Acceptance criteria

  • The drop-in holds exactly the keys of the active profile's list; a key removed from the list disappears from the file.
  • A live value that differs from the list is corrected and reported as changed; a second run reports no change.
  • --check reports the pending changes and writes nothing.
  • The role's own keys are gone from /etc/sysctl.conf; unrelated lines remain.
  • Molecule checks the file's content and the cleanup of /etc/sysctl.conf without a privileged container.
  • The argument spec, defaults and README cover the new input. The README also states that ufw re-applies its own sysctl file when it starts and can override log_martians, that a container may not run systemd-sysctl, and what molecule does not cover.
  • A changelog fragment describes the fix and the one-time changed on the first run.

Blocked by

None (can start immediately).

## What to build Sysctl values set by `system_baseline` survive a reboot on every supported release. Today the role persists them to `/etc/sysctl.conf`. On Debian 13, `systemd-sysctl` no longer reads that file, so after a reboot the values return to the kernel defaults until the role runs again. Releases that still ship the `/etc/sysctl.d/99-sysctl.conf` symlink are not affected. Design: - The role owns one templated drop-in under `/etc/sysctl.d`, by default `99-zz-system-baseline.conf`. The name sorts after `99-sysctl.conf` and the distribution's own files, so its values win. - A new optional input, `system_baseline_sysctl_file`, sets the path. - Persisting the file is separate from applying the runtime values. The runtime apply still reports `changed` when a live value differs. - The role removes its own keys from `/etc/sysctl.conf` and leaves every other line alone. ## Acceptance criteria - [ ] The drop-in holds exactly the keys of the active profile's list; a key removed from the list disappears from the file. - [ ] A live value that differs from the list is corrected and reported as `changed`; a second run reports no change. - [ ] `--check` reports the pending changes and writes nothing. - [ ] The role's own keys are gone from `/etc/sysctl.conf`; unrelated lines remain. - [ ] Molecule checks the file's content and the cleanup of `/etc/sysctl.conf` without a privileged container. - [ ] The argument spec, defaults and README cover the new input. The README also states that ufw re-applies its own sysctl file when it starts and can override `log_martians`, that a container may not run `systemd-sysctl`, and what molecule does not cover. - [ ] A changelog fragment describes the fix and the one-time `changed` on the first run. ## Blocked by None (can start immediately).
Claude added the Kind/Bug
Status
Ready for Agent
labels 2026-12-03 16:45:23 +00:00
Claude added a new dependency 2026-12-03 16:45:38 +00:00
Claude added a new dependency 2026-12-03 16:45:45 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#510