Add RHEL9-specific audit rules for faillock and lastlog with auid filter - #15016
Conversation
|
Skipping CI for Draft Pull Request. |
5c4bfea to
fb4ea82
Compare
|
@ggbecker I think the rule descriptions need to be changed so that on RHEL 9 they would match the OVAL and remediations. |
|
@ggbecker Is this going to be backported to the stabilization branch? |
Yeah, but one thing here that I decided to do is for example, to have the OVAL relaxed in a way that it allows the audit line without the auid filters set, this is to not break any other profile (many other profiles are using these rules already) that already has that line of audit configured, but the remediation, when applied, will set those auid filters to the audit line
It was on my plans to do so. |
RHEL9 STIG v2r9 requires auid filters for the following audit rules: - RHEL-09-654250: audit_rules_login_events_faillock - RHEL-09-654255: audit_rules_login_events_lastlog RHEL10 STIG v1r2 does NOT require auid filters for the equivalent rules: - RHEL-10-500750 - RHEL-10-500760 This commit removes the templates from rule.yml and provides: 1. **shared.sh/yml/xml** - Template-derived content (no auid filters) used by: - rhel8, rhel10, ol7, ol8, ol9, ol10, rhcos4, rhv4 - almalinux9, anolis8, anolis23, fedora - debian11, ubuntu2204, ubuntu2404 - sle12, sle15 2. **rhel9.sh/yml/xml** - Custom RHEL9 content with required auid filters: - Bash: Uses bash_fix_audit_syscall_rule macro with AUID_FILTERS - Ansible: Adds auid>=1000 and auid!=unset to rule patterns - OVAL: Requires auid>=1000 and auid!=unset in pattern matching The generated RHEL9 rules include: ``` -a always,exit -F arch=b32 -F path=/var/run/faillock -F perm=wa -F auid>=1000 -F auid!=unset -k logins -a always,exit -F arch=b64 -F path=/var/run/faillock -F perm=wa -F auid>=1000 -F auid!=unset -k logins ``` And similar for /var/log/lastlog. Test scenarios verify both passing and failing cases for RHEL9. This is a temporary solution until DISA clarifies why RHEL10 STIG doesn't require the auid parameter. If DISA updates RHEL10 to match RHEL9, the custom content can be updated accordingly. Fixes: Missed requirement in PR ComplianceAsCode#15000 References: https://stigaview.com/products/rhel9/v2r9/RHEL-09-654250/ References: https://stigaview.com/products/rhel9/v2r9/RHEL-09-654255/ References: https://stigaview.com/products/rhel10/v1r2/RHEL-10-500750 References: https://stigaview.com/products/rhel10/v1r2/RHEL-10-500760
fb4ea82 to
6be7f90
Compare
If we should actually restrict OVAL to check for the presence of auid filters, then this opens a different kind of question that is how we deal with other profiles. Unless we create custom STIG rules for RHEL9 (kind of unwanted IMO). |
|
I think that allowing audit rules both with and without auid is fine. |
I agree |
|
@ggbecker: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
| {{{ ocil_audit_rules_watch("/var/log/lastlog", "logins") }}} | ||
|
|
||
| {{% if product in ["rhel9"] %}} | ||
| warnings: |
Summary
Adds RHEL9-specific audit rules for
audit_rules_login_events_faillockandaudit_rules_login_events_lastlogwithauidfilters (-F auid>=1000 -F auid!=unset) as required by RHEL 9 STIG v2r9 (RHEL-09-654250, RHEL-09-654255).Note: RHEL 10 STIG v1r2 does NOT require these filters. This was missed in PR #15000.
Changes
Created RHEL9-specific overrides for both rules:
bash/rhel9.sh- Remediation with auid filtersansible/rhel9.yml- Remediation with auid filtersoval/rhel9.xml- Permissive check (accepts rules with or without auid filters)tests/rhel9_*.sh- Test scenarios (pass/fail cases)OVAL Design: The OVAL check accepts rules with or without auid filters to prevent false failures on existing systems. Remediations always add the auid filters to ensure compliance. A conditional warning explains this behavior (RHEL9 only).
Generated rules:
Impact
audit_rules_login_events_faillockaudit_rules_login_events_lastlogReferences