X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=b97f3b929a5fd4f1f16105d9c8bcadf8c66951e5;hb=77616920035e0e7c64d54b447df397822dc4370c;hp=b79fd8483fa44fd6a0ae9d0bbf56f05ee2d85389;hpb=f31ab4e29572ea4948f292bee814bc23061e992a;p=distro-setup diff --git a/mail-setup b/mail-setup index b79fd84..b97f3b9 100755 --- a/mail-setup +++ b/mail-setup @@ -15,7 +15,8 @@ set -x # See the License for the specific language governing permissions and # limitations under the License. -# todo: make quick backups of maildir, or deliver to multiple hosts. +# TODO: copy dkim keys from within this file. its now done in conflink. +# TODO: fix dkim key to b chmod 640, group Debian-exim set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -340,6 +341,7 @@ EOF #### begin mail cert setup ### f=/usr/local/bin/mail-cert-cron cat >$f <<'EOF' +#!/bin/bash set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -396,6 +398,11 @@ systemctl start mailcert systemctl restart mailcert.timer systemctl enable mailcert.timer +# This symlink is only here to so I can use the +# fsf mailman ansible role and trick its cert script +# into doing nothing. +/a/exe/lnf -T /etc/exim4/exim.crt /etc/letsencrypt/live/$(hostname -f)/fullchain.pem + ##### end mailcert setup ##### # comon stuff @@ -544,7 +551,7 @@ EOF cat >$f <<'EOF' #!/bin/bash cd /etc -wget -nv -N https://publicsuffix.org/list/public_suffix_list.dat +wget -q -N https://publicsuffix.org/list/public_suffix_list.dat EOF chmod 755 $f @@ -566,6 +573,9 @@ EOF # internet. I was torn about whether to do this or not, meh. pi dovecot-core dovecot-imapd dovecot-sieve dovecot-lmtpd + for f in /p/c/subdir_files/sieve/*sieve /a/c/subdir_files/sieve/*sieve; do + sudo -u $u /a/exe/lnf -T $f $(eval echo ~$u)/sieve/${f##*/} + done # if we changed 90-sieve.conf and removed the active part of the # sieve option, we wouldn\'t need this, but I\'d rather not modify a # default config if not needed. This won\'t work as a symlink in /a/c @@ -837,6 +847,8 @@ for d in /Maildir /root/Maildir; do ln -sf -T /m/md/bounces $d done +sudo -u $u ln -sf -T /m/.mu /home/$u/.mu + # put spool dir in directory that spans multiple distros. # based on http://www.postfix.org/qmgr.8.html and my notes in gnus # @@ -877,12 +889,19 @@ systemctl enable exim4 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 <&1 | /usr/local/bin/log-once send-test-forward +*/10 * * * * $u /usr/local/bin/mailtest-check 2>&1 | /usr/local/bin/log-once -1 send-test-forward +*/10 * * * * root chmod -R g+rw /m/md/bounces 2>&1 | /usr/local/bin/log-once -1 bounces-chmod EOF cp /a/bin/distro-setup/filesystem/usr/local/bin/mailtest-check /usr/local/bin else