X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=8283d7c07980a8cbc8d3ad416147103b2afdbe2b;hb=ad6ea16ea6f2a8676527257fb6afb659f2cee475;hp=4619b2e2c8ed0db1977f0b84434f4c29837f91a8;hpb=110b15e4a7b19cc520d2aa3f2584f4213b94f5b7;p=distro-setup diff --git a/mail-setup b/mail-setup index 4619b2e..8283d7c 100755 --- a/mail-setup +++ b/mail-setup @@ -292,7 +292,7 @@ reload=false if [[ -e /var/local/mail-setup-reload ]]; then reload=true fi -i() { # install file +u() { # update file. note: duplicated in brc local tmp tmpdir dest="$1" local base="${dest##*/}" local dir="${dest%/*}" @@ -300,13 +300,13 @@ i() { # install file # dest has a directory component mkdir -p "$dir" fi - ir=false # i result + ur=false # u result tmpdir=$(mktemp -d) cat >$tmpdir/"$base" tmp=$(rsync -ic $tmpdir/"$base" "$dest") if [[ $tmp ]]; then printf "%s\n" "$tmp" - ir=true + ur=true if [[ $dest == /etc/systemd/system/* ]]; then touch /var/local/mail-setup-reload reload=true @@ -432,7 +432,7 @@ fi # * Mail clean cronjob -i /etc/systemd/system/mailclean.timer <<'EOF' +u /etc/systemd/system/mailclean.timer <<'EOF' [Unit] Description=Run mailclean daily @@ -443,7 +443,7 @@ OnCalendar=monthly WantedBy=timers.target EOF -i /etc/systemd/system/mailclean.service < EOF -i /etc/fail2ban/jail.d/exim.local <<'EOF' +u /etc/fail2ban/jail.d/exim.local <<'EOF' [exim] enabled = true port = 25,587 @@ -1030,7 +1030,7 @@ banaction = iptables-exim # 10.173.8.1 = non-nn net ignoreip = 209.51.188.13 2001:470:142::13 209.51.188.92 2001:470:142:3::10 72.14.176.105 2600:3c00:e000:280::2 10.173.8.1 EOF -if $ir; then +if $ur; then m systemctl restart fail2ban fi @@ -1300,7 +1300,7 @@ fi rm -fv /etc/exim4/rcpt_local_acl # old path -i /etc/exim4/conf.d/local_deny_exceptions_acl <<'EOF' +u /etc/exim4/conf.d/local_deny_exceptions_acl <<'EOF' # This acl already exists in rcpt, this just makes it more widespread. # See the comment there for its rationale. The reason it needs to be # more widespread is that I've turned on sender verification, but cron @@ -1317,7 +1317,7 @@ EOF rm -fv /etc/exim4/data_local_acl # old path -i /etc/exim4/conf.d/data_local_acl <<'EOF' +u /etc/exim4/conf.d/data_local_acl <<'EOF' # Except for the "condition =", this was # a comment in the check_data acl. The comment about this not # being suitable has been changed in newer exim versions. The only thing @@ -1355,14 +1355,16 @@ EOF # old file -rm -fv /etc/exim4/conf.d/router/8{8,9}0_backup_copy /etc/exim4/conf.d/router/865_backup_redir +rm -fv /etc/exim4/conf.d/router/8{8,9}0_backup_copy \ + /etc/exim4/conf.d/router/865_backup_redir \ + /etc/exim4/conf.d/router/870_backup_local # 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/170_backup_copy < @@ -2250,7 +2252,7 @@ if [[ $HOSTNAME == bk ]]; then mkdir -p $myncdir # copied from debians cronjob - i /etc/cron.d/$rcbase </dev/null @@ -2310,7 +2312,7 @@ EOF rctmpdir=/var/tmp/$rcbase rcdb=/m/rc/$rcbase.sqlite # config from mailinabox - i $rcdir/config/config.inc.php <>/etc/exim4/update-exim4.conf.conf <>/etc/fstab fi - i /etc/systemd/system/exim4.service.d/override.conf <<'EOF' + u /etc/systemd/system/exim4.service.d/override.conf <<'EOF' [Unit] # without local-fs on exim, we get these kind of errors in paniclog on shutdown: # Failed to create spool file /var/spool/exim4//input//1jCLxz-0008V4-V9-D: Permission denied @@ -3527,7 +3534,7 @@ case $HOSTNAME in # note: cronjob "ian" also does some important monitoring # todo: this will sometimes cause an alert because mailtest-check will run # before we have setup network namespace and spamassassin - i /etc/cron.d/mailtest <