1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00
infrastructure/roles/hardening/tasks/main.yml
Evangelos Foutras 6b5a5eeaba
hardening: reject authentication with empty passwd
SSH defaults to disallowing empty passwords but Dovecot has no similar
safeguard (at least not one enabled by default). Remove "nullok" from
/etc/pam.d/system-auth to implement the desired behavior system-wide.
2023-09-24 20:16:35 +03:00

48 lines
1.8 KiB
YAML

- name: Prevent users with empty passwords from authenticating
replace:
path: /etc/pam.d/system-auth
regexp: " nullok"
replace: ""
- name: Set restricted access to kernel logs
copy: src=50-dmesg-restrict.conf dest=/etc/sysctl.d/50-dmesg-restrict.conf owner=root group=root mode=0644
notify:
- Apply sysctl settings
- name: Set ptrace scope, restrict ptrace to CAP_SYS_PTRACE
copy: src=50-ptrace-restrict.conf dest=/etc/sysctl.d/50-ptrace-restrict.conf owner=root group=root mode=0644
when: "'buildservers' not in group_names"
notify:
- Apply sysctl settings
- name: Set restricted access to kernel pointers in proc fs
copy: src=50-kptr-restrict.conf dest=/etc/sysctl.d/50-kptr-restrict.conf owner=root group=root mode=0644
notify:
- Apply sysctl settings
- name: Enable JIT hardening for all users
copy: src=50-bpf_jit_harden.conf dest=/etc/sysctl.d/50-bpf_jit_harden.conf owner=root group=root mode=0644
notify:
- Apply sysctl settings
- name: Disable unprivileged bpf
copy: src=50-unprivileged_bpf_disabled.conf dest=/etc/sysctl.d/50-unprivileged_bpf_disabled.conf owner=root group=root mode=0644
notify:
- Apply sysctl settings
- name: Disable unprivileged userns
copy: src=50-unprivileged_userns_clone.conf dest=/etc/sysctl.d/50-unprivileged_userns_clone.conf owner=root group=root mode=0644
notify:
- Apply sysctl settings
- name: Disable kexec load
copy: src=50-kexec_load_disabled.conf dest=/etc/sysctl.d/50-kexec_load_disabled.conf owner=root group=root mode=0644
notify:
- Apply sysctl settings
- name: Set kernel lockdown to restricted
copy: src=50-lockdown.conf dest=/etc/tmpfiles.d/50-kernel-lockdown.conf owner=root group=root mode=0644
when: "'hcloud' in group_names"
notify:
- Apply sysctl settings