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

support restarts of audit service on Arch linux #722

Merged
merged 7 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/os_hardening_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- generic/debian11
- generic/debian12
- generic/opensuse15
# - generic/arch # needs fix for audit
- generic/arch
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions molecule/os_hardening_vm/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- name: override for arch
set_fact:
os_mnt_boot_enabled: false
os_mnt_tmp_enabled: true
os_mnt_tmp_src: "tmpfs"
os_mnt_tmp_filesystem: "tmpfs"
when: ansible_facts.os_family == 'Archlinux'
- name: overrides for Fedora image
set_fact:
Expand Down
21 changes: 16 additions & 5 deletions roles/os_hardening/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
- name: Update-initramfs # noqa no-changed-when
ansible.builtin.command: update-initramfs -u

- name: Restart auditd # noqa command-instead-of-module no-changed-when
ansible.builtin.command:
cmd: service auditd restart # rhel: see: https://access.redhat.com/solutions/2664811
when: molecule_yml.driver.name | default() != "docker" # restarting auditd in a container does not work

- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: true

- name: Restart auditd via systemd
ansible.builtin.systemd:
name: auditd.service
state: restarted
ignore_errors: "{{ ansible_check_mode }}"
when:
- molecule_yml.driver.name | default() != "docker" # restarting auditd in a container does not work
- not ansible_facts.os_family == 'RedHat'

- name: Restart auditd via service # noqa command-instead-of-module no-changed-when
ansible.builtin.command:
cmd: service auditd restart # rhel: see: https://access.redhat.com/solutions/2664811
when:
- molecule_yml.driver.name | default() != "docker" # restarting auditd in a container does not work
- ansible_facts.os_family == 'RedHat'

- name: Remount filesystems
ansible.posix.mount:
path: "{{ item }}"
Expand Down
4 changes: 3 additions & 1 deletion roles/os_hardening/tasks/auditd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
owner: root
group: root
mode: "0640"
notify: Restart auditd
notify:
- Restart auditd via service
- Restart auditd via systemd
tags: auditd