Package: apticron Version: 1.1.61 Severity: wishlist Tags: patch Dear Tiago,
as this is my first time sending a bug report I hope to do this the right way. As requested in your last mail I file this bug report. As you might remember the feature idea for apticron was to send the mails encrypted. I'll try to append the patch file. Best wishes, Matthias -- System Information: Debian Release: 9.1 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages apticron depends on: ii apt 1.4.7 ii bzip2 1.0.6-8.1 ii cron [cron-daemon] 3.0pl1-128+b1 ii debconf [debconf-2.0] 1.5.61 ii dpkg 1.18.24 ii mailutils [mailx] 1:3.1.1-1 ii ucf 3.0036 Versions of packages apticron recommends: ii apt-listchanges 3.10 ii iproute2 4.9.0-1 apticron suggests no packages. -- debconf information excluded
diff --git a/apticron b/apticron index 3edbca5..49c6df4 100755 --- a/apticron +++ b/apticron @@ -4,27 +4,41 @@ # implementations in Debian. Make sure we send proper headers, and a # text/plain content type. Mailx() { + # The statement msg="$(xargs --null echo)" will fail if the generated message + # is very long with xargs: argument line too long. + msg="$(xargs --null echo)" + if which gpg > /dev/null ; then + msg=$(echo "$msg" | gpg --trust-model always --batch --armor --encrypt --recipient $EMAIL --sign --passphrase $GPG_PASS_PHRASE) + if [ -z "$msg" ]; then + echo "GnuPG error. Could not encrypt message for $EMAIL. Exiting here." + exit 1 + fi + else + echo "GnuPG not installed. Exiting here." + exit 1 + 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" "$@" + echo "$msg" | /usr/bin/mailx -S ttycharset=utf-8 -r "$CUSTOM_FROM" "$@" else - /usr/bin/mailx -S ttycharset=utf-8 "$@" + echo "$msg" | /usr/bin/mailx -S ttycharset=utf-8 "$@" fi else # bsd-mailx/mailutils' mailx don't do character set # conversion, but do not support MIME either. if [ -n "$CUSTOM_FROM" ] ; then - /usr/bin/mailx -a "MIME-Version: 1.0" \ + echo "$msg" | /usr/bin/mailx -a "MIME-Version: 1.0" \ -a "Content-type: text/plain; charset=UTF-8" \ -a "Content-transfer-encoding: 8bit" \ -a "From: $CUSTOM_FROM" \ "$@" else - /usr/bin/mailx -a "MIME-Version: 1.0" \ + echo "$msg" | /usr/bin/mailx -a "MIME-Version: 1.0" \ -a "Content-type: text/plain; charset=UTF-8" \ -a "Content-transfer-encoding: 8bit" \ "$@"