4
0
Fork 0

Merge pull request #51 from ansible-lockdown/warning_improvements

Warning improvements
This commit is contained in:
uk-bolly 2023-04-13 14:19:45 +01:00 committed by GitHub
commit 9d7cfc9661
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 31 deletions

View file

@ -1,5 +1,10 @@
# Changes to rhel9CIS # Changes to rhel9CIS
## 1.0.7
lint and yamll updates
improvemnst to 6.1.10, 6.1.11, 6.1.13, 6.1.14
## 1.0.6 ## 1.0.6
updated ymlalint as galaxy doenst honouyr local settings updated ymlalint as galaxy doenst honouyr local settings

View file

@ -160,22 +160,24 @@
label: "{{ item.mount }}" label: "{{ item.mount }}"
when: item['device'].startswith('/dev') and not 'bind' in item['options'] when: item['device'].startswith('/dev') and not 'bind' in item['options']
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | set fact"
ansible.builtin.set_fact:
rhel_09_6_1_10_unowned_files_found: true
loop: "{{ rhel_09_6_1_10_audit.results }}"
when: item.stdout | length > 0
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | Displaying any unowned files or directories" - name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | Displaying any unowned files or directories"
ansible.builtin.debug: ansible.builtin.debug:
msg: "Warning !! Manual intervention is required -- missing owner on items in {{ item.item.mount }}: {{ item.stdout_lines | join(', ') }}" msg: "Warning!! Missing owner on items in {{ rhel_09_6_1_10_audit | json_query('results[*].stdout_lines[*]') | flatten }}"
loop: "{{ rhel_09_6_1_10_audit.results }}" when: rhel_09_6_1_10_unowned_files_found
when:
- item.stdout_lines is defined
- item.stdout_lines | length > 0
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | warning" - name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | warning"
ansible.builtin.import_tasks: warning_facts.yml ansible.builtin.import_tasks: warning_facts.yml
vars: vars:
warn_control_id: '6.1.10' warn_control_id: '6.1.10'
when: when: rhel_09_6_1_10_unowned_files_found
- item.stdout_lines is defined vars:
- item.stdout_lines | length > 0 rhel_09_6_1_10_unowned_files_found: false
when: when:
- rhel9cis_rule_6_1_10 - rhel9cis_rule_6_1_10
tags: tags:
@ -199,21 +201,24 @@
label: "{{ item.mount }}" label: "{{ item.mount }}"
when: item['device'].startswith('/dev') and not 'bind' in item['options'] when: item['device'].startswith('/dev') and not 'bind' in item['options']
- name: "6.1.11 | AUDIT | Ensure no ungrouped files or directories exist | set fact"
ansible.builtin.set_fact:
rhel_09_6_1_11_ungrouped_files_found: true
loop: "{{ rhel_09_6_1_11_audit.results }}"
when: item.stdout | length > 0
- name: "6.1.11 | AUDIT | Ensure no ungrouped files or directories exist | Displaying all ungrouped files or directories" - name: "6.1.11 | AUDIT | Ensure no ungrouped files or directories exist | Displaying all ungrouped files or directories"
ansible.builtin.debug: ansible.builtin.debug:
msg: "Warning !! Manual intervention is required -- missing group on items in {{ item.item.mount }}: {{ item.stdout_lines | join(', ') }}" msg: "Warning!! Missing group on items in {{ rhel_09_6_1_11_audit | json_query('results[*].stdout_lines[*]') | flatten }}"
loop: "{{ rhel_09_6_1_11_audit.results }}" when: rhel_09_6_1_11_ungrouped_files_found
when:
- item.stdout_lines is defined
- item.stdout_lines | length > 0
- name: "6.1.11 | AUDIT | Ensure no ungrouped files or directories exist | warning" - name: "6.1.11 | AUDIT | Ensure no ungrouped files or directories exist | warning"
ansible.builtin.import_tasks: warning_facts.yml ansible.builtin.import_tasks: warning_facts.yml
vars: vars:
warn_control_id: '6.1.11' warn_control_id: '6.1.11'
when: when: rhel_09_6_1_11_ungrouped_files_found
- item.stdout_lines is defined vars:
- item.stdout_lines | length > 0 - rhel_09_6_1_11_ungrouped_files_found: false
when: when:
- rhel9cis_rule_6_1_11 - rhel9cis_rule_6_1_11
tags: tags:
@ -244,24 +249,29 @@
ansible.builtin.shell: df {{ item.mount }} -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -4000 ansible.builtin.shell: df {{ item.mount }} -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -4000
failed_when: false failed_when: false
changed_when: false changed_when: false
register: rhel_09_6_1_13_perms_results register: rhel_09_6_1_13_suid_perms
loop: "{{ ansible_mounts }}" loop: "{{ ansible_mounts }}"
loop_control: loop_control:
label: "{{ item.mount }}" label: "{{ item.mount }}"
- name: "6.1.13 | AUDIT | Audit SUID executables | set fact SUID executables"
ansible.builtin.set_fact:
rhel9_6_1_13_suid_found: true
loop: "{{ rhel_09_6_1_13_suid_perms.results }}"
when: item.stdout | length > 0
- name: "6.1.13 | AUDIT | Audit SUID executables | Alert SUID executables exist" - name: "6.1.13 | AUDIT | Audit SUID executables | Alert SUID executables exist"
ansible.builtin.debug: ansible.builtin.debug:
msg: "Warning!! Manual intervention is required -- SUID set on items in {{ item.item.mount }}: {{ item.stout_lines | join(', ') }}" msg: "Warning!! SUID set on items in {{ rhel_09_6_1_13_suid_perms | json_query('results[*].stdout_lines[*]') | flatten }}"
loop: "{{ rhel_09_6_1_13_perms_results.stdout_lines }}" when: rhel9_6_1_13_suid_found
when:
- rhel_09_6_1_13_perms_results.stdout is defined
- name: "6.1.13 | AUDIT | Audit SUID executables | Alert SUID executables exist | warning" - name: "6.1.13 | AUDIT | Audit SUID executables | Alert SUID executables exist | warning"
ansible.builtin.import_tasks: warning_facts.yml ansible.builtin.import_tasks: warning_facts.yml
vars: vars:
warn_control_id: '6.1.13' warn_control_id: '6.1.13'
when: when: rhel9_6_1_13_suid_found
- rhel_09_6_1_13_perms_results.stdout is defined vars:
rhel9_6_1_13_suid_found: false
when: when:
- rhel9cis_rule_6_1_13 - rhel9cis_rule_6_1_13
tags: tags:
@ -278,24 +288,29 @@
ansible.builtin.shell: df {{ item.mount }} -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -2000 ansible.builtin.shell: df {{ item.mount }} -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -2000
failed_when: false failed_when: false
changed_when: false changed_when: false
register: rhel_09_6_1_14_perms_results register: rhel_09_6_1_14_sgid_perms
loop: "{{ ansible_mounts }}" loop: "{{ ansible_mounts }}"
loop_control: loop_control:
label: "{{ item.mount }}" label: "{{ item.mount }}"
- name: "6.1.14 | AUDIT | Audit SGID executables | Set fact SGID executables"
ansible.builtin.set_fact:
rhel9_6_1_14_sgid_found: true
loop: "{{ rhel_09_6_1_14_sgid_perms.results }}"
when: item.stdout | length > 0
- name: "6.1.14 | AUDIT | Audit SGID executables | Alert SGID executables exist" - name: "6.1.14 | AUDIT | Audit SGID executables | Alert SGID executables exist"
ansible.builtin.debug: ansible.builtin.debug:
msg: "Manual intervention is required -- SGID set on items in {{ item.item.mount }}: {{ item.stout_lines | join(', ') }}" msg: "Warning!! SGID set on items in {{ rhel_09_6_1_14_sgid_perms | json_query('results[*].stdout_lines[*]') | flatten }}"
loop: "{{ rhel_09_6_1_14_perms_results.stdout_lines }}" when: rhel9_6_1_14_sgid_found
when:
- rhel_09_6_1_14_perms_results.stdout is defined
- name: "6.1.14 | AUDIT | Audit SGID executables| warning" - name: "6.1.14 | AUDIT | Audit SGID executables| warning"
ansible.builtin.import_tasks: warning_facts.yml ansible.builtin.import_tasks: warning_facts.yml
vars: vars:
warn_control_id: '6.1.14' warn_control_id: '6.1.14'
when: when: rhel9_6_1_14_sgid_found
- rhel_09_6_1_14_perms_results.stdout is defined vars:
rhel9_6_1_14_sgid_found: false
when: when:
- rhel9cis_rule_6_1_14 - rhel9cis_rule_6_1_14
tags: tags: