Skip to contentSkip to conversation

audit: Fix lack of a default audit.rules

PATCH In review Mark Hatle 2 participants 2 messages Apr 4, 2014 – Apr 7, 2014

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/1 audit: Fix lack of a default audit.rules

Various components were failing, and upon investigation it was noted that the audit.rules file referenced by the initscript wasn't available.

There was however a copy under the rules.d directory. Investigating the audit.spec file (which in the upstream source) showed that it was expected that the version in the rules.d should be copied into /etc/audit.

Do this and correct the systemd services file to use the same file.

---
 recipes-security/audit/audit/auditd.service | 2 +-
 recipes-security/audit/audit_2.3.2.bb       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
recipes-security/audit/audit/auditd.service +1 -1
index 6daa056..adf4d3b 100644
@@ -14,7 +14,7 @@ ExecStart=/sbin/auditd -n
 ## Then copy existing rules to /etc/audit/rules.d/
 ## Not doing this last step can cause loss of existing rules
 #ExecStartPost=-/sbin/augenrules --load
-ExecStartPost=-/sbin/auditctl -R /etc/audit/rules.d/audit.rules
+ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
 ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]
recipes-security/audit/audit_2.3.2.bb +5 -0
index 4a9c954..ae6556f 100644
@@ -67,6 +67,8 @@ FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
 FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
 FILES_${PN}-dev += "${base_libdir}/*.so ${base_libdir}/*.la"
 
+CONFFILES_auditd += "${sysconfdir}/audit/audit.rules"
+
 do_install_append() {
 	rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
 	rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
@@ -91,4 +93,7 @@ do_install_append() {
 
 	chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
 	chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
+
+	# Based on the audit.spec "Copy default rules into place on new installation"
+	cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
 }
Signature · 1 line
1.8.5.3
#1 lore raw
Quoted 7 lines · [[meta-selinux][PATCH] audit: Fix lack of a default audit.rules] On 14.04.04…

Various components were failing, and upon investigation it was noted that the audit.rules file referenced by the initscript wasn't available.

There was however a copy under the rules.d directory. Investigating the audit.spec file (which in the upstream source) showed that it was expected that the version in the rules.d should be copied into /etc/audit.

It's expected that you'd actually generate the audit.rules file using augenrules, but this is a reasonable approximation of that. :-)

Quoted 1 line

Do this and correct the systemd services file to use the same file.

Also the right thing to do here.

Merging.
-J.

Quoted 41 lines
---
 recipes-security/audit/audit/auditd.service | 2 +-
 recipes-security/audit/audit_2.3.2.bb       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
recipes-security/audit/audit/auditd.service +1 -1
index 6daa056..adf4d3b 100644
@@ -14,7 +14,7 @@ ExecStart=/sbin/auditd -n
 ## Then copy existing rules to /etc/audit/rules.d/
 ## Not doing this last step can cause loss of existing rules
 #ExecStartPost=-/sbin/augenrules --load
-ExecStartPost=-/sbin/auditctl -R /etc/audit/rules.d/audit.rules
+ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
 ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]
recipes-security/audit/audit_2.3.2.bb +5 -0
index 4a9c954..ae6556f 100644
@@ -67,6 +67,8 @@ FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
 FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
 FILES_${PN}-dev += "${base_libdir}/*.so ${base_libdir}/*.la"
 
+CONFFILES_auditd += "${sysconfdir}/audit/audit.rules"
+
 do_install_append() {
 	rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
 	rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
@@ -91,4 +93,7 @@ do_install_append() {
 
 	chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
 	chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
+
+	# Based on the audit.spec "Copy default rules into place on new installation"
+	cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
 }
Signature · 2 lines
-Joe MacDonald.
:wq