diff options
author | Roy Li <rongqing.li@windriver.com> | 2014-04-03 14:05:42 -0400 |
---|---|---|
committer | Joe MacDonald <joe@deserted.net> | 2014-04-03 14:46:09 -0400 |
commit | 27c0f97b8b94d1f3670e8c283beadb956798deff (patch) | |
tree | 56d448bee64a2b8cdf23cfbbcb51a46c74156a12 | |
parent | 4df5a5b1704ada9af6561496177401441614297b (diff) | |
download | meta-selinux-27c0f97b8b94d1f3670e8c283beadb956798deff.tar.gz |
audit: Add systemd support
Audit unit file is from https://fedorahosted.org/audit/browser/trunk/init.d/auditd.service
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
-rw-r--r-- | recipes-security/audit/audit/audit-volatile.conf | 1 | ||||
-rw-r--r-- | recipes-security/audit/audit/auditd.service | 21 | ||||
-rw-r--r-- | recipes-security/audit/audit_2.3.2.bb | 18 |
3 files changed, 38 insertions, 2 deletions
diff --git a/recipes-security/audit/audit/audit-volatile.conf b/recipes-security/audit/audit/audit-volatile.conf new file mode 100644 index 0000000..9cbe154 --- /dev/null +++ b/recipes-security/audit/audit/audit-volatile.conf | |||
@@ -0,0 +1 @@ | |||
d /var/log/audit 0750 root root - | |||
diff --git a/recipes-security/audit/audit/auditd.service b/recipes-security/audit/audit/auditd.service new file mode 100644 index 0000000..6daa056 --- /dev/null +++ b/recipes-security/audit/audit/auditd.service | |||
@@ -0,0 +1,21 @@ | |||
1 | [Unit] | ||
2 | Description=Security Auditing Service | ||
3 | DefaultDependencies=no | ||
4 | After=local-fs.target | ||
5 | Conflicts=shutdown.target | ||
6 | Before=sysinit.target shutdown.target | ||
7 | After=systemd-tmpfiles-setup.service | ||
8 | RefuseManualStop=yes | ||
9 | |||
10 | [Service] | ||
11 | ExecStart=/sbin/auditd -n | ||
12 | ## To use augenrules, copy this file to /etc/systemd/system/auditd.service | ||
13 | ## and uncomment the next line and delete/comment out the auditctl line. | ||
14 | ## Then copy existing rules to /etc/audit/rules.d/ | ||
15 | ## Not doing this last step can cause loss of existing rules | ||
16 | #ExecStartPost=-/sbin/augenrules --load | ||
17 | ExecStartPost=-/sbin/auditctl -R /etc/audit/rules.d/audit.rules | ||
18 | ExecReload=/bin/kill -HUP $MAINPID | ||
19 | |||
20 | [Install] | ||
21 | WantedBy=multi-user.target | ||
diff --git a/recipes-security/audit/audit_2.3.2.bb b/recipes-security/audit/audit_2.3.2.bb index edcb881..eafcd30 100644 --- a/recipes-security/audit/audit_2.3.2.bb +++ b/recipes-security/audit/audit_2.3.2.bb | |||
@@ -14,14 +14,19 @@ SRC_URI = "http://people.redhat.com/sgrubb/audit/audit-${PV}.tar.gz \ | |||
14 | file://audit-python-configure.patch \ | 14 | file://audit-python-configure.patch \ |
15 | file://audit-for-cross-compiling.patch \ | 15 | file://audit-for-cross-compiling.patch \ |
16 | file://auditd \ | 16 | file://auditd \ |
17 | file://fix-swig-host-contamination.patch" | 17 | file://fix-swig-host-contamination.patch \ |
18 | file://auditd.service \ | ||
19 | file://audit-volatile.conf \ | ||
20 | " | ||
18 | 21 | ||
19 | inherit autotools pythonnative update-rc.d | 22 | inherit autotools pythonnative update-rc.d systemd |
20 | 23 | ||
21 | UPDATERCPN = "auditd" | 24 | UPDATERCPN = "auditd" |
22 | INITSCRIPT_NAME = "auditd" | 25 | INITSCRIPT_NAME = "auditd" |
23 | INITSCRIPT_PARAMS = "defaults" | 26 | INITSCRIPT_PARAMS = "defaults" |
24 | 27 | ||
28 | SYSTEMD_SERVICE_${PN} = "auditd.service" | ||
29 | |||
25 | SRC_URI[md5sum] = "4e8d065b5cc16b77b9b61e93a9ed160e" | 30 | SRC_URI[md5sum] = "4e8d065b5cc16b77b9b61e93a9ed160e" |
26 | SRC_URI[sha256sum] = "8872e0b5392888789061db8034164305ef0e1b34543e1e7004d275f039081d29" | 31 | SRC_URI[sha256sum] = "8872e0b5392888789061db8034164305ef0e1b34543e1e7004d275f039081d29" |
27 | 32 | ||
@@ -74,4 +79,13 @@ do_install_append() { | |||
74 | # replace init.d | 79 | # replace init.d |
75 | install -D -m 0755 ${S}/../auditd ${D}/etc/init.d/auditd | 80 | install -D -m 0755 ${S}/../auditd ${D}/etc/init.d/auditd |
76 | rm -rf ${D}/etc/rc.d | 81 | rm -rf ${D}/etc/rc.d |
82 | |||
83 | if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
84 | install -d ${D}${sysconfdir}/tmpfiles.d/ | ||
85 | install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ | ||
86 | fi | ||
87 | |||
88 | # install systemd unit files | ||
89 | install -d ${D}${systemd_unitdir}/system | ||
90 | install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system | ||
77 | } | 91 | } |