X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=mail-setup;h=abe98d97b61762b9f92339fc7bce1734baf29b0e;hp=058fb4f52d4d56e4894212a2a1d804d4b36f4a05;hb=9d21aed0c95e0c343f2769a724d9dbb220874185;hpb=f7eaad64a7c5f3bc851f146e1f258d34f398a7d7 diff --git a/mail-setup b/mail-setup index 058fb4f..abe98d9 100755 --- a/mail-setup +++ b/mail-setup @@ -66,6 +66,7 @@ EOF # apg -m 50 -x 70 -n 1 -a 1 -M CLN >$f # s sed -i "/^$user:/d" /p/c/filesystem/etc/exim4/passwd # echo "$user:$(mkpasswd -m sha-512 -s <$f)" >>/p/c/filesystem/etc/exim4/passwd +# # todo: port is no longer used in mailpass, remove it. # echo "mail.iankelling.org 587 $user:$(<$f)" >> /p/c/machine_specific/$user/filesystem/etc/mailpass # # then run this script, or part of it which uses /etc/mailpass @@ -179,15 +180,9 @@ EOF #exim4 -bt iank@localhost -postconfin() { - local MAPFILE - mapfile -t - local s - postconf -ev "${MAPFILE[@]}" -} e() { printf "%s\n" "$*"; } pi() { # package install - local s f + local f if dpkg -s -- "$@" &> /dev/null; then return 0; fi; @@ -247,27 +242,6 @@ if [[ -e /p/c/filesystem ]]; then fi fi -cat >/etc/systemd/system/offlineimapsync.timer <<'EOF' -[Unit] -Description=Run offlineimap-sync once every min - -[Timer] -OnCalendar=*:0/1 - -[Install] -WantedBy=timers.target -EOF - -cat >/etc/systemd/system/offlineimapsync.service </etc/systemd/system/mailclean.timer <<'EOF' [Unit] @@ -293,34 +267,6 @@ EOF systemctl daemon-reload -# wording of question from dpkg-reconfigure exim4-config -# 1. internet site; mail is sent and received directly using SMTP -# 2. mail sent by smarthost; received via SMTP or fetchmail -# 3. mail sent by smarthost; no local mail -# 4. local delivery only; not on a network -# 5. no configuration at this time -# -# Note, I have used option 2 in the past for receiving mail -# from lan hosts, sending external mail via another smtp server. -# -# Note, other than configtype, we could set all the options in -# both types of configs without harm, they would either be -# ignored or be disabled by other settings, but the default -# local_interfaces definitely makes things more secure. - -# most of these settings get translated into settings -# in /etc/exim4/update-exim4.conf.conf -# how /etc/exim4/update-exim4.conf.conf translates into actual exim settings is -# documented in man update-exim4.conf, which outputs to the config that -# exim actually reads. except the man page is not perfect, for example, -# it doesn't document that it sets -# DCconfig_${dc_eximconfig_configtype}" "1" -# which is a line from update-exim4.conf, which is a relatively short bash script. -# mailname setting sets /etc/mailname - -debconf-set-selections </etc/exim4/update-exim4.conf.conf <<'EOF' +# default stuff, i havent checked if its needed +dc_minimaldns='false' +dc_relay_nets='' +CFILEMODE='644' +dc_use_split_config='true' +dc_local_interfaces='' +dc_mailname_in_oh='true' +EOF if [[ $HOSTNAME == $MAIL_HOST ]]; then @@ -487,115 +443,44 @@ server=/mail.iankelling.org/127.0.1.1 EOF systemctl reload dnsmasq - debconf-set-selections <>/etc/exim4/update-exim4.conf.conf < /etc/mailname # MAIN_HARDCODE_PRIMARY_HOSTNAME might mess up the @@ -776,8 +661,6 @@ RestartSec=1 StartLimitInterval=0 EOF - systemctl enable offlineimapsync.timer - systemctl start offlineimapsync.timer systemctl enable mailclean.timer systemctl start mailclean.timer systemctl restart $vpn_ser@mail @@ -795,8 +678,6 @@ EOF echo | /a/exe/cedit mail /etc/dnsmasq-servers.conf || [[ $? == 1 ]] systemctl reload dnsmasq - systemctl disable offlineimapsync.timer &>/dev/null ||: - systemctl stop offlineimapsync.timer &>/dev/null ||: systemctl disable mailclean.timer &>/dev/null ||: systemctl stop mailclean.timer &>/dev/null ||: systemctl disable $vpn_ser@mail @@ -808,27 +689,20 @@ EOF # would only exist because I wrote it i the previous condition, # it\'s not part of exim rm -f /etc/exim4/conf.d/main/000_localmacros - debconf-set-selections <>/etc/exim4/update-exim4.conf.conf < /etc/mailname fi # end $HOSTNAME != $MAIL_HOST -# if we already have it installed, need to reconfigure, without being prompted -if dpkg -s exim4-config &>/dev/null; then - # gotta remove this, otherwise the set-selections are completely - # ignored. It woulda been nice if this was documented somewhere! - rm -f /etc/exim4/update-exim4.conf.conf - while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done - dpkg-reconfigure -u -fnoninteractive exim4-config -fi +systemctl reload exim4 # i have the spool directory be common to distro multi-boot, so # we need the uid to be the same. 608 cuz it's kind of in the middle @@ -911,10 +785,10 @@ sed -r s/^\\S+:/$b:/ 600_exim4-config_userforward >175_$b f=/etc/exim4/passwd.client rm -f /etc/exim4/passwd.client install -m 640 -g Debian-exim /dev/null $f -cat /etc/mailpass| while read -r domain port pass; do +while read -r domain _ pass; do # reference: exim4_passwd_client(5) printf "%s:%s\n" "$domain" "$pass" >>$f -done +done