diff --git a/debian/ai-auditd.init b/debian/ai-auditd.init index 169860e96ce28b0976990097eabb898db9d62ac4..b67d6b50d662b3b6c7e0ed425b4254a79271a661 100644 --- a/debian/ai-auditd.init +++ b/debian/ai-auditd.init @@ -18,6 +18,7 @@ DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME +USER=ai-auditd # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -42,9 +43,9 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --chuid $USER --exec $DAEMON --test > /dev/null \ || return 1 - start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \ + start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --chuid $USER --exec $DAEMON -- \ $DAEMON_ARGS \ || return 2 # Add code here, if necessary, that waits for the process to be ready @@ -62,7 +63,7 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $USER --name $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks @@ -71,8 +72,8 @@ do_stop() # that waits for the process to drop all resources that could be # needed by services started subsequently. A last resort is to # sleep for some time. - start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON - [ "$?" = 2 ] && return 2 + #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + #[ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return "$RETVAL" diff --git a/debian/ai-auditd.postinst b/debian/ai-auditd.postinst new file mode 100644 index 0000000000000000000000000000000000000000..e5ae6a612d6a58180efdfca8aa63b6119ba907da --- /dev/null +++ b/debian/ai-auditd.postinst @@ -0,0 +1,31 @@ +#!/bin/sh +# postinstall script for ai-audit. + +case "$1" in +configure) + + if ! getent user ai-auditd >/dev/null; then + adduser --system --home /var/lib/auditd --no-create-home \ + --disabled-password ai-auditd + fi + + mkdir -p /var/lib/auditd + chown -R ai-auditd:root /var/lib/auditd + chmod 0700 /var/lib/auditd + + ;; +abort-upgrade|abort-remove|abort-deconfigure) + ;; +*) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/debian/localauditd.postinst b/debian/localauditd.postinst old mode 100755 new mode 100644 index e7a9ca5b0abf19a818296ddb5349f930592ef005..4c93a65c3504a809db5a89a4af286ee14ea8b61f --- a/debian/localauditd.postinst +++ b/debian/localauditd.postinst @@ -10,7 +10,7 @@ configure) if ! getent user localaudit >/dev/null; then adduser --system --home /var/spool/audit --no-create-home \ - --ingroup audit localaudit + --disabled-password --ingroup audit localaudit fi mkdir -p /var/spool/audit/incoming