mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2025-12-24 14:23:05 +00:00
improved 6.1.10
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
82119205b1
commit
3c08540062
1 changed files with 6 additions and 11 deletions
|
|
@ -150,7 +150,7 @@
|
|||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist"
|
||||
block:
|
||||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | Finding all unowned files or directories"
|
||||
ansible.builtin.shell: find "{{ item.mount }}" -xdev -nouser
|
||||
ansible.builtin.shell: find "{{ item.mount }}" -xdev -nouser -not -fstype nfs
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
|
|
@ -162,26 +162,21 @@
|
|||
- item['device'].startswith('/dev')
|
||||
- not 'bind' in item['options']
|
||||
|
||||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | set fact"
|
||||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | Flatten no_user_items results for easier use"
|
||||
ansible.builtin.set_fact:
|
||||
rhel_09_6_1_10_unowned_files_found: true
|
||||
loop: "{{ rhel_09_6_1_10_audit.results }}"
|
||||
when:
|
||||
- item | length > 0
|
||||
- item.stdout is defined # skipped items are part of results list, but don't have the registered module properties
|
||||
- item.stdout | length > 0
|
||||
discovered_unowned_files_flatten: "{{ rhel_09_6_1_10_audit.results | map(attribute='stdout_lines') | flatten }}"
|
||||
|
||||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | Displaying any unowned files or directories"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! Missing owner on items in {{ rhel_09_6_1_10_audit.stdout_lines }}"
|
||||
when: rhel_09_6_1_10_unowned_files_found
|
||||
msg: "Warning!! Missing owner on items in {{ discovered_unowned_files_flatten }}"
|
||||
when: discovered_unowned_files_flatten | length > 0
|
||||
|
||||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | warning"
|
||||
ansible.builtin.import_tasks:
|
||||
file: warning_facts.yml
|
||||
vars:
|
||||
warn_control_id: '6.1.10'
|
||||
when: rhel_09_6_1_10_unowned_files_found
|
||||
when: discovered_unowned_files_flatten | length > 0
|
||||
vars:
|
||||
rhel_09_6_1_10_unowned_files_found: false
|
||||
when:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue