diff options
author | Jonas Smedegaard <dr@jones.dk> | 2020-10-11 00:36:18 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2020-10-11 00:36:18 +0200 |
commit | f3f638118d36c105672d328b85b037a52a8048b0 (patch) | |
tree | 1c48115ed2391bc415647e0fe6672784cbfc1bb2 | |
parent | 32d705d7077aefbacfe5f448c1fddd7abae4de90 (diff) |
tidy: rename internal supported-feature variables
-rwxr-xr-x | postfix/postfix.sh | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/postfix/postfix.sh b/postfix/postfix.sh index 62d10c3..c14a1ba 100755 --- a/postfix/postfix.sh +++ b/postfix/postfix.sh @@ -133,54 +133,54 @@ getlinesfromfile() { catfirstfile "$param" | sed 's/#.*//' | tr '\n' ',' | sed -e 's/^[, ]*//;s/[, ]\+/,/g' -e 's/\^/ /g' -e "s/,\$//$replacements" } -#postgrey= +#ENABLE_POSTGREY= #if [ -x /usr/sbin/postgrey ]; then # # FIXME: Use this somehow, and only warn below -# postgrey=1 +# ENABLE_POSTGREY=1 #else # exit1 "ERROR: Greylisting support (Debian package postgrey) missing." #fi dovecot= -dovecot_lmtp= -dovecot_deliver= +ENABLE_DOVECOT_LMTP= +ENABLE_DOVECOT_DELIVER= if [ -x /usr/sbin/dovecot ]; then dovecot=1 if [ -x /usr/lib/dovecot/lmtp ]; then - dovecot_lmtp=1 + ENABLE_DOVECOT_LMTP=1 elif [ -x /usr/lib/dovecot/deliver ]; then warn "Dovecot LMTP missing - (Debian package dovecot-lmtp)." - dovecot_deliver=1 + ENABLE_DOVECOT_DELIVER=1 else warn "Dovecot deliver missing." fi else warn "Dovecot missing - (Debian package dovecot-core or dovecot)." fi -tls_cert= +ENABLE_TLS= if [ -f "$TLS_CERT" ] && [ -f "$TLS_KEY" ]; then - tls_cert=1 + ENABLE_TLS=1 else warn "No TLS - requires certificate \"$TLS_CERT\" and key \"$TLS_KEY\"." fi # TODO: enable only on systems with user accounts -submission=1 +ENABLE_SUBMISSION=1 # TODO: check that dovecot SASL is configured -sasl_inbound= -if [ -n "$tls_cert" ] && [ -n "$dovecot" ] && [ -n "$submission" ]; then - sasl_inbound=1 +ENABLE_SASL_INBOUND= +if [ -n "$ENABLE_TLS" ] && [ -n "$dovecot" ] && [ -n "$ENABLE_SUBMISSION" ]; then + ENABLE_SASL_INBOUND=1 else warn "No inbound SASL authentication - requires TLS encryption and Dovecot." fi -amavis= +ENABLE_AMAVIS= if [ -x /usr/sbin/amavisd ] || [ -x /usr/sbin/amavisd-new ]; then - amavis=1 + ENABLE_AMAVIS=1 else warn "AMaViS missing (Debian package amavisd-new)." fi -dkimproxy= +ENABLE_DKIMPROXY= if [ -x /usr/sbin/dkimproxy.in ]; then - if [ "1" = "$amavis" ]; then - dkimproxy=1 + if [ "1" = "$ENABLE_AMAVIS" ]; then + ENABLE_DKIMPROXY=1 else warn "No DKIM/Domainkey - requires DKIMproxy and AMaViS." fi @@ -212,13 +212,13 @@ _postconf -e "$(getlinesfromfile permit_mx_backup_networks)" _postconf -e maps_rbl_domains= _postconf -e "$(getlinesfromfile smtpd_client_restrictions reject_rhsbl_client)" _postconf -e "$(getlinesfromfile smtpd_helo_restrictions)" -_postconf -e "$(getlinesfromfile smtpd_sender_restrictions reject_rhsbl_sender ${dkimproxy:-sender_access_regex=})" +_postconf -e "$(getlinesfromfile smtpd_sender_restrictions reject_rhsbl_sender ${ENABLE_DKIMPROXY:-sender_access_regex=})" _postconf -e "$(getlinesfromfile smtpd_recipient_restrictions reject_maps_rbl=reject_rbl_client=maps_rbl_domains)" _postconf -e "$(getlinesfromfile smtpd_data_restrictions)" # FIXME: clear only specific line (not whole file) when dkimproxy unused if [ -f "$tempdir/sender_access_regex" ]; then - if [ -n "$dkimproxy" ]; then + if [ -n "$ENABLE_DKIMPROXY" ]; then grep -q -F '/^/ FILTER dkimsign:[127.0.0.1]:10026' "$tempdir/sender_access_regex" \ || echo '/^/ FILTER dkimsign:[127.0.0.1]:10026' >> "$tempdir/sender_access_regex" else @@ -259,10 +259,10 @@ _postconf -e unverified_sender_reject_code=550 # Trust recipient verification too _postconf -e unverified_recipient_reject_code=550 -if [ -n "$dovecot_lmtp" ]; then +if [ -n "$ENABLE_DOVECOT_LMTP" ]; then _postconf -e mailbox_transport=lmtp:unix:private/dovecot-lmtp _postconf -X mailbox_command -elif [ -n "$dovecot_deliver" ]; then +elif [ -n "$ENABLE_DOVECOT_DELIVER" ]; then _postconf -X mailbox_transport _postconf -e mailbox_command=/usr/lib/dovecot/deliver else @@ -272,7 +272,7 @@ fi # outbound opportunistic encryption _postconf -e smtp_tls_security_level=may -if [ -n "$tls_cert" ]; then +if [ -n "$ENABLE_TLS" ]; then _postconf -e smtp_tls_cert_file="$TLS_CERT" _postconf -e smtp_tls_key_file="$TLS_KEY" else @@ -291,7 +291,7 @@ postmapfiles="$postmapfiles tls_policy" _postconf -e smtp_tls_policy_maps="hash:$confdir/tls_policy" # inbound opportunistic encryption -if [ -n "$tls_cert" ]; then +if [ -n "$ENABLE_TLS" ]; then _postconf -e smtpd_tls_security_level=may _postconf -e smtpd_tls_cert_file="$TLS_CERT" _postconf -e smtpd_tls_key_file="$TLS_KEY" @@ -328,7 +328,7 @@ _postconf -X tls_random_source # submission # <http://www.postfix.org/SASL_README.html> # <https://doc.dovecot.org/configuration_manual/howto/postfix_and_dovecot_sasl/#using-sasl-with-postfix-submission-port> -if [ -n "$submission" ]; then +if [ -n "$ENABLE_SUBMISSION" ]; then _postconf -Me submission/inet=" submission inet n - y - - smtpd -o syslog_name=postfix/\$service_name @@ -340,7 +340,7 @@ smtps inet n - y - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes " - if [ -n "$sasl_inbound" ]; then + if [ -n "$ENABLE_SASL_INBOUND" ]; then _postconf -Pe submission/inet/smtpd_sasl_auth_enable=yes _postconf -Pe smtps/inet/smtpd_sasl_auth_enable=yes else @@ -351,7 +351,7 @@ else _postconf -MX submission/inet _postconf -MX smtps/inet fi -if [ -n "$sasl_inbound" ]; then +if [ -n "$ENABLE_SASL_INBOUND" ]; then _postconf -e smtpd_sasl_local_domain=\$mydomain _postconf -e smtpd_sasl_type=dovecot _postconf -e smtpd_sasl_path=private/auth @@ -367,7 +367,7 @@ fi _postconf -X smtpd_sasl_auth_enable _postconf -X smtpd_sasl_security_options -if [ -n "$amavis" ]; then +if [ -n "$ENABLE_AMAVIS" ]; then amavis_maxproc=$(getperlvarfromfile max_servers "$AMAVIS_MAXPROC" amavisd.conf.addon amavis) _postconf -Me amavisfeed/unix=" amavisfeed unix - - n - $amavis_maxproc lmtp @@ -398,10 +398,10 @@ amavisfeed unix - - n - $amavis_maxproc lmtp -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_milters ' _postconf -e receive_override_options=no_address_mappings - if [ -n "$dkimproxy" ]; then + if [ -n "$ENABLE_DKIMPROXY" ]; then _postconf -e content_filter='amavisfeed:[127.0.0.1]:10028' _postconf -Pe pickup/fifo/content_filter='dkimsign:127.0.0.1:10028' - if [ -n "$submission" ]; then + if [ -n "$ENABLE_SUBMISSION" ]; then _postconf -Pe submission/inet/content_filter='dkimsign:[127.0.0.1]:10028' _postconf -Pe smtps/inet/content_filter='dkimsign:[127.0.0.1]:10028' fi @@ -427,7 +427,7 @@ dkimsign unix - - n - $DKIMPROXY_MAXPROC_OUT smtp _postconf -MX 127.0.0.1:10029/inet _postconf -e content_filter='amavisfeed:[127.0.0.1]:10024' _postconf -PX pickup/fifo/content_filter - if [ -n "$submission" ]; then + if [ -n "$ENABLE_SUBMISSION" ]; then _postconf -PX submission/inet/content_filter _postconf -PX smtps/inet/content_filter fi |