X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=6e21394cd84f58e99f4acd23a02bbf8b7bd23e55;hb=6459d4698ef983f7b1540589b87013c76913393d;hp=b97f3b929a5fd4f1f16105d9c8bcadf8c66951e5;hpb=0da09a2fa9c4ce921d5af5be8494c4a96cce43de;p=distro-setup diff --git a/mail-setup b/mail-setup index b97f3b9..6e21394 100755 --- a/mail-setup +++ b/mail-setup @@ -21,7 +21,7 @@ set -x set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@" +[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" if [[ ! $SUDO_USER ]]; then echo "$0: error: requires running as nonroot or sudo" exit 1 @@ -162,7 +162,7 @@ pi() { # package install if [[ ! -r $f ]] || (( $(( $(date +%s) - $(stat -c %Y $f ) )) > 60*60*12 )); then apt-get update fi - apt-get -y install --purge --auto-remove "$@" + DEBIAN_FRONTEND=noninteractive apt-get -y install --purge --auto-remove "$@" } postmaster=alerts @@ -177,6 +177,9 @@ forward=$u@$mxhost smarthost="$mxhost::$mxport" # exim +# light version of exim does not have sasl auth support. +pi exim4-daemon-heavy spamassassin spf-tools-perl + # trisquel 8 = openvpn, debian stretch = openvpn-client vpn_ser=openvpn-client if [[ ! -e /lib/systemd/system/openvpn-client@.service ]]; then @@ -194,7 +197,8 @@ else fi -pi openvpn +# light version of exim does not have sasl auth support. +pi exim4-daemon-heavy spamassassin spf-tools-perl openvpn dnsmasq if [[ -e /p/c/filesystem ]]; then # allow failure of these commands when our internet is down, they are likely not needed, @@ -345,7 +349,7 @@ cat >$f <<'EOF' set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -[[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@" +[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" f=/a/bin/bash_unpublished/source-state if [[ -e $f ]]; then @@ -398,11 +402,6 @@ systemctl start mailcert systemctl restart mailcert.timer systemctl enable mailcert.timer -# This symlink is only here to so I can use the -# fsf mailman ansible role and trick its cert script -# into doing nothing. -/a/exe/lnf -T /etc/exim4/exim.crt /etc/letsencrypt/live/$(hostname -f)/fullchain.pem - ##### end mailcert setup ##### # comon stuff @@ -699,7 +698,7 @@ EOF # it\'s not part of exim rm -f /etc/exim4/conf.d/main/000_localmacros cat >>/etc/exim4/update-exim4.conf.conf <$f <<'EOF' + cat >$f <<'EOFOUTER' #!/bin/bash -echo body_test | mail -s "primary_test $(date +%s) $(date +%Y-%m-%dT%H:%M:%S%z)" iank@posteo.de +/usr/sbin/exim -t </etc/cron.d/mailtest <&1 | /usr/local/bin/log-once send-test-forward -*/10 * * * * $u /usr/local/bin/mailtest-check 2>&1 | /usr/local/bin/log-once -1 send-test-forward +*/10 * * * * $u /usr/local/bin/mailtest-check 2>&1 | /usr/local/bin/log-once -1 mailtest-check */10 * * * * root chmod -R g+rw /m/md/bounces 2>&1 | /usr/local/bin/log-once -1 bounces-chmod EOF cp /a/bin/distro-setup/filesystem/usr/local/bin/mailtest-check /usr/local/bin