Created
November 23, 2017 00:41
-
-
Save mcgrof/5b7e3fa4d6c9a5f176958f43c58b1711 to your computer and use it in GitHub Desktop.
/opt/bin/mail2pgp.sh
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 | |
#hook ${sender} ${size} ${recipient} | |
LOG="/tmp/mail2pgp.log" | |
FROM=$1 | |
SIZE=$2 | |
TO=$3 | |
PGP_KEY="F8FE7407" | |
FORWARD="" | |
echo ----------------------------- >> $LOG | |
date >> $LOG | |
echo "From: $FROM" >> $LOG | |
echo "Size: $SIZE" >> $LOG | |
echo "To: $TO" >> $LOG | |
case $TO in | |
"mcgrof@encrypted.ninja") | |
PGP_KEY="58254BAC" | |
FORWARD="mcgrof@suse.com" | |
PGP_KEY="047A60A0" | |
FORWARD="mcgrof@do-not-panic.com" | |
;; | |
*) | |
exit | |
;; | |
esac | |
cat - | procmail -m PGP_KEY=$PGP_KEY FWD_TO=$FORWARD /opt/mail2pgp/.procmailrc | |
echo "Exit status from procmail: $?" >> $LOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment