Audit persistent rules
Create persistent Audit rules by adding them to the /etc/audit/rules.d/ directory. This helps ensure that your monitoring configuration remains active and effective even after a system reboot.
To define Audit rules that are persistent across reboots, either include them directly in the /etc/audit/rules.d/audit.rules file or use the augenrules program. The augenrules program reads rules from the /etc/audit/rules.d/ directory.
Note that the /etc/audit/audit.rules file is generated whenever the auditd service starts. Files in /etc/audit/rules.d/ use the same auditctl command-line syntax to specify the rules. Empty lines and text following a hash sign (#) are ignored.
Furthermore, you can use the auditctl command to read rules from a specified file by using the -R option, for example:
# auditctl -R /usr/share/audit/sample-rules/30-stig.rules
The augenrules script reads rules located in the /etc/audit/rules.d/ directory and compiles them into an audit.rules file. This script processes all files that end with .rules in a specific order based on their natural sort order. The files in this directory are organized into groups with the following meanings:
- 10
- Kernel and
auditctlconfiguration - 20
- Rules that could match general rules, but you want a different match
- 30
- Main rules
- 40
- Optional rules
- 50
- Server-specific rules
- 70
- System local rules
- 90
- Finalize (immutable)
Do not use all the rules at once. Plan the policy and copy individual files to /etc/audit/rules.d/. For example, to set a system up in the STIG configuration, copy rules 10-base-config, 30-stig, 31-privileged, and 99-finalize.
Once you have the rules in the /etc/audit/rules.d/ directory, load them by running the augenrules script with the --load directive:
# augenrules --load
/sbin/augenrules: No change
No rules
enabled 1
failure 1
pid 742
rate_limit 0
…
See the audit.rules(8) and augenrules(8) man pages on your system for more information.