X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=bbe0defeb3f803a1cedf759c9b1e62f6c77389a0;hb=fde3746c622eb042ce1fd051cdfea2f9a247cd53;hp=36b0e9d6345334396ab4010b79a06f3b85bac9a0;hpb=fc2a33b827a7adede9cba7728e381820857189d5;p=distro-setup diff --git a/mail-setup b/mail-setup index 36b0e9d..bbe0def 100755 --- a/mail-setup +++ b/mail-setup @@ -3,6 +3,10 @@ # Copyright (C) 2019 Ian Kelling # SPDX-License-Identifier: AGPL-3.0-or-later +# todo: check new macro DKIM_TIMESTAMPS + +# todo: check if REMOTE_SMTP_INTERFACE or REMOTE_SMTP_TRANSPORTS_HEADERS_REMOVE can simplify my or fsfs config + # todo: max line length macro changed in t11. look into it # todo: check that all macros we use are still valid in t11 @@ -1174,7 +1178,9 @@ cd /etc/exim4 done } | i /etc/exim4/conf.d/my-dkim-domains -cat >/etc/exim4/conf.d/transport/11_iank <<'EOF' +if grep -Fq REMOTE_SMTP_SMARTHOST_TLS_VERIFY_HOSTS \ + /etc/exim4/conf.d/transport/10_exim4-config_transport-macros; then + cat >/etc/exim4/conf.d/transport/11_iank <<'EOF' # This unsets the default macro defined in on t11 in # /etc/exim4/conf.d/transport/10_exim4-config_transport-macros # It seems like a very odd choice that this has become @@ -1182,6 +1188,9 @@ cat >/etc/exim4/conf.d/transport/11_iank <<'EOF' # auth. Oh well. REMOTE_SMTP_SMARTHOST_TLS_VERIFY_HOSTS == EOF +else + rm -f /etc/exim4/conf.d/transport/11_iank +fi cat >/etc/exim4/conf.d/main/000_local <<'EOF' MAIN_TLS_ENABLE = true @@ -1217,16 +1226,6 @@ smtp_accept_queue_per_connection = 500 DKIM_CANON = relaxed DKIM_SELECTOR = li -# From comments in -# https://debian-administration.org/article/718/DKIM-signing_outgoing_mail_with_exim4 -# and its best for this to align https://tools.ietf.org/html/rfc7489#page-8 -# There could be some circumstance when the -# from: isnt our domain, but the envelope sender is -# and so still want to sign, but I cant think of any case. -#DKIM_DOMAIN = ${lc:${domain:$rh_from:}} -# In t11, we cant do the above anymore because this is tainted data used in a file lookup. -# /usr/share/doc/exim4/NEWS.Debian.gz suggests to use lookups to untaint data. -DKIM_DOMAIN = ${lookup {${domain:$rh_from:}}lsearch,ret=key{/etc/exim4/conf.d/my-dkim-domains}} # The file is based on the outgoing domain-name in the from-header. # sign if key exists @@ -1280,6 +1279,24 @@ smtp_reserve_hosts = +iank_trusted LOCAL_DENY_EXCEPTIONS_LOCAL_ACL_FILE = /etc/exim4/conf.d/local_deny_exceptions_acl EOF +if dpkg --compare-versions "$(dpkg-query -f='${Version}\n' --show exim4)" ge 4.94; then + cat >>/etc/exim4/conf.d/main/000_local <<'EOF' +# In t11, we cant do the old anymore because this is tainted data used in a file lookup. +# /usr/share/doc/exim4/NEWS.Debian.gz suggests to use lookups to untaint data. +DKIM_DOMAIN = ${lookup {${domain:$rh_from:}}lsearch,ret=key{/etc/exim4/conf.d/my-dkim-domains}} +EOF +else + cat >>/etc/exim4/conf.d/main/000_local <<'EOF' +# From comments in +# https://debian-administration.org/article/718/DKIM-signing_outgoing_mail_with_exim4 +# and its best for this to align https://tools.ietf.org/html/rfc7489#page-8 +# There could be some circumstance when the +# from: isnt our domain, but the envelope sender is +# and so still want to sign, but I cant think of any case. +DKIM_DOMAIN = ${lc:${domain:$rh_from:}} +EOF +fi + rm -fv /etc/exim4/rcpt_local_acl # old path i /etc/exim4/conf.d/local_deny_exceptions_acl <<'EOF' @@ -1335,6 +1352,207 @@ warn EOF + +# old file +rm -fv /etc/exim4/conf.d/router/880_backup_copy + + +# It is important for this to exist everywhere except in MAIL_HOST +# non-nn config. Previously, just had it in the nn-config on MAIL_HOST, +# but that is a problem if we change mail host and still have something +# in the queue which was destined for this router, but hosts were +# unreachable, the routers will be reevaluated on the next retry. +i /etc/exim4/conf.d/router/890_backup_copy <tmp.php <$myncdir/tmp.php <config.php - # leave in place for debugging - #m rm -f tmp.php - m sudo -u www-data php $ncdir/occ maintenance:update:htaccess + e running php $myncdir/tmp.php + # note: we leave it around place for debugging + php $myncdir/tmp.php >config.php + cd $ncdir + m sudo -u www-data php occ maintenance:update:htaccess list=$(sudo -u www-data php $ncdir/occ --output=json_pretty app:list) # user_external not compaible with nc 23 for app in contacts calendar; do if [[ $(printf "%s\n" "$list"| jq ".enabled.$app") == null ]]; then - m sudo -u www-data php $ncdir/occ app:install $app + cd $ncdir + m sudo -u www-data php occ app:install $app fi done i /etc/systemd/system/$ncbase.service <>/etc/myexim4/conf.d/main/000_local <<'EOF' # this makes it easier to see which exim is doing what log_file_path = /var/log/exim4/my%s @@ -3390,10 +3556,12 @@ EOF # Dont put these test messages into the sent folder or else it will # overwhelm it, plus i dont want to save a copy at all. - rm -f /etc/exim4/ignore-sent - for t in ${test_tos[@]}; do - echo $t >> /etc/exim4/ignore-sent - done + # Plus addresses we generally want to ignore. + i /etc/exim4/ignore-sent </usr/local/bin/send-test-forward <<'EOF' #!/bin/bash