Hi Tiago, this mail contains the latest patch for apticron (which I consider the possibly final patch). It now includes a config option for the apticron.conf file that (by default) will enable the encryption feature. If you have further feature requests or want other changes, please don't hesitate to ask. I'll be glad to help!
Bests, Matthias PS: On https://gitlab.com/m007/encrypted-apticron exists a repository that is based on the official debian git repository where I do develop and test my patched apticron version. Instead of asking per mail you even could open up an issue there if you want further changes to the code. PPS: Have yourself a nice weekend
diff --git a/apticron b/apticron index f55071c..3f09857 100755 --- a/apticron +++ b/apticron @@ -4,15 +4,23 @@ # implementations in Debian. Make sure we send proper headers, and a # text/plain content type. Mailx() { + MAIL_BODY_FILE=$(tempfile) + cat > "$MAIL_BODY_FILE" + if [ x$GPG_ENCRYPT = "x1" ] && gpg --list-public-keys "$EMAIL" > /dev/null 2>&1; then + MAIL_ENC_FILE=$(tempfile) + gpg --trust-model always --batch --armor --encrypt --recipient "$EMAIL" < "$MAIL_BODY_FILE" > "$MAIL_ENC_FILE" + mv "$MAIL_ENC_FILE" "$MAIL_BODY_FILE" + fi + local MAILER="`readlink -e /usr/bin/mailx`" if [ x$MAILER = "x/usr/bin/heirloom-mailx" -o x$MAILER = "x/usr/bin/s-nail" ] then # heirloom-mailx creates correct headers, but needs help # if the terminal charset (LC_CTYPE) is no UTF-8 locale if [ -n "$CUSTOM_FROM" ] ; then - /usr/bin/mailx -S ttycharset=utf-8 -r "$CUSTOM_FROM" "$@" + /usr/bin/mailx -S ttycharset=utf-8 -r "$CUSTOM_FROM" "$@" < "$MAIL_BODY_FILE" else - /usr/bin/mailx -S ttycharset=utf-8 "$@" + /usr/bin/mailx -S ttycharset=utf-8 "$@" < "$MAIL_BODY_FILE" fi else # bsd-mailx/mailutils' mailx don't do character set @@ -22,14 +30,15 @@ Mailx() { -a "Content-type: text/plain; charset=UTF-8" \ -a "Content-transfer-encoding: 8bit" \ -a "From: $CUSTOM_FROM" \ - "$@" + "$@" < "$MAIL_BODY_FILE" else /usr/bin/mailx -a "MIME-Version: 1.0" \ -a "Content-type: text/plain; charset=UTF-8" \ -a "Content-transfer-encoding: 8bit" \ - "$@" + "$@" < "$MAIL_BODY_FILE" fi fi + rm "$MAIL_BODY_FILE" } if [ "x$1" = "x--cron" ] ; then diff --git a/apticron.conf b/apticron.conf index dd6a7de..f503cd5 100644 --- a/apticron.conf +++ b/apticron.conf @@ -122,3 +122,10 @@ NOTIFY_NO_UPDATES="0" # 'From:' field used in the notification e-mails. # # CUSTOM_FROM="" + +# +# Set GPG_ENCRYPT="0" if you do not want to encrypt the mail being send to +# $EMAIL. apticron will use gpg and the public key of the recipient to encrypt +# the mail. +# +GPG_ENCRYPT="1"
signature.asc
Description: OpenPGP digital signature