X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=mail-setup;h=8283d7c07980a8cbc8d3ad416147103b2afdbe2b;hp=85bd17b78f6313541af26babbdde0a3d6f6eabb4;hb=3ca4714d6b02ff279a0c724415f3e0a3a6f49059;hpb=fa264ab2ec907b4ebc8d7dd0f8b239b0d0202362 diff --git a/mail-setup b/mail-setup index 85bd17b..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 @@ -1364,7 +1364,7 @@ rm -fv /etc/exim4/conf.d/router/8{8,9}0_backup_copy \ # 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 < @@ -2252,7 +2252,7 @@ if [[ $HOSTNAME == bk ]]; then mkdir -p $myncdir # copied from debians cronjob - i /etc/cron.d/$rcbase </dev/null @@ -2312,7 +2312,7 @@ EOF rctmpdir=/var/tmp/$rcbase rcdb=/m/rc/$rcbase.sqlite # config from mailinabox - i $rcdir/config/config.inc.php <>/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 @@ -3534,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 <