Created
December 31, 2015 17:53
-
-
Save seraphyn/fd027d3710ed3ceea303 to your computer and use it in GitHub Desktop.
Encrypt Logwatch with gpg
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 | |
recipient_email="" | |
recipient_gpg_pub_key="" | |
sender_gpg_pub_key="" | |
file="$(mktemp)" | |
test -x /usr/share/logwatch/scripts/logwatch.pl || exit 0 | |
/usr/sbin/logwatch --detail high > $file | |
test -s $file || exit 1 | |
gpg --recipient $sender_gpg_pub_key --recipient $recipient_gpg_pub_key --armor --encrypt $file | |
mail $recipient_email -s "Encrypted $HOSTNAME logwatch for $(date +%d-%b-%Y)" < "$file".asc | |
rm $file && rm $file.asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment