fix the case of duplicated sent archive recipients
[distro-setup] / mail-setup
index c40c56c0b6eab97923f57686a5c617eaed7040ca..bbe0defeb3f803a1cedf759c9b1e62f6c77389a0 100755 (executable)
@@ -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
 
@@ -1348,11 +1352,16 @@ warn
 
 EOF
 
-# It is important for this to exist universally, instead of
-# just on the mail host because 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.
+
+# 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 <<EOF
 ### router/900_exim4-config_local_user
 #################################
@@ -1725,7 +1734,7 @@ if mailhost; then
   # in the log it just says "Starting Radicale". If you run
   # it in the foreground, it will give more info. Background
   # plus debug does not help.
-  # sudo -u radicale radicale -D -f
+  # sudo -u radicale radicale -D
 
   # created password file with:
   # htpasswd -c /p/c/machine_specific/li/filesystem/etc/caldav-htpasswd
@@ -2926,7 +2935,7 @@ EOF
     # which required using a dedicated user, but realized smtp will be
     # more reliable and less fuss. If I ever need that again, see the
     # history of this file, and bum in brc2.
-    i /etc/exim4/conf.d/router/890_backup_copy <<EOF
+    i /etc/exim4/conf.d/router/865_backup_redir <<EOF
 backup_redir:
 driver = redirect
 domains = +local_domains
@@ -3128,7 +3137,7 @@ EOF
     echo|i /etc/exim4/conf.d/router/188_exim4-config_smarthost
     echo|i /etc/exim4/conf.d/router/190_exim4-config_fsfsmarthost
     echo|i /etc/exim4/conf.d/rcpt_local_acl
-    echo|i /etc/exim4/conf.d/router/890_backup_copy
+    echo|i /etc/exim4/conf.d/router/865_backup_redir
     echo|i /etc/exim4/conf.d/main/000_local-nn
     echo|i /etc/exim4/conf.d/clamav_data_acl
 
@@ -3244,8 +3253,9 @@ esac
 # ** $MAILHOST|bk, things that belong at the end
 case $HOSTNAME in
   $MAIL_HOST|bk)
-    # config for the non-nn exim
-    m rsync -ra --delete --delete-excluded --exclude=/conf.d/main/000_local-nn /etc/exim4/ /etc/myexim4
+    # config for the non-nn exim. note, it uses not default dir, but we
+    # generate that into the default config file
+    m rsync -ra --delete --delete-excluded --exclude=/conf.d/main/000_local-nn --exclude=/conf.d/router/890_backup_copy /etc/exim4/ /etc/myexim4
     cat >>/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
@@ -3546,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 <<EOF
+$(printf "%s\n" ${test_tos[@]})
+vojdedIdNejyebni@b8.nz
+b@eximbackup.b8.nz
+EOF
 
     cat >/usr/local/bin/send-test-forward <<'EOF'
 #!/bin/bash