-
-
Save heywoodlh/76c131570910a1b81327510fb6ae3e50 to your computer and use it in GitHub Desktop.
Script to run lynis and notify you if something needs attention
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/sh | |
#set -x | |
[email protected] | |
. /etc/apache2/envvars | |
/usr/sbin/lynis -c -Q -q --profile /etc/lynis/default.prf | |
# Check to ensure we're still at 100% | |
grep -q 'Hardening index : \[100\]' /var/log/lynis.log | |
if [ $? != 0 ]; then | |
/usr/sbin/lynis --check-update --no-colors | mutt -s 'lynis report' $EMAIL -a /var/log/lynis.log | |
fi | |
# notify if there's an update available | |
./lynis --check-update > /tmp/lynis.check | |
if [ $? != 0 ]; then | |
/usr/sbin/lynis --check-update --no-colors | mutt -s 'lynis update available' $EMAIL | |
fi | |
rm /tmp/lynis.check | |
# remove the turd made by mutt | |
if [ -f ~/sent ]; then | |
rm ~/sent | |
fi | |
# End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment