fix postfix
[distro-setup] / postfix-setup
index 2c8fe5ede96418c436ac3b82283a1ff2160f9d2f..2ecbd6b4be047c8ce90c4c6ef8471fbe90f165bf 100755 (executable)
@@ -1,6 +1,18 @@
 #!/bin/bash -l
 # Copyright (C) 2016 Ian Kelling
-# This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
@@ -59,15 +71,15 @@ fi
 
 
 # This also works instead of ~/.forward
-# s sed -i '/^root/d' /etc/aliases ||:
+# s sed -i --follow-symlinks '/^root/d' /etc/aliases ||:
 #echo "root: $HOSTNAME@$SOME_DOMAIN" | s tee -a /etc/aliases
 # this can't be a symlink and has permission restrictions
 # it might work in /etc/aliases, but this seems more proper.
 
 if s grep amazonaws /etc/postfix/sasl_passwd &>/dev/null; then
-    forward=$HOSTNAME@$PERSONAL_DOMAIN
-else
     forward=$HOSTNAME@$IMPERSONAL_DOMAIN
+else
+    forward=$HOSTNAME@$PERSONAL_DOMAIN
 fi
 e $forward > ~/.forward
 e $forward | s tee /root/.forward
@@ -87,8 +99,12 @@ 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
-# ^ I ran into a log file not sending cuz of size. double from 10 to 20 meg limit
+# 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, postfix tries an ipv6 lookup then gives
+# up and fails. snippet from syslog: type=AAAA: Host not found, try again
+
 
 s postmap hash:/etc/postfix/sasl_passwd
 # offlineimap uses this too, it is much easier to use one location than to