Skip to content

Commit

Permalink
Merge pull request dev-sec#427 from dev-sec/snoopotic-fix/add_auditd_…
Browse files Browse the repository at this point in the history
…restart_handler

add restart-auditd handler after configuration change
  • Loading branch information
schurzi authored Mar 29, 2021
2 parents 2c8df7a + 2ba6140 commit cd07ed1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion molecule/mysql_hardening/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"

- name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/mysql-baseline.git"
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/mysql-baseline"
register: test_results
changed_when: false
ignore_errors: true
Expand Down
2 changes: 1 addition & 1 deletion molecule/nginx_hardening/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"

- name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/nginx-baseline.git"
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/nginx-baseline"
register: test_results
changed_when: false
ignore_errors: true
Expand Down
2 changes: 1 addition & 1 deletion molecule/os_hardening/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"

- name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/linux-baseline.git"
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/linux-baseline"
register: test_results
changed_when: false
ignore_errors: true
Expand Down
2 changes: 1 addition & 1 deletion molecule/ssh_hardening/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"

- name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/ssh-baseline.git"
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/nginx-baseline"
register: test_results
changed_when: false
ignore_errors: true
Expand Down
6 changes: 6 additions & 0 deletions roles/os_hardening/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
- name: Update-initramfs
command: 'update-initramfs -u'

- name: restart-auditd
command:
cmd: 'service auditd restart' # rhel: see: https://access.redhat.com/solutions/2664811
warn: false # sadly 'service' module fails in that case also by using 'use: service'
when: molecule_yml is not defined # restarting auditd in a container does not work
3 changes: 3 additions & 0 deletions roles/os_hardening/tasks/auditd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package:
name: '{{ auditd_package }}'
state: 'present'
tags: auditd

- name: Configure auditd | package-08
template:
Expand All @@ -11,3 +12,5 @@
owner: 'root'
group: 'root'
mode: '0640'
notify: 'restart-auditd'
tags: auditd

0 comments on commit cd07ed1

Please sign in to comment.