X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=9bc36dc3d2344ded9374fc29b0d7bf766a828999;hb=460cc07230c2040305068f17a687e06c7bc13dfe;hp=db75252b4f2eaae59b3754e4760929b4ee12a292;hpb=d454ba0f3f94d45af71e5a1e72a1bbcb63211645;p=distro-setup diff --git a/mail-setup b/mail-setup index db75252..9bc36dc 100755 --- a/mail-setup +++ b/mail-setup @@ -182,7 +182,7 @@ if [[ ! -e /lib/systemd/system/openvpn-client@.service ]]; then vpn_ser=openvpn fi -if [[ $HOSTNAME == $MAIL_HOST ]]; then +if [[ $HOSTNAME == "$MAIL_HOST" ]]; then # afaik, these will get ignored because they are routing to my own # machine, but rm them is safer rm -f $(eval echo ~$u)/.forward /root/.forward @@ -317,6 +317,7 @@ EOF cat >/etc/exim4/host_local_deny_exceptions <<'EOF' mail.fsf.org +*.posteo.de EOF cat >/etc/exim4/conf.d/router/190_exim4-config_fsfsmarthost <<'EOF' @@ -348,7 +349,7 @@ f=/a/bin/bash_unpublished/source-state if [[ -e $f ]]; then source $f fi -if [[ $HOSTNAME == $MAIL_HOST ]]; then +if [[ $HOSTNAME == "$MAIL_HOST" ]]; then local_mx=mail.iankelling.org rsync_common="rsync -ogtL --chown=root:Debian-exim --chmod=640 root@li.iankelling.org:/etc/letsencrypt/live/$local_mx/" ${rsync_common}fullchain.pem /etc/exim4/exim.crt @@ -409,7 +410,7 @@ dc_mailname_in_oh='true' EOF -if [[ $HOSTNAME == $MAIL_HOST ]]; then +if [[ $HOSTNAME == "$MAIL_HOST" ]]; then # mail.iankelling.org so local imap clients can connect with tls and # when they happen to not be local. @@ -547,6 +548,10 @@ wget -nv -N https://publicsuffix.org/list/public_suffix_list.dat EOF chmod 755 $f + sed -i --follow-symlinks -f - /etc/aliases </etc/dovecot/local.conf <<'EOF' + cat >/etc/dovecot/local.conf <>/etc/exim4/update-exim4.conf.conf < /etc/mailname + # We set this to alerts on MAIL_HOST, but using a user that doesn't exist elsewhere + # is no good. + sed -i --follow-symlinks -f - /etc/aliases </dev/null; then - usermod -a -G Debian-exim 1000 -fi -if [[ -e /m/md ]]; then - ln -s /Maildir /m/md/bounces -fi +# local mail that bounces goes to /Maildir or /root/Maildir +dirs=(/m/md/bounces/{cur,tmp,new}) +mkdir -p ${dirs[@]} +chown -R $u:Debian-exim /m/md/bounces +chmod 775 ${dirs[@]} +usermod -a -G Debian-exim $u +for d in /Maildir /root/Maildir; do + if [[ ! -L $d ]]; then + rm -rf $d + fi + ln -sf -T /m/md/bounces $d +done # put spool dir in directory that spans multiple distros. # based on http://www.postfix.org/qmgr.8.html and my notes in gnus @@ -865,10 +879,20 @@ systemctl restart exim4 systemctl enable exim4 -if [[ $HOSTNAME == $MAIL_HOST ]]; then - cat >/etc/cron.d/mailtest <<'EOF' -*/10 * * * * iank echo body_test | mail -s "primary_test $(date +%s) $(date +%Y-%m-%dT%H:%M:%S%z)" iank@posteo.de -2/10 * * * * root /usr/local/bin/mailtest-check +if [[ $HOSTNAME == "$MAIL_HOST" ]]; then + f=/usr/local/bin/send-test-forward + cat >$f <<'EOF' +#!/bin/bash +echo body_test | mail -s "primary_test $(date +%s) $(date +%Y-%m-%dT%H:%M:%S%z)" iank@posteo.de +EOF + chmod +x $f + + cat >/etc/cron.d/mailtest </dev/null; then - if [[ $HOSTNAME == $MAIL_HOST ]]; then + if [[ $HOSTNAME == "$MAIL_HOST" ]]; then systemctl restart radicale systemctl enable radicale if [[ -e /etc/logrotate.d/radicale.disabled ]]; then