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

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
This commit is contained in:
Defame1297 committed 2026-12-03 17:23:51 +00:00
1 parent cf99893855
commit d88e5d237a
14 files changed
+282 -17

No files matched your search

+12
View File
@@ -62,6 +62,18 @@
quiet: true
tags: always
# The role owns the whole file, and systemd-sysctl reads only *.conf. 99-sysctl.conf can be the distribution's link to /etc/sysctl.conf.
- name: Validate the sysctl drop-in path
ansible.builtin.assert:
that:
- system_baseline_sysctl_file is match('^/etc/sysctl\.d/[A-Za-z0-9_][A-Za-z0-9._-]*\.conf\Z')
- system_baseline_sysctl_file != '/etc/sysctl.d/99-sysctl.conf'
fail_msg: >-
system_baseline_sysctl_file must be a .conf file directly under /etc/sysctl.d (letters, digits, . _ and - in the name), other than
99-sysctl.conf.
quiet: true
tags: always
# The value is written into a unit file: one line, starting with a digit, so no line break can add a second directive. systemd itself
# refuses a value it cannot parse (it ignores the setting and logs it).
- name: Validate the apt-daily start timeout