Created
August 18, 2013 04:43
-
-
Save kaorimatz/6259925 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DBUS_WATCH_EXPR="\ | |
type='signal',\ | |
sender='org.fedoraproject.Setroubleshootd',\ | |
interface='org.fedoraproject.SetroubleshootdIface',\ | |
member='alert'\ | |
" | |
dbus-monitor --system --monitor "$DBUS_WATCH_EXPR" | while read LINE | |
do | |
case $LINE in | |
*Setroubleshootd*) | |
read _TYPE ALERT_LEVEL | |
read _TYPE LOCAL_ID | |
if test "$ALERT_LEVEL" = '"red"' | |
then | |
URGENCY_LEVEL='critical' | |
else | |
URGENCY_LEVEL='normal' | |
fi | |
LOCAL_ID=`echo $LOCAL_ID | sed -e 's/^"//' -e 's/"$//'` | |
ALERT_MSG=`sealert -l $LOCAL_ID | head -n 1` | |
notify-send 'SELinux security alert' "$ALERT_MSG" --urgency=$URGENCY_LEVEL | |
;; | |
*) | |
continue | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment