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

@@ -1,14 +1,15 @@
---
# A package the role must remove, and the locales tool the role assumes exists
# (it does on a stock Ubuntu host). jq (system_baseline_extra_packages) must be absent, so that the role is what installs it, and ed
# (system_baseline_extra_remove_packages, on no profile list) must be present, so that the role is what purges it.
# (system_baseline_extra_remove_packages, on no profile list) must be present, so that the role is what purges it. procps has the sysctl
# command verify needs.
- name: Prepare
hosts: all
gather_facts: false
tasks:
- name: Install a package on the role's remove list and locale-gen
- name: Install packages the role removes and tools it assumes
ansible.builtin.apt:
name: [telnet, locales, ed]
name: [telnet, locales, ed, procps]
state: present
update_cache: true
@@ -16,3 +17,13 @@
ansible.builtin.apt:
name: jq
state: absent
- name: Seed /etc/sysctl.conf with keys of the role and lines it must leave alone
ansible.builtin.copy:
dest: /etc/sysctl.conf
mode: "0644"
content: |
# net.ipv4.tcp_syncookies=1
net.ipv4.tcp_syncookies=1
vm.max_map_count = 262144
net.ipv4.conf.all.accept_redirects = 0