Compare commits
5 Commits
a76f317f8f
...
0f8faf0a22
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f8faf0a22 | |||
| b520126253 | |||
| a4ca4c4ff4 | |||
| d9efb54bec | |||
| e7a0cc4f62 |
@@ -1,4 +1,5 @@
|
|||||||
skip_list:
|
skip_list:
|
||||||
- run-once
|
- run-once
|
||||||
|
- var-naming[no-role-prefix] # user-facing API dicts (cis, system, hypervisor) are intentionally not role-prefixed
|
||||||
exclude_paths:
|
exclude_paths:
|
||||||
- roles/global_defaults/
|
- roles/global_defaults/
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ cis_defaults:
|
|||||||
cis_fusermount_binary: "{{ 'fusermount3' if is_rhel | default(false) | bool else 'fusermount' }}"
|
cis_fusermount_binary: "{{ 'fusermount3' if is_rhel | default(false) | bool else 'fusermount' }}"
|
||||||
cis_write_binary: "{{ 'write' if is_rhel | default(false) | bool else 'wall' }}"
|
cis_write_binary: "{{ 'write' if is_rhel | default(false) | bool else 'wall' }}"
|
||||||
|
|
||||||
|
cis: {}
|
||||||
|
|
||||||
cis_permission_targets:
|
cis_permission_targets:
|
||||||
- { path: "/mnt/etc/ssh/sshd_config", mode: "0600" }
|
- { path: "/mnt/etc/ssh/sshd_config", mode: "0600" }
|
||||||
- { path: "/mnt/etc/cron.hourly", mode: "0700" }
|
- { path: "/mnt/etc/cron.hourly", mode: "0700" }
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
---
|
---
|
||||||
- name: Build cis_cfg from defaults and user overrides
|
- name: Normalize CIS input
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
cis_cfg: "{{ cis_defaults | combine(cis | default({}), recursive=true) }}"
|
cis_enabled: "{{ cis is defined and (cis is mapping or cis | bool) }}"
|
||||||
|
cis_input: "{{ cis if cis is mapping else {} }}"
|
||||||
|
|
||||||
|
- name: Normalize CIS configuration
|
||||||
|
when: cis_enabled and cis_cfg is not defined
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
cis_cfg: "{{ cis_defaults | combine(cis_input, recursive=True) }}"
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
---
|
---
|
||||||
- name: Normalize CIS configuration
|
- name: Normalize CIS configuration
|
||||||
ansible.builtin.include_tasks: _normalize.yml
|
ansible.builtin.import_tasks: _normalize.yml
|
||||||
|
|
||||||
|
- name: Apply CIS hardening
|
||||||
|
when: cis_enabled
|
||||||
|
block:
|
||||||
- name: Include CIS hardening tasks
|
- name: Include CIS hardening tasks
|
||||||
ansible.builtin.include_tasks: "{{ cis_task }}"
|
ansible.builtin.include_tasks: "{{ cis_task }}"
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
configuration_luks_tpm2_device: "{{ system_cfg.luks.tpm2.device }}"
|
configuration_luks_tpm2_device: "{{ system_cfg.luks.tpm2.device }}"
|
||||||
configuration_luks_tpm2_pcrs: "{{ luks_tpm2_pcrs }}"
|
configuration_luks_tpm2_pcrs: "{{ luks_tpm2_pcrs }}"
|
||||||
configuration_luks_keyfile_path: "/etc/cryptsetup-keys.d/{{ system_cfg.luks.mapper }}.key"
|
configuration_luks_keyfile_path: "/etc/cryptsetup-keys.d/{{ system_cfg.luks.mapper }}.key"
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Validate LUKS UUID is available
|
- name: Validate LUKS UUID is available
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
@@ -245,7 +244,6 @@
|
|||||||
}}
|
}}
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
configuration_kernel_cmdline_new: "{{ kernel_cmdline_new }}"
|
configuration_kernel_cmdline_new: "{{ kernel_cmdline_new }}"
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Write kernel cmdline with LUKS args
|
- name: Write kernel cmdline with LUKS args
|
||||||
when: is_rhel | bool
|
when: is_rhel | bool
|
||||||
|
|||||||
@@ -62,7 +62,6 @@
|
|||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
configuration_grub_cmdline_linux_base: "{{ grub_cmdline_linux_base }}"
|
configuration_grub_cmdline_linux_base: "{{ grub_cmdline_linux_base }}"
|
||||||
configuration_kernel_cmdline_base: "{{ grub_kernel_cmdline_base }}"
|
configuration_kernel_cmdline_base: "{{ grub_kernel_cmdline_base }}"
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Check if grub defaults file exists
|
- name: Check if grub defaults file exists
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ system_defaults:
|
|||||||
type: "virtual" # virtual|physical
|
type: "virtual" # virtual|physical
|
||||||
os: ""
|
os: ""
|
||||||
version: ""
|
version: ""
|
||||||
filesystem: ""
|
filesystem: "ext4"
|
||||||
name: ""
|
name: ""
|
||||||
id: ""
|
id: ""
|
||||||
cpus: 0
|
cpus: 0
|
||||||
|
|||||||
@@ -333,15 +333,11 @@
|
|||||||
- name: Validate disk mount definitions
|
- name: Validate disk mount definitions
|
||||||
when: system_cfg.disks is defined
|
when: system_cfg.disks is defined
|
||||||
vars:
|
vars:
|
||||||
reserved_mounts:
|
reserved_mounts: >-
|
||||||
- /boot
|
{{
|
||||||
- /boot/efi
|
['/boot', '/boot/efi', '/home', '/var', '/var/log', '/var/log/audit']
|
||||||
- /home
|
+ (['/var/cache/pacman/pkg'] if os == 'archlinux' else [])
|
||||||
- /swap
|
}}
|
||||||
- /var
|
|
||||||
- /var/cache/pacman/pkg
|
|
||||||
- /var/log
|
|
||||||
- /var/log/audit
|
|
||||||
disk_mount: "{{ (item.mount.path | default('') | string) | trim }}"
|
disk_mount: "{{ (item.mount.path | default('') | string) | trim }}"
|
||||||
disk_fstype: "{{ (item.mount.fstype | default('') | string) | trim }}"
|
disk_fstype: "{{ (item.mount.fstype | default('') | string) | trim }}"
|
||||||
disk_device: "{{ (item.device | default('') | string) | trim }}"
|
disk_device: "{{ (item.device | default('') | string) | trim }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user