Skip to content

Instantly share code, notes, and snippets.

@mricon
Created June 27, 2012 19:35
Show Gist options
  • Save mricon/3006290 to your computer and use it in GitHub Desktop.
Save mricon/3006290 to your computer and use it in GitHub Desktop.
#!/bin/bash
TIMESTORE="/var/lib/avc-audit-report.last-run"
TMPFILE=`mktemp /tmp/avc-audit-report.XXXXXXXXXX`
if [ -e "$TIMESTORE" ]; then
LASTRUN=`cat ${TIMESTORE}`
else
LASTRUN="yesterday"
fi
NOW="`date +'%D %T'`"
/sbin/ausearch --input-logs -ts $LASTRUN --raw | /usr/bin/audit2allow > $TMPFILE
if [ ! -z "`grep -v '^$' ${TMPFILE}`" ]; then
cat $TMPFILE | mail -s "$HOSTNAME avc report (`/usr/sbin/getenforce`)" mricon@kernel.org
fi
echo -n "$NOW" > $TIMESTORE
rm -f $TMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment