Created
June 17, 2015 14:23
-
-
Save jeffgeiger/98b34c59bb49619da82f to your computer and use it in GitHub Desktop.
AIDE Daily Change Report
This file contains hidden or 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 | |
/usr/sbin/aide --check 2>&1 | tee /tmp/aide-daily.out | /bin/grep "Looks okay" > /dev/null | |
if [[ $? -ne 0 ]]; then | |
LOGDATE=$(date +%s) | |
cat /tmp/aide-daily.out > /tmp/aide_mail.$LOGDATE | |
echo -e "\n\n=============\nLOGIN INFO\n=============\n" >> /tmp/aide_mail.$LOGDATE | |
/bin/last -ax -n 25 >> /tmp/aide_mail.$LOGDATE | |
cat /tmp/aide_mail.$LOGDATE | mail -s "[ALERT] $(hostname -f) AIDE report" [email protected] | |
mv /tmp/aide-daily.out /tmp/aide-daily.out.$LOGDATE | |
rm -f /tmp/aide_mail.$LOGDATE | |
echo "Daily AIDE check had issues!!!" | logger -p crit | |
else | |
echo "Daily AIDE check was good." | logger -p info | |
rm -f /tmp/aide-daily.out | |
fi | |
/bin/chattr -i /var/lib/aide/aide.db.gz | |
/usr/sbin/aide --update | |
/bin/cp -f /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz | |
/bin/chattr +i /var/lib/aide/aide.db.gz | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment