mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2026-03-26 14:37:13 +00:00
align with public fixes
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
f2c03f1e68
commit
2256456f0e
5 changed files with 24 additions and 14 deletions
|
|
@ -1,15 +1,5 @@
|
|||
---
|
||||
|
||||
- name: Audit_Only | Create local Directories for hosts
|
||||
when: fetch_audit_files
|
||||
ansible.builtin.file:
|
||||
mode: 'u+x,go-w'
|
||||
path: "{{ audit_capture_files_dir }}/{{ inventory_hostname }}"
|
||||
recurse: true
|
||||
state: directory
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
|
||||
- name: Audit_only | Show Audit Summary
|
||||
when: audit_only
|
||||
ansible.builtin.debug:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
success_msg: "This role is running a supported version of ansible {{ ansible_version.full }} >= {{ min_ansible_version }}"
|
||||
|
||||
- name: "Setup rules if container"
|
||||
when: ansible_connection == 'docker' or ansible_facts.virtualization_type in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
when:
|
||||
- ansible_connection == 'docker' or
|
||||
ansible_facts.virtualization_type in ["docker", "lxc", "openvz", "podman", "container"
|
||||
tags:
|
||||
- container_discovery
|
||||
- always
|
||||
|
|
|
|||
|
|
@ -31,9 +31,17 @@
|
|||
- name: "PRELIM | AUDIT | Interactive Users (reformat)"
|
||||
tags: always
|
||||
ansible.builtin.set_fact:
|
||||
prelim_interactive_usernames: "{{ prelim_interactive_users | default([]) + [dict([('username', item.split(':')[0]), ('uid', item.split(':')[1]), ('home', item.split(':')[2])])] }}"
|
||||
prelim_interactive_users: "{{ prelim_interactive_users | default([]) + [dict([('username', item.split(':')[0]), ('uid', item.split(':')[1]), ('home', item.split(':')[2])])] }}"
|
||||
loop: "{{ prelim_interactive_users_raw.stdout_lines }}"
|
||||
|
||||
- name: "PRELIM | AUDIT | Interactive User accounts home directories"
|
||||
tags: always
|
||||
ansible.builtin.shell: >
|
||||
grep -E -v '^(root|halt|sync|shutdown)' /etc/passwd | awk -F: '(!index($7, "sbin/nologin") && $7 != "/bin/nologin" && $7 != "/bin/false" && $7 != "/dev/null") { print $6 }'
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: prelim_interactive_users_home
|
||||
|
||||
- name: "PRELIM | AUDIT | Interactive UIDs"
|
||||
tags: always
|
||||
ansible.builtin.shell: >
|
||||
|
|
@ -203,7 +211,7 @@
|
|||
tags:
|
||||
- always
|
||||
block:
|
||||
- name: "PRELIM | AUDIT | Discover is wirelss adapter on system"
|
||||
- name: "PRELIM | AUDIT | Discover is wireless adapter on system"
|
||||
ansible.builtin.command: find /sys/class/net/*/ -type d -name wireless
|
||||
register: discover_wireless_adapters
|
||||
changed_when: false
|
||||
|
|
@ -246,6 +254,14 @@
|
|||
mode: 'go-rwx'
|
||||
state: touch
|
||||
|
||||
- name: "PRELIM | PATCH | sshd_config.d/50-redhat.conf exists"
|
||||
when:
|
||||
- rhel9cis_rule_5_1_10 or
|
||||
rhel9cis_rule_5_1_11
|
||||
ansible.builtin.stat:
|
||||
path: /etc/ssh/sshd_config.d/50-redhat.conf
|
||||
register: discovered_sshd_50_redhat_file
|
||||
|
||||
- name: "PRELIM | AUDIT | Capture pam security related files"
|
||||
tags: always
|
||||
ansible.builtin.find:
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@
|
|||
notify: Restart sshd
|
||||
|
||||
- name: "5.1.10 | PATCH | Ensure sshd DisableForwarding is enabled | override"
|
||||
when: discovered_sshd_50_redhat_file.stat.exists
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config.d/50-redhat.conf
|
||||
regexp: ^(?i)(#|)\s*X11Forwarding
|
||||
|
|
@ -298,6 +299,7 @@
|
|||
- NIST800-53R5_IA-5
|
||||
block:
|
||||
- name: "5.1.11 | PATCH | Ensure sshd GSSAPIAuthentication is disabled | redhat file"
|
||||
when: discovered_sshd_50_redhat_file.stat.exists
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config.d/50-redhat.conf
|
||||
regexp: ^(?i)(#|)\s*GSSAPIAuthentication
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@
|
|||
- name: "7.2.7 | AUDIT | Ensure no duplicate group names exist | Print warning about users with duplicate group names"
|
||||
when: discovered_group_check.stdout | length > 0
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! The following group names are duplicates: {{ discovered_group_group_check.stdout_lines }}"
|
||||
msg: "Warning!! The following group names are duplicates: {{ discovered_group_check.stdout_lines }}"
|
||||
|
||||
- name: "7.2.7 | AUDIT | Ensure no duplicate group names exist | Set warning count"
|
||||
when: discovered_group_check.stdout | length > 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue