Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run hardening if /var/log/audit exists #550

Merged
merged 5 commits into from Jul 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion roles/os_hardening/tasks/minimize_access.yml
Expand Up @@ -208,6 +208,11 @@
group: 'root'
mode: '{{ os_mnt_var_log_dir_mode }}'

- name: Check if /var/log/audit exists
stat:
path: /var/log/audit
register: var_log_audit_exists

- name: Mount /var/log/audit with hardened options
mount:
path: /var/log/audit
Expand All @@ -216,14 +221,21 @@
opts: '{{ os_mnt_var_log_audit_options }}'
state: present
register: varlogauditmount
when: os_mnt_var_log_audit_enabled | bool
when:
- os_mnt_var_log_audit_enabled | bool
- var_log_audit_exists.stat.exists | bool
- os_auditd_enabled | bool

- name: Harden permissions for /var/log/audit directory
file:
dest: /var/log/audit
owner: 'root'
group: 'root'
mode: '{{ os_mnt_var_log_audit_dir_mode }}'
when:
- os_mnt_var_log_audit_enabled | bool
- var_log_audit_exists.stat.exists | bool
- os_auditd_enabled | bool

- name: Mount /var/tmp with hardened options
mount:
Expand Down