X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=mail-setup;h=e7020d74361301bf5c7b3d82f109b367014fa6cf;hb=5cb8fc0c2a8a3f9ffa3cb4d376075c1217eb6d8c;hp=f17b3afe81d5b79f2e203f6b0a92116e0dc630ae;hpb=d6def754cd241538c61456536b52ee51cbd85b42;p=distro-setup diff --git a/mail-setup b/mail-setup index f17b3af..e7020d7 100755 --- a/mail-setup +++ b/mail-setup @@ -3,6 +3,22 @@ # Copyright (C) 2019 Ian Kelling # SPDX-License-Identifier: AGPL-3.0-or-later +# Things I tend to forget. on MAIL_HOST, daemon runs with /etc/exim4/my.conf, +# due to /etc/default/exim4 containing: +# COMMONOPTIONS='-C /etc/exim4/my.conf' +# UPEX4OPTS='-o /etc/exim4/my.conf' +# +# The non-daemon config +# gets generated from this script calling update-exim4.conf -d /etc/myexim4 +# which has log path +# log_file_path = /var/log/exim4/my%s +# +# eximbackup folder is /bu/md +# it is cleaned up by mail-backup-clean, which is run by btrbk-run + +# shellcheck disable=SC2254 # makes for a lot of unneeded quotes + + # perusing through /el/mainlog without test messages: # &!testignore|jtuttle| # @@ -3326,7 +3342,6 @@ sentarchive: unseen EOF - u /etc/myexim4/conf.d/router/160_backup_redir <<'EOF' backup_redir: driver = redirect @@ -3343,8 +3358,6 @@ unseen = true errors_to = alerts@iankelling.org EOF - - # for bk, we have a exim4in.service that will do this for us. m update-exim4.conf -d /etc/myexim4 ;; @@ -3422,14 +3435,20 @@ if $reload; then m systemctl daemon-reload fi -# checking bhost_t is redundant, but could help us catch errors. -if $bhost_t || [[ -e /etc/wireguard/wghole.conf ]]; then - # todo: in mail-setup, we have a static list of backup hosts, not *y - m systemctl --now enable wg-quick@wghole +# optimization, this only needs to run once. +if [[ ! -e /sys/class/net/wghole ]]; then + # checking bhost_t is redundant, but could help us catch errors. + if $bhost_t || [[ -e /etc/wireguard/wghole.conf ]]; then + # todo: in mail-setup, we have a static list of backup hosts, not *y + m systemctl --now enable wg-quick@wghole + fi fi -sysd-prom-fail-install epanicclean -m systemctl --now enable epanicclean +# optimization, this only needs to be run once +if [[ ! -e /var/lib/prometheus/node-exporter/exim_paniclog.prom ]]; then + sysd-prom-fail-install epanicclean + m systemctl --now enable epanicclean +fi case $HOSTNAME in je) @@ -3440,8 +3459,11 @@ case $HOSTNAME in ;; esac -m /a/bin/ds/mail-cert-cron -1 -sre mailcert.timer +# optimization, this only needs to run once. +if [[ ! -e /etc/exim4/fullchain.pem ]]; then + m /a/bin/ds/mail-cert-cron -1 + m systemctl --now enable mailcert.timer +fi case $HOSTNAME in $MAIL_HOST|bk)