--- # CIS 3.x (Netzwerk) / 1.5.x (Kernel-Haertung). Bewusst ueber # ansible.builtin.copy + "sysctl --system" statt des ansible.posix.sysctl- # Moduls (siehe Kommentar in Kap. 7/README) -- keine Zusatz-Collection als # Voraussetzung fuer den Betrieb dieses Playbooks. - name: Kernel-/Netzwerk-Haertung (sysctl) ansible.builtin.copy: dest: /etc/sysctl.d/99-jumphost-hardening.conf owner: root group: root mode: "0644" content: | # --- Netzwerk (CIS 3.x) --- net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.log_martians = 1 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.icmp_ignore_bogus_error_responses = 1 net.ipv4.tcp_syncookies = 1 net.ipv4.ip_forward = 0 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.default.accept_source_route = 0 {% if os_hardening_disable_ipv6 %} net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 {% endif %} # --- Kernel-Haertung (CIS 1.5.x) --- kernel.kptr_restrict = 2 kernel.dmesg_restrict = 1 kernel.randomize_va_space = 2 kernel.yama.ptrace_scope = 1 fs.suid_dumpable = 0 fs.protected_hardlinks = 1 fs.protected_symlinks = 1 fs.protected_fifos = 2 fs.protected_regular = 2 notify: apply sysctl - name: Core Dumps zusaetzlich auf PAM-Ebene deaktivieren (CIS 1.5.1) ansible.builtin.copy: dest: /etc/security/limits.d/99-jumphost-no-coredumps.conf owner: root group: root mode: "0644" content: | * hard core 0