Blame contrib/gpg_update.sh

Packit 762fc5
#!/bin/bash
Packit 762fc5
Packit 762fc5
# $Id$
Packit 762fc5
Packit 762fc5
# aide update 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
DBDIR="/etc/aide/db"
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 update.  
Packit 762fc5
/usr/bin/aide --update > /tmp/aide_update.out 2>&1
Packit 762fc5
Packit 762fc5
# mail out the results
Packit 762fc5
# set the "Reply-to" address
Packit 762fc5
REPLYTO="root@charlesheselton.no-ip.org"
Packit 762fc5
export REPLYTO
Packit 762fc5
# send the mail
Packit 762fc5
/usr/bin/cat /tmp/aide_update.out | /usr/bin/mutt -s "AIDE Update for `date`" your_valid_email@somewhere.com
Packit 762fc5
Packit 762fc5
# cleanup
Packit 762fc5
# if the mailing was successful then delete the output file
Packit 762fc5
if [ $? -eq 0 ]
Packit 762fc5
then
Packit 762fc5
	rm -f /tmp/aide_update.out
Packit 762fc5
fi
Packit 762fc5
Packit 762fc5
# move the aide.db.new file to the aide.db
Packit 762fc5
mv ${DBDIR}/aide.db.new ${DBFILE}
Packit 762fc5
Packit 762fc5
# encrypt the new db file and remove the unencrypted version
Packit 762fc5
/usr/bin/gpg --batch -se -r gentoo_root ${DBFILE}
Packit 762fc5
rm -f ${DBFILE}