diff options
author | Jason Zaman <perfinion@gentoo.org> | 2015-08-18 12:27:33 +0800 |
---|---|---|
committer | Jason Zaman <perfinion@gentoo.org> | 2015-08-18 12:29:26 +0800 |
commit | 7b1821119f093af1396b20cfd26c24188d5936f1 (patch) | |
tree | ea1e8198c1b8ba028990090ccec076d309fa5dd0 /sys-process/audit/files/auditd-init.d-2.4.3 | |
parent | robotframework-selenium2library: bump; rm old (diff) | |
download | gentoo-7b1821119f093af1396b20cfd26c24188d5936f1.tar.gz gentoo-7b1821119f093af1396b20cfd26c24188d5936f1.tar.bz2 gentoo-7b1821119f093af1396b20cfd26c24188d5936f1.zip |
sys-process/audit: Remove lock from init script
The lock in the init script was only needed in Redhat. OpenRC keeps track of if
the process is started so not required. Also fix perms on the systemd unit.
Gentoo-Bug: https://bugs.gentoo.org/556436
Gentoo-Bug: https://bugs.gentoo.org/449990
Package-Manager: portage-2.2.20.1
Diffstat (limited to 'sys-process/audit/files/auditd-init.d-2.4.3')
-rw-r--r-- | sys-process/audit/files/auditd-init.d-2.4.3 | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/sys-process/audit/files/auditd-init.d-2.4.3 b/sys-process/audit/files/auditd-init.d-2.4.3 new file mode 100644 index 000000000000..33c932a2e10e --- /dev/null +++ b/sys-process/audit/files/auditd-init.d-2.4.3 @@ -0,0 +1,91 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_started_commands='reload reload_auditd reload_rules' +description='Linux Auditing System' +description_reload='Reload daemon configuration and rules' +description_reload_rules='Reload daemon rules' +description_reload_auditd='Reload daemon configuration' + +name='auditd' +pidfile='/var/run/auditd.pid' +command='/sbin/auditd' + +start_auditd() { + # Env handling taken from the upstream init script + if [ -z "$AUDITD_LANG" -o "$AUDITD_LANG" = "none" -o "$AUDITD_LANG" = "NONE" ]; then + unset LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE + else + LANG="$AUDITD_LANG" + LC_TIME="$AUDITD_LANG" + LC_ALL="$AUDITD_LANG" + LC_MESSAGES="$AUDITD_LANG" + LC_NUMERIC="$AUDITD_LANG" + LC_MONETARY="$AUDITD_LANG" + LC_COLLATE="$AUDITD_LANG" + export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE + fi + unset HOME MAIL USER USERNAME + + ebegin "Starting ${name}" + start-stop-daemon \ + --start --quiet --pidfile ${pidfile} \ + --exec ${command} -- ${EXTRAOPTIONS} + local ret=$? + eend $ret + return $ret +} + +stop_auditd() { + ebegin "Stopping ${name}" + start-stop-daemon --stop --quiet --pidfile ${pidfile} + local ret=$? + eend $ret + return $ret +} + +loadfile() { + local rules="$1" + if [ -n "${rules}" -a -f "${rules}" ]; then + einfo "Loading audit rules from ${rules}" + /sbin/auditctl -R "${rules}" >/dev/null + return $? + else + return 0 + fi +} + +start() { + start_auditd + local ret=$? + if [ $ret -eq 0 -a "${RC_CMD}" != "restart" ]; then + loadfile "${RULEFILE_STARTUP}" + fi + return $ret +} + +reload_rules() { + loadfile "${RULEFILE_STARTUP}" +} + +reload_auditd() { + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP \ + --exec "${command}" --pidfile "${pidfile}" + eend $? +} + +reload() { + reload_auditd + reload_rules +} + +stop() { + [ "${RC_CMD}" != "restart" ] && loadfile "${RULEFILE_STOP_PRE}" + stop_auditd + local ret=$? + [ "${RC_CMD}" != "restart" ] && loadfile "${RULEFILE_STOP_POST}" + return $ret +} |