logrotate: enable selinux support
[buildroot-gz.git] / package / audit / S01auditd
blob2ecf0f1df9318156b114ad000efcf4455e56abfb
1 #!/bin/sh
3 # auditd This starts and stops auditd
5 # description: This starts the Linux Auditing System Daemon,
6 # which collects security related events in a dedicated
7 # audit log. If this daemon is turned off, audit events
8 # will be sent to syslog.
11 NAME=auditd
12 DAEMON=/usr/sbin/${NAME}
13 CONFIG=/etc/audit/auditd.conf
14 PIDFILE=/var/run/${NAME}.pid
16 start(){
17 printf "Starting ${NAME}: "
19 # Create dir to store log files in if one doesn't exist. Create
20 # the directory with SELinux permissions if possible
21 command -v matchpathcon >/dev/null 2>&1
22 if [ $? = 0 ]; then
23 mkdir -p /var/log/audit -Z `matchpathcon -n /var/log/audit`
24 else
25 mkdir -p /var/log/audit
28 # Run audit daemon executable
29 start-stop-daemon -S -q -p ${PIDFILE} --exec ${DAEMON}
31 if [ $? = 0 ]; then
32 # Load the default rules
33 test -f /etc/audit/rules.d/audit.rules && /usr/sbin/auditctl -R /etc/audit/rules.d/audit.rules >/dev/null
34 echo "OK"
35 else
36 echo "FAIL"
40 stop(){
41 printf "Stopping ${NAME}: "
43 start-stop-daemon -K -q -p ${PIDFILE}
44 [ $? = 0 ] && echo "OK" || echo "FAIL"
47 reload(){
48 printf "Reloading ${NAME} configuration: "
49 start-stop-daemon --stop -s 1 -p ${PIDFILE} 1>/dev/null
50 [ $? = 0 ] && echo "OK" || echo "FAIL"
53 rotate(){
54 printf "Rotating ${NAME} logs: "
55 start-stop-daemon --stop -s 10 -p ${PIDFILE} 1>/dev/null
56 [ $? = 0 ] && echo "OK" || echo "FAIL"
59 case "$1" in
60 start)
61 start
63 stop)
64 stop
66 restart)
67 stop
68 start
70 reload)
71 reload
73 rotate)
74 rotate
77 echo "Usage: $0 {start|stop|restart|reload|rotate}"
78 exit 1
80 esac