Skip to content

Instantly share code, notes, and snippets.

@seraphyn
Created Dec 31, 2015
Embed
What would you like to do?
Encrypt Logwatch with gpg
#!/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