mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Remove unnecessary postconf switch '-e' and use single quotes where possible (#2746)
This commit is contained in:
parent
21fbbfabe1
commit
efed7d9e44
|
@ -189,10 +189,10 @@ function _populate_relayhost_map
|
||||||
|
|
||||||
function _relayhost_configure_postfix
|
function _relayhost_configure_postfix
|
||||||
{
|
{
|
||||||
postconf -e \
|
postconf \
|
||||||
"smtp_sasl_auth_enable = yes" \
|
'smtp_sasl_auth_enable = yes' \
|
||||||
"smtp_sasl_security_options = noanonymous" \
|
'smtp_sasl_security_options = noanonymous' \
|
||||||
"smtp_tls_security_level = encrypt"
|
'smtp_tls_security_level = encrypt'
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_relayhost
|
function _setup_relayhost
|
||||||
|
@ -202,7 +202,7 @@ function _setup_relayhost
|
||||||
if [[ -n ${DEFAULT_RELAY_HOST} ]]
|
if [[ -n ${DEFAULT_RELAY_HOST} ]]
|
||||||
then
|
then
|
||||||
_log 'trace' "Setting default relay host ${DEFAULT_RELAY_HOST} to /etc/postfix/main.cf"
|
_log 'trace' "Setting default relay host ${DEFAULT_RELAY_HOST} to /etc/postfix/main.cf"
|
||||||
postconf -e "relayhost = ${DEFAULT_RELAY_HOST}"
|
postconf "relayhost = ${DEFAULT_RELAY_HOST}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${RELAY_HOST} ]]
|
if [[ -n ${RELAY_HOST} ]]
|
||||||
|
|
|
@ -96,8 +96,8 @@ function _setup_dmarc_hostname
|
||||||
function _setup_postfix_hostname
|
function _setup_postfix_hostname
|
||||||
{
|
{
|
||||||
_log 'debug' 'Applying hostname and domainname to Postfix'
|
_log 'debug' 'Applying hostname and domainname to Postfix'
|
||||||
postconf -e "myhostname = ${HOSTNAME}"
|
postconf "myhostname = ${HOSTNAME}"
|
||||||
postconf -e "mydomain = ${DOMAINNAME}"
|
postconf "mydomain = ${DOMAINNAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_dovecot_hostname
|
function _setup_dovecot_hostname
|
||||||
|
@ -359,21 +359,21 @@ function _setup_ldap
|
||||||
|
|
||||||
if [[ -f /etc/postfix/ldap-users.cf ]]
|
if [[ -f /etc/postfix/ldap-users.cf ]]
|
||||||
then
|
then
|
||||||
postconf -e 'virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf'
|
postconf 'virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf'
|
||||||
else
|
else
|
||||||
_log 'warn' "'/etc/postfix/ldap-users.cf' not found"
|
_log 'warn' "'/etc/postfix/ldap-users.cf' not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f /etc/postfix/ldap-domains.cf ]]
|
if [[ -f /etc/postfix/ldap-domains.cf ]]
|
||||||
then
|
then
|
||||||
postconf -e 'virtual_mailbox_domains = /etc/postfix/vhost, ldap:/etc/postfix/ldap-domains.cf'
|
postconf 'virtual_mailbox_domains = /etc/postfix/vhost, ldap:/etc/postfix/ldap-domains.cf'
|
||||||
else
|
else
|
||||||
_log 'warn' "'/etc/postfix/ldap-domains.cf' not found"
|
_log 'warn' "'/etc/postfix/ldap-domains.cf' not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f /etc/postfix/ldap-aliases.cf ]] && [[ -f /etc/postfix/ldap-groups.cf ]]
|
if [[ -f /etc/postfix/ldap-aliases.cf ]] && [[ -f /etc/postfix/ldap-groups.cf ]]
|
||||||
then
|
then
|
||||||
postconf -e 'virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, ldap:/etc/postfix/ldap-groups.cf'
|
postconf 'virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, ldap:/etc/postfix/ldap-groups.cf'
|
||||||
else
|
else
|
||||||
_log 'warn' "'/etc/postfix/ldap-aliases.cf' and / or '/etc/postfix/ldap-groups.cf' not found"
|
_log 'warn' "'/etc/postfix/ldap-aliases.cf' and / or '/etc/postfix/ldap-groups.cf' not found"
|
||||||
fi
|
fi
|
||||||
|
@ -431,13 +431,13 @@ function _setup_postfix_postscreen
|
||||||
function _setup_postfix_sizelimits
|
function _setup_postfix_sizelimits
|
||||||
{
|
{
|
||||||
_log 'trace' "Configuring Postfix message size limit to '${POSTFIX_MESSAGE_SIZE_LIMIT}'"
|
_log 'trace' "Configuring Postfix message size limit to '${POSTFIX_MESSAGE_SIZE_LIMIT}'"
|
||||||
postconf -e "message_size_limit = ${POSTFIX_MESSAGE_SIZE_LIMIT}"
|
postconf "message_size_limit = ${POSTFIX_MESSAGE_SIZE_LIMIT}"
|
||||||
|
|
||||||
_log 'trace' "Configuring Postfix mailbox size limit to '${POSTFIX_MAILBOX_SIZE_LIMIT}'"
|
_log 'trace' "Configuring Postfix mailbox size limit to '${POSTFIX_MAILBOX_SIZE_LIMIT}'"
|
||||||
postconf -e "mailbox_size_limit = ${POSTFIX_MAILBOX_SIZE_LIMIT}"
|
postconf "mailbox_size_limit = ${POSTFIX_MAILBOX_SIZE_LIMIT}"
|
||||||
|
|
||||||
_log 'trace' "Configuring Postfix virtual mailbox size limit to '${POSTFIX_MAILBOX_SIZE_LIMIT}'"
|
_log 'trace' "Configuring Postfix virtual mailbox size limit to '${POSTFIX_MAILBOX_SIZE_LIMIT}'"
|
||||||
postconf -e "virtual_mailbox_limit = ${POSTFIX_MAILBOX_SIZE_LIMIT}"
|
postconf "virtual_mailbox_limit = ${POSTFIX_MAILBOX_SIZE_LIMIT}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_clamav_sizelimit
|
function _setup_clamav_sizelimit
|
||||||
|
@ -449,7 +449,7 @@ function _setup_clamav_sizelimit
|
||||||
function _setup_postfix_smtputf8
|
function _setup_postfix_smtputf8
|
||||||
{
|
{
|
||||||
_log 'trace' "Disabling Postfix's smtputf8 support"
|
_log 'trace' "Disabling Postfix's smtputf8 support"
|
||||||
postconf -e "smtputf8_enable = no"
|
postconf 'smtputf8_enable = no'
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_spoof_protection
|
function _setup_spoof_protection
|
||||||
|
@ -463,16 +463,16 @@ function _setup_spoof_protection
|
||||||
then
|
then
|
||||||
if [[ -z ${LDAP_QUERY_FILTER_SENDERS} ]]
|
if [[ -z ${LDAP_QUERY_FILTER_SENDERS} ]]
|
||||||
then
|
then
|
||||||
postconf -e 'smtpd_sender_login_maps = ldap:/etc/postfix/ldap-users.cf ldap:/etc/postfix/ldap-aliases.cf ldap:/etc/postfix/ldap-groups.cf'
|
postconf 'smtpd_sender_login_maps = ldap:/etc/postfix/ldap-users.cf ldap:/etc/postfix/ldap-aliases.cf ldap:/etc/postfix/ldap-groups.cf'
|
||||||
else
|
else
|
||||||
postconf -e 'smtpd_sender_login_maps = ldap:/etc/postfix/ldap-senders.cf'
|
postconf 'smtpd_sender_login_maps = ldap:/etc/postfix/ldap-senders.cf'
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ -f /etc/postfix/regexp ]]
|
if [[ -f /etc/postfix/regexp ]]
|
||||||
then
|
then
|
||||||
postconf -e 'smtpd_sender_login_maps = unionmap:{ texthash:/etc/postfix/virtual, hash:/etc/aliases, pcre:/etc/postfix/maps/sender_login_maps.pcre, pcre:/etc/postfix/regexp }'
|
postconf 'smtpd_sender_login_maps = unionmap:{ texthash:/etc/postfix/virtual, hash:/etc/aliases, pcre:/etc/postfix/maps/sender_login_maps.pcre, pcre:/etc/postfix/regexp }'
|
||||||
else
|
else
|
||||||
postconf -e 'smtpd_sender_login_maps = texthash:/etc/postfix/virtual, hash:/etc/aliases, pcre:/etc/postfix/maps/sender_login_maps.pcre'
|
postconf 'smtpd_sender_login_maps = texthash:/etc/postfix/virtual, hash:/etc/aliases, pcre:/etc/postfix/maps/sender_login_maps.pcre'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -567,10 +567,10 @@ function _setup_SRS
|
||||||
{
|
{
|
||||||
_log 'debug' 'Setting up SRS'
|
_log 'debug' 'Setting up SRS'
|
||||||
|
|
||||||
postconf -e 'sender_canonical_maps = tcp:localhost:10001'
|
postconf 'sender_canonical_maps = tcp:localhost:10001'
|
||||||
postconf -e "sender_canonical_classes = ${SRS_SENDER_CLASSES}"
|
postconf "sender_canonical_classes = ${SRS_SENDER_CLASSES}"
|
||||||
postconf -e 'recipient_canonical_maps = tcp:localhost:10002'
|
postconf 'recipient_canonical_maps = tcp:localhost:10002'
|
||||||
postconf -e 'recipient_canonical_classes = envelope_recipient,header_recipient'
|
postconf 'recipient_canonical_classes = envelope_recipient,header_recipient'
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_dkim
|
function _setup_dkim
|
||||||
|
@ -612,7 +612,7 @@ function _setup_postfix_vhost
|
||||||
function _setup_postfix_inet_protocols
|
function _setup_postfix_inet_protocols
|
||||||
{
|
{
|
||||||
_log 'trace' 'Setting up POSTFIX_INET_PROTOCOLS option'
|
_log 'trace' 'Setting up POSTFIX_INET_PROTOCOLS option'
|
||||||
postconf -e "inet_protocols = ${POSTFIX_INET_PROTOCOLS}"
|
postconf "inet_protocols = ${POSTFIX_INET_PROTOCOLS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_dovecot_inet_protocols
|
function _setup_dovecot_inet_protocols
|
||||||
|
@ -663,7 +663,7 @@ function _setup_docker_permit
|
||||||
case "${PERMIT_DOCKER}" in
|
case "${PERMIT_DOCKER}" in
|
||||||
( 'none' )
|
( 'none' )
|
||||||
_log 'trace' "Clearing Postfix's 'mynetworks'"
|
_log 'trace' "Clearing Postfix's 'mynetworks'"
|
||||||
postconf -e "mynetworks ="
|
postconf "mynetworks ="
|
||||||
;;
|
;;
|
||||||
|
|
||||||
( 'connected-networks' )
|
( 'connected-networks' )
|
||||||
|
@ -671,7 +671,7 @@ function _setup_docker_permit
|
||||||
do
|
do
|
||||||
NETWORK=$(_sanitize_ipv4_to_subnet_cidr "${NETWORK}")
|
NETWORK=$(_sanitize_ipv4_to_subnet_cidr "${NETWORK}")
|
||||||
_log 'trace' "Adding Docker network '${NETWORK}' to Postfix's 'mynetworks'"
|
_log 'trace' "Adding Docker network '${NETWORK}' to Postfix's 'mynetworks'"
|
||||||
postconf -e "$(postconf | grep '^mynetworks =') ${NETWORK}"
|
postconf "$(postconf | grep '^mynetworks =') ${NETWORK}"
|
||||||
echo "${NETWORK}" >> /etc/opendmarc/ignore.hosts
|
echo "${NETWORK}" >> /etc/opendmarc/ignore.hosts
|
||||||
echo "${NETWORK}" >> /etc/opendkim/TrustedHosts
|
echo "${NETWORK}" >> /etc/opendkim/TrustedHosts
|
||||||
done
|
done
|
||||||
|
@ -679,21 +679,21 @@ function _setup_docker_permit
|
||||||
|
|
||||||
( 'container' )
|
( 'container' )
|
||||||
_log 'trace' "Adding container IP address to Postfix's 'mynetworks'"
|
_log 'trace' "Adding container IP address to Postfix's 'mynetworks'"
|
||||||
postconf -e "$(postconf | grep '^mynetworks =') ${CONTAINER_IP}/32"
|
postconf "$(postconf | grep '^mynetworks =') ${CONTAINER_IP}/32"
|
||||||
echo "${CONTAINER_IP}/32" >> /etc/opendmarc/ignore.hosts
|
echo "${CONTAINER_IP}/32" >> /etc/opendmarc/ignore.hosts
|
||||||
echo "${CONTAINER_IP}/32" >> /etc/opendkim/TrustedHosts
|
echo "${CONTAINER_IP}/32" >> /etc/opendkim/TrustedHosts
|
||||||
;;
|
;;
|
||||||
|
|
||||||
( 'host' )
|
( 'host' )
|
||||||
_log 'trace' "Adding '${CONTAINER_NETWORK}/16' to Postfix's 'mynetworks'"
|
_log 'trace' "Adding '${CONTAINER_NETWORK}/16' to Postfix's 'mynetworks'"
|
||||||
postconf -e "$(postconf | grep '^mynetworks =') ${CONTAINER_NETWORK}/16"
|
postconf "$(postconf | grep '^mynetworks =') ${CONTAINER_NETWORK}/16"
|
||||||
echo "${CONTAINER_NETWORK}/16" >> /etc/opendmarc/ignore.hosts
|
echo "${CONTAINER_NETWORK}/16" >> /etc/opendmarc/ignore.hosts
|
||||||
echo "${CONTAINER_NETWORK}/16" >> /etc/opendkim/TrustedHosts
|
echo "${CONTAINER_NETWORK}/16" >> /etc/opendkim/TrustedHosts
|
||||||
;;
|
;;
|
||||||
|
|
||||||
( 'network' )
|
( 'network' )
|
||||||
_log 'trace' "Adding Docker network to Postfix's 'mynetworks'"
|
_log 'trace' "Adding Docker network to Postfix's 'mynetworks'"
|
||||||
postconf -e "$(postconf | grep '^mynetworks =') 172.16.0.0/12"
|
postconf "$(postconf | grep '^mynetworks =') 172.16.0.0/12"
|
||||||
echo 172.16.0.0/12 >> /etc/opendmarc/ignore.hosts
|
echo 172.16.0.0/12 >> /etc/opendmarc/ignore.hosts
|
||||||
echo 172.16.0.0/12 >> /etc/opendkim/TrustedHosts
|
echo 172.16.0.0/12 >> /etc/opendkim/TrustedHosts
|
||||||
;;
|
;;
|
||||||
|
@ -701,7 +701,7 @@ function _setup_docker_permit
|
||||||
( * )
|
( * )
|
||||||
_log 'warn' "Invalid value for PERMIT_DOCKER: '${PERMIT_DOCKER}'"
|
_log 'warn' "Invalid value for PERMIT_DOCKER: '${PERMIT_DOCKER}'"
|
||||||
_log 'warn' "Clearing Postfix's 'mynetworks'"
|
_log 'warn' "Clearing Postfix's 'mynetworks'"
|
||||||
postconf -e "mynetworks ="
|
postconf "mynetworks ="
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
@ -718,7 +718,7 @@ function _setup_postfix_virtual_transport
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
postconf -e "virtual_transport = ${POSTFIX_DAGENT}"
|
postconf "virtual_transport = ${POSTFIX_DAGENT}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_postfix_override_configuration
|
function _setup_postfix_override_configuration
|
||||||
|
@ -1077,8 +1077,8 @@ function _setup_dnsbl_disable
|
||||||
/etc/postfix/main.cf
|
/etc/postfix/main.cf
|
||||||
|
|
||||||
_log 'debug' 'Disabling postscreen DNS block lists'
|
_log 'debug' 'Disabling postscreen DNS block lists'
|
||||||
postconf -e "postscreen_dnsbl_action = ignore"
|
postconf 'postscreen_dnsbl_action = ignore'
|
||||||
postconf -e "postscreen_dnsbl_sites = "
|
postconf 'postscreen_dnsbl_sites = '
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_fetchmail
|
function _setup_fetchmail
|
||||||
|
|
|
@ -47,7 +47,7 @@ function teardown_file() {
|
||||||
#
|
#
|
||||||
|
|
||||||
@test "checking smtp_only: mail send should work" {
|
@test "checking smtp_only: mail send should work" {
|
||||||
run docker exec mail_smtponly /bin/sh -c "postconf -e smtp_host_lookup=no"
|
run docker exec mail_smtponly /bin/sh -c "postconf smtp_host_lookup=no"
|
||||||
assert_success
|
assert_success
|
||||||
run docker exec mail_smtponly /bin/sh -c "/etc/init.d/postfix reload"
|
run docker exec mail_smtponly /bin/sh -c "/etc/init.d/postfix reload"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
|
@ -62,7 +62,7 @@ teardown_file() {
|
||||||
assert_output --partial "${IPNET1}"
|
assert_output --partial "${IPNET1}"
|
||||||
assert_output --partial "${IPNET2}"
|
assert_output --partial "${IPNET2}"
|
||||||
|
|
||||||
run docker exec mail_smtponly_second_network /bin/sh -c "postconf -e smtp_host_lookup=no"
|
run docker exec mail_smtponly_second_network /bin/sh -c "postconf smtp_host_lookup=no"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run docker exec mail_smtponly_second_network /bin/sh -c "/etc/init.d/postfix reload"
|
run docker exec mail_smtponly_second_network /bin/sh -c "/etc/init.d/postfix reload"
|
||||||
|
@ -76,7 +76,7 @@ teardown_file() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking PERMIT_DOCKER: none" {
|
@test "checking PERMIT_DOCKER: none" {
|
||||||
run docker exec mail_smtponly_force_authentication /bin/sh -c "postconf -e smtp_host_lookup=no"
|
run docker exec mail_smtponly_force_authentication /bin/sh -c "postconf smtp_host_lookup=no"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run docker exec mail_smtponly_force_authentication /bin/sh -c "/etc/init.d/postfix reload"
|
run docker exec mail_smtponly_force_authentication /bin/sh -c "/etc/init.d/postfix reload"
|
||||||
|
|
Loading…
Reference in a new issue