## * Install packages
# light version of exim does not have sasl auth support.
-pi exim4-daemon-heavy spamassassin spf-tools-perl openvpn dnsmasq
+pi exim4-daemon-heavy spamassassin spf-tools-perl openvpn
# trisquel 8 = openvpn, debian stretch = openvpn-client
vpn_ser=openvpn-client
/a/exe/cedit mail /etc/dnsmasq-servers.conf <<'EOF' || [[ $? == 1 ]]
server=/mail.iankelling.org/127.0.1.1
EOF
- systemctl reload dnsmasq
+ if systemctl is-active dnsmasq >/dev/null; then
+ systemctl reload dnsmasq
+ fi
# I used to use debconf-set-selections + dpkg-reconfigure,
# which then updates this file
# https://selivan.github.io/2017/12/30/systemd-serice-always-restart.html
- d=/etc/systemd/system/openvpn@mail
+ d=/etc/systemd/system/openvpn@mail.service.d
mkdir -p $d
cat >$d/override.conf <<'EOF'
[Service]
# StartLimitIntervalSec in recent systemd versions
StartLimitInterval=0
EOF
-
+ if ! systemctl cat openvpn@mail.service|grep -xF StartLimitInterval=0 &>/dev/null; then
+ # needed for the above config to go into effect
+ systemctl daemon-reexec
+ fi
systemctl enable mailclean.timer
systemctl enable dovecot
systemctl restart dovecot
-# * not MAIL_HOST
+ # * not MAIL_HOST
else # $HOSTNAME != $MAIL_HOST
# remove mail. 2 lines to properly remove whitespace
sed -ri -f - /etc/hosts <<'EOF'
EOF
echo | /a/exe/cedit mail /etc/dnsmasq-servers.conf || [[ $? == 1 ]]
- systemctl reload dnsmasq
+ if systemctl is-active dnsmasq >/dev/null; then
+ systemctl reload dnsmasq
+ fi
systemctl disable mailclean.timer &>/dev/null ||:
systemctl stop mailclean.timer &>/dev/null ||:
hostname -f > /etc/mailname
- # We set this to alerts on MAIL_HOST, but using a user that doesn't exist elsewhere
+ # This ends up at alerts mailbox on MAIL_HOST, but using a user that doesn't exist elsewhere
# is no good.
sed -i --follow-symlinks -f - /etc/aliases <<EOF
-\$a root:
+\$a root: root@mail.iankelling.org
/^root:/d
EOF
# * reload exim
-systemctl reload exim4
-systemctl start exim4
+if systemctl is-active exim4 >/dev/null; then
+ systemctl reload exim4
+else
+ systemctl start exim4
+fi
# * mail monitoring / testing