# platform = multi_platform_all
# reboot = false
# strategy = restrict
# complexity = low
# disruption = low

- name: "Put contents into /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules according to policy"
  ansible.builtin.copy:
    dest: "/etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules"
    content: |+
        ## Unsuccessful ownership change
        -a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change
        -a always,exit -F arch=b64 -S fchown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change
        -a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change
        -a always,exit -F arch=b64 -S fchown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change
    force: yes

- name: Configure auditing of unsuccessful ownership changes (AArch64) - Remove any permissions from group and other
  ansible.builtin.file:
    path: /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules
    mode: g-rwx,o-rwx
    state: touch