1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
documentation_complete: true
title: 'Configure auditing of unsuccessful file deletions'
{{% set file_contents_audit_delete_failed =
"## Unsuccessful file delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=" ~ uid_min ~ " -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=" ~ uid_min ~ " -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=" ~ uid_min ~ " -F auid!=unset -F key=unsuccessful-delete
-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=" ~ uid_min ~ " -F auid!=unset -F key=unsuccessful-delete" %}}
description: |-
Ensure that unsuccessful attempts to delete a file are audited.
The following rules configure audit as described above:
<pre>{{{ file_contents_audit_delete_failed|indent }}} </pre>
Load new Audit rules into kernel by running:
<pre>augenrules --load</pre>
Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You may reuse this rule in different profiles. If you decide to do so, it is recommended that you inspect contents of the file closely and make sure that they are alligned with your needs.
rationale: |-
Unsuccessful attempts to delete a file might be signs of malicious activities. Auditing of such events help in monitoring and investigating of such activities.
severity: medium
# on RHEL9+ there are rules which cover particular hardware architectures
# so do not apply this rule but apply the specific one instead
{{% if product in ["rhel9", "rhel10"] %}}
platforms:
- not aarch64_arch and not ppc64le_arch
{{% endif %}}
identifiers:
cce@rhel8: CCE-82835-0
cce@rhel9: CCE-83667-6
cce@rhel10: CCE-89807-2
references:
nist: AU-2(a)
ospp: FAU_GEN.1.1.c
srg: SRG-OS-000458-GPOS-00203,SRG-OS-000474-GPOS-00219,SRG-OS-000475-GPOS-00220,SRG-OS-000463-GPOS-00207,SRG-OS-000465-GPOS-00209,SRG-OS-000461-GPOS-00205,SRG-OS-000468-GPOS-00212,SRG-APP-000501-CTR-001265,SRG-APP-000502-CTR-001270
ocil_clause: 'the file does not exist or the content differs'
ocil: |-
To verify that the <tt>Audit</tt> is correctly configured according to recommended rules, check the content of the file with the following command:
<pre>cat /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules</pre>
The output has to be exactly as follows:
<pre>{{{ file_contents_audit_delete_failed|indent }}} </pre>
template:
name: audit_file_contents
vars:
filepath: /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules
contents: |-
{{{ file_contents_audit_delete_failed|indent(12) }}}
fixtext: |-
Configure {{{ full_name }}} to audit all unsuccessful attempts to delete a file.
Create file "/etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules" with the exactly following content:
{{{ file_contents_audit_delete_failed|indent(4) }}}
Then, run the following commands:
$ sudo chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules
$ sudo augenrules --load
|