Skip to content

Instantly share code, notes, and snippets.

@seraphyn
Created December 31, 2015 17:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seraphyn/fd027d3710ed3ceea303 to your computer and use it in GitHub Desktop.
Save seraphyn/fd027d3710ed3ceea303 to your computer and use it in GitHub Desktop.
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