diff --git a/shared/checks/oval/directory_access_var_log_audit.xml b/shared/checks/oval/directory_access_var_log_audit.xml
new file mode 100644
index 0000000000..8edc5970d3
--- /dev/null
+++ b/shared/checks/oval/directory_access_var_log_audit.xml
@@ -0,0 +1,57 @@
+
-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail+ If the auditd daemon is configured to use the augenrules + program to read audit rules during daemon startup (the default), add the + rule to a file with suffix .rules in the directory + /etc/audit/rules.d. + If the auditd daemon is configured to use the auditctl + utility to read audit rules during daemon startup, add the rule to + /etc/audit/audit.rules file. + +rationale: |- + Attempts to read the logs should be recorded, suspicious access to audit log files could be an indicator of malicious activity on a system. + Auditing these events could serve as evidence of potential system compromise.' + +references: + ospp@rhel7: FAU_GEN.1.1.c + +severity: unknown + +ocil_clause: "no line is returned" + +ocil: |- + To determine if the system is configured to audit accesses to +
/var/log/audit
directory, run the following command:
+ $ sudo grep "dir=/var/log/audit" /etc/audit/audit.rules+ If the system is configured to audit this activity, it will return a line. diff --git a/rhel7/profiles/ospp42-draft.profile b/rhel7/profiles/ospp42-draft.profile index 42c1e98e39..0a71eb16f6 100644 --- a/rhel7/profiles/ospp42-draft.profile +++ b/rhel7/profiles/ospp42-draft.profile @@ -139,6 +139,7 @@ selections: - audit_rules_privileged_commands_sudo - audit_rules_privileged_commands_su - audit_rules_session_events + - directory_access_var_log_audit - ensure_redhat_gpgkey_installed - ensure_gpgcheck_globally_activated - ensure_gpgcheck_never_disabled diff --git a/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/auditctl_correct_rule.pass.sh b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/auditctl_correct_rule.pass.sh new file mode 100644 index 0000000000..e9b1d56af3 --- /dev/null +++ b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/auditctl_correct_rule.pass.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# profiles = xccdf_org.ssgproject.content_profile_ospp +# remediation = none + +# Use auditctl in RHEL7 +sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service + +echo "-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail" >> /etc/audit/audit.rules diff --git a/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/auditctl_wrong_dir.fail.sh b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/auditctl_wrong_dir.fail.sh new file mode 100644 index 0000000000..1c68a3229b --- /dev/null +++ b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/auditctl_wrong_dir.fail.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# profiles = xccdf_org.ssgproject.content_profile_ospp +# remediation = none + +# Use auditctl in RHEL7 +sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service + +echo "-a always,exit -F dir=/var/log/auditd/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail" >> /etc/audit/audit.rules diff --git a/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_correct_rule.pass.sh b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_correct_rule.pass.sh new file mode 100644 index 0000000000..58ef8bc15f --- /dev/null +++ b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_correct_rule.pass.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# profiles = xccdf_org.ssgproject.content_profile_ospp +# remediation = none + +echo "-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail" >> /etc/audit/rules.d/var_log_audit.rules diff --git a/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_wrong_dir.fail.sh b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_wrong_dir.fail.sh new file mode 100644 index 0000000000..29f0f2d38e --- /dev/null +++ b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_wrong_dir.fail.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# profiles = xccdf_org.ssgproject.content_profile_ospp +# remediation = none + +echo "-a always,exit -F dir=/var/log/auditd/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail" >> /etc/audit/rules.d/var_log_audit.rules diff --git a/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_wrong_perm.fail.sh b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_wrong_perm.fail.sh new file mode 100644 index 0000000000..82eae1895d --- /dev/null +++ b/tests/data/group_system/group_auditing/group_auditd_configure_rules/rule_directory_access_var_log_audit/augenrules_wrong_perm.fail.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# profiles = xccdf_org.ssgproject.content_profile_ospp +# remediation = none + +echo "-a always,exit -F dir=/var/log/audit/ -F perm=w -F auid>=1000 -F auid!=unset -F key=access-audit-trail" >> /etc/audit/rules.d/var_log_audit.rules