Blame contrib/gpg_check.sh
|
Packit |
762fc5 |
#!/bin/bash
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# $Id$
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# aide check script
|
|
Packit |
762fc5 |
# Written by: charlie heselton
|
|
Packit |
762fc5 |
# Email: echo "hfouvyAdpy/ofu" | perl -pe 's/(.)/chr(ord($1)-1)/ge'
|
|
Packit |
762fc5 |
# 09/23/2005
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# Set up some variables
|
|
Packit |
762fc5 |
DBDIR="/your/aide/db/directory"
|
|
Packit |
762fc5 |
DBFILE="${DBDIR}/aide.db"
|
|
Packit |
762fc5 |
ENC_DBFILE="${DBDIR}/aide.db.gpg"
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# make the assumption that the database exists and is encrypted
|
|
Packit |
762fc5 |
# but test for it ;-)
|
|
Packit |
762fc5 |
[[ -f ${ENC_DBFILE} ]] && /usr/bin/gpg --batch -d ${ENC_DBFILE} > ${DBFILE}
|
|
Packit |
762fc5 |
rm -f ${ENC_DBFILE}
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# (for now, we'll assume that encrypting the file includes an integrity check )
|
|
Packit |
762fc5 |
# Run the check.
|
|
Packit |
762fc5 |
/usr/bin/aide -C > /tmp/aide_check.out 2>&1
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# mail out the results
|
|
Packit |
762fc5 |
/usr/bin/cat /tmp/aide_check.out | /usr/bin/mutt -s "AIDE Check for `date`" your_valid_email@somewhere.com
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# cleanup
|
|
Packit |
762fc5 |
# if the mail was successful, delete the output file
|
|
Packit |
762fc5 |
if [ $? -eq 0 ]
|
|
Packit |
762fc5 |
then
|
|
Packit |
762fc5 |
rm -f /tmp/aide_check.out
|
|
Packit |
762fc5 |
fi
|
|
Packit |
762fc5 |
|
|
Packit |
762fc5 |
# re-encrypt the database and delete the unencrypted version
|
|
Packit |
762fc5 |
/usr/bin/gpg --batch -se -r gentoo_root ${DBFILE}
|
|
Packit |
762fc5 |
rm -f ${DBFILE}
|