-if postfix; then
- # dunno why, but debian installed postfix with builddep emacs
- # but I will just explicitly install it here since
- # I use it for sending mail in emacs.
- if command -v apt-get &> /dev/null; then
- debconf-set-selections <<EOF
-postfix postfix/main_mailer_type select Satellite system
-postfix postfix/mailname string $HOSTNAME
-postfix postfix/relayhost string $relayhost
-postfix postfix/root_address string $postmaster
-EOF
- if dpkg -s postfix &>/dev/null; then
- dpkg-reconfigure -u -fnoninteractive postfix
- else
- apt-get -y install --purge --auto-remove postfix
- fi
- else
- source /a/bin/distro-functions/src/package-manager-abstractions
- pi postfix
- # Settings from reading the output when installing on debian,
- # then seeing which were different in a default install on arch.
- # I assume the same works for fedora.
- postconfin <<EOF
-mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
-mailbox_size_limit = 0
-relayhost = $relayhost
-inet_interfaces = loopback-only
-EOF
-
- systemctl enable postfix
- systemctl start postfix
- fi
- # i\'m assuming mail just won\'t work on systems without the sasl_passwd.
- postconfin <<'EOF'
-smtp_sasl_auth_enable = yes
-smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
-smtp_sasl_security_options = noanonymous
-smtp_tls_security_level = secure
-message_size_limit = 20480000
-smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
-inet_protocols = ipv4
-EOF
- # msg_size_limit: I ran into a log file not sending cuz of size. double from 10 to 20 meg limit
- # inet_protocols: without this, I've had postfix try an ipv6 lookup then gives
- # up and fail forever. snippet from syslog: type=AAAA: Host not found, try again
-
-
- f=/etc/postfix/sasl_passwd
- install -m 600 /dev/null $f
- cat /etc/mailpass| while read -r domain port pass; do
- # format: domain port user:pass
- # mailpass is just a name i made up, since postfix and
- # exim both use a slightly crazy format to translate to
- # each other, it\'s easier to use my own format.
- printf "[%s]:%s %s" "$domain" "$port" "${pass/@/#}" >>$f
- done
- postmap hash:/etc/postfix/sasl_passwd
- # need restart instead of reload when changing
- # inet_protocols
- service postfix restart
-
-else # exim. has debian specific stuff for now
-
-
- # 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
- # mailname setting sets /etc/mailname
-
- debconf-set-selections <<EOF
-exim4-config exim4/use_split_config boolean true
-EOF
-
- source /a/bin/bash_unpublished/source-semi-priv
- exim_main_dir=/etc/exim4/conf.d/main
- mkdir -p $exim_main_dir
- if [[ $HOSTNAME == $MAIL_HOST ]]; then