iankelling.org
/
git
/
distro-setup
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor fix
[distro-setup]
/
mail-setup
diff --git
a/mail-setup
b/mail-setup
index 87f644aba3982160248c7ccf0345e19bd455891a..b28bedf004b895d497ccb3c98c2f61f602947fab 100755
(executable)
--- a/
mail-setup
+++ b/
mail-setup
@@
-168,7
+168,7
@@
smarthost="$mxhost::$mxport"
## * Install packages
# light version of exim does not have sasl auth support.
## * 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
# trisquel 8 = openvpn, debian stretch = openvpn-client
vpn_ser=openvpn-client
@@
-624,7
+624,9
@@
EOF
/a/exe/cedit mail /etc/dnsmasq-servers.conf <<'EOF' || [[ $? == 1 ]]
server=/mail.iankelling.org/127.0.1.1
EOF
/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
# I used to use debconf-set-selections + dpkg-reconfigure,
# which then updates this file
@@
-743,7
+745,7
@@
EOF
# https://selivan.github.io/2017/12/30/systemd-serice-always-restart.html
# 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]
mkdir -p $d
cat >$d/override.conf <<'EOF'
[Service]
@@
-755,7
+757,10
@@
RestartSec=1
# StartLimitIntervalSec in recent systemd versions
StartLimitInterval=0
EOF
# 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 mailclean.timer
@@
-765,7
+770,7
@@
EOF
systemctl enable dovecot
systemctl restart dovecot
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'
else # $HOSTNAME != $MAIL_HOST
# remove mail. 2 lines to properly remove whitespace
sed -ri -f - /etc/hosts <<'EOF'
@@
-774,7
+779,9
@@
s#^(127\.0\.1\.1 .*)mail\.iankelling\.org +(.*)#\1\2#
EOF
echo | /a/exe/cedit mail /etc/dnsmasq-servers.conf || [[ $? == 1 ]]
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 ||:
systemctl disable mailclean.timer &>/dev/null ||:
systemctl stop mailclean.timer &>/dev/null ||:
@@
-799,10
+806,10
@@
EOF
hostname -f > /etc/mailname
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
# is no good.
sed -i --follow-symlinks -f - /etc/aliases <<EOF
-\$a root:
+\$a root:
root@mail.iankelling.org
/^root:/d
EOF
/^root:/d
EOF
@@
-870,8
+877,11
@@
fi
# * reload exim
# * 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
# * mail monitoring / testing