summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2020-10-10 23:24:05 +0200
committerJonas Smedegaard <dr@jones.dk>2020-10-10 23:25:44 +0200
commit9f5b2eac010cde31569c9a92619d6979823ace2a (patch)
tree1834d6125d71ccdcd7f60ba0faa4ff0c9c2f251e
parentbb831a3c714204162563188c7dde464e26ce09dd (diff)
tidy: avoid useless use of cat, and wrap some long lines
-rwxr-xr-xpostfix/postfix.sh27
1 files changed, 18 insertions, 9 deletions
diff --git a/postfix/postfix.sh b/postfix/postfix.sh
index 92febc6..9b075cb 100755
--- a/postfix/postfix.sh
+++ b/postfix/postfix.sh
@@ -116,7 +116,7 @@ catallfilesfromotherrealms() {
[ -d "$realmsdir" ] || exit 0
[ -f "$realmsdir/realms" ] || exit 0
- realms=$(cat "$realmsdir/realms" | sed 's/#.*//')
+ realms=$(sed 's/#.*//' < "$realmsdir/realms")
for realm in $realms; do
if [ "$thisrealm" != "$realm" ]; then
@@ -230,8 +230,8 @@ fi
# Support exceptions to default response
# (Day Old Bread (dob) lists need to reject only temporarily)
_postconf -e rbl_reply_maps="hash:$confdir/rbl_reply_map"
-cat /etc/local-COMMON/postfix/rbl_reply_map \
- | sed 's/#.*//' \
+sed 's/#.*//' \
+ < /etc/local-COMMON/postfix/rbl_reply_map \
> "$tempdir/rbl_reply_map"
postmapfiles="$postmapfiles rbl_reply_map"
@@ -240,10 +240,16 @@ postmapfiles="$postmapfiles rbl_reply_map"
# (add own domains before peers for (rare) cases of duplicates)
# FIXME: somehow do this step only if enabled in smtpd_sender_restrictions
# TODO: Properly implement exception exclusion like yahoo (which does not want to be checked any longer!)
-cat /etc/local-COMMON/postfix/maildomains | grep -v yahoo | sort | sed 's/$/ reject_unverified_sender/' > "$tempdir/sender_access"
+grep -v yahoo \
+ < /etc/local-COMMON/postfix/maildomains \
+ | sort \
+ | sed 's/$/ reject_unverified_sender/' \
+ > "$tempdir/sender_access"
( catfilefromownrealm maildomains | sort; catallfilesfromotherrealms maildomains | sort ) \
- | sed 's/\(.*\)$/postmaster@\1 permit\n\1 reject_unverified_sender/' >> "$tempdir/sender_access"
-[ ! -f "$tempdir/sender_access.addon" ] || cat "$tempdir/sender_access.addon" >> "$tempdir/sender_access"
+ | sed 's/\(.*\)$/postmaster@\1 permit\n\1 reject_unverified_sender/' \
+ >> "$tempdir/sender_access"
+[ ! -f "$tempdir/sender_access.addon" ] || cat "$tempdir/sender_access.addon" \
+ >> "$tempdir/sender_access"
postmapfiles="$postmapfiles sender_access"
_postconf -e unverified_sender_reject_code=550
@@ -273,8 +279,11 @@ fi
_postconf -e smtp_tls_loglevel=1
# enforce TLS trust path towards peers
-catallfilesfromotherrealms mailhost | sort | sed 's/^/[/;s/$/]:submission secure/' > "$tempdir/tls_policy"
-[ ! -f "$tempdir/tls_policy.addon" ] || cat "$tempdir/tls_policy.addon" >> "$tempdir/tls_policy"
+catallfilesfromotherrealms mailhost | sort \
+ | sed 's/^/[/;s/$/]:submission secure/' \
+ > "$tempdir/tls_policy"
+[ ! -f "$tempdir/tls_policy.addon" ] || cat "$tempdir/tls_policy.addon" \
+ >> "$tempdir/tls_policy"
postmapfiles="$postmapfiles tls_policy"
_postconf -e smtp_tls_policy_maps="hash:$confdir/tls_policy"
@@ -441,7 +450,7 @@ fi
case $do_update in
y|Y)
if [ -f "$tempdir/COMMANDS" ]; then
- cat "$tempdir/COMMANDS" | sh -s
+ sh -s < "$tempdir/COMMANDS"
fi
rm -f "$tempdir/COMMANDS"