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
30 lines
1.1 KiB
YAML
30 lines
1.1 KiB
YAML
---
|
|
# 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. procps has the sysctl
|
|
# command verify needs.
|
|
- name: Prepare
|
|
hosts: all
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Install packages the role removes and tools it assumes
|
|
ansible.builtin.apt:
|
|
name: [telnet, locales, ed, procps]
|
|
state: present
|
|
update_cache: true
|
|
|
|
- name: Make sure jq is not installed
|
|
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
|