mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-23 20:24:54 +02:00
change if style (#3361)
This commit is contained in:
parent
0e592aa911
commit
cf74127f78
58 changed files with 297 additions and 594 deletions
|
@ -15,8 +15,7 @@ function _setup_postfix_early
|
|||
postconf "myhostname = ${HOSTNAME}"
|
||||
postconf "mydomain = ${DOMAINNAME}"
|
||||
|
||||
if [[ ${POSTFIX_INET_PROTOCOLS} != 'all' ]]
|
||||
then
|
||||
if [[ ${POSTFIX_INET_PROTOCOLS} != 'all' ]]; then
|
||||
__postfix__log 'trace' 'Setting up POSTFIX_INET_PROTOCOLS option'
|
||||
postconf "inet_protocols = ${POSTFIX_INET_PROTOCOLS}"
|
||||
fi
|
||||
|
@ -25,16 +24,14 @@ function _setup_postfix_early
|
|||
postconf 'smtputf8_enable = no'
|
||||
|
||||
__postfix__log 'trace' "Configuring SASLauthd"
|
||||
if [[ ${ENABLE_SASLAUTHD} -eq 1 ]] && [[ ! -f /etc/postfix/sasl/smtpd.conf ]]
|
||||
then
|
||||
if [[ ${ENABLE_SASLAUTHD} -eq 1 ]] && [[ ! -f /etc/postfix/sasl/smtpd.conf ]]; then
|
||||
cat >/etc/postfix/sasl/smtpd.conf << EOF
|
||||
pwcheck_method: saslauthd
|
||||
mech_list: plain login
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ ${ENABLE_SASLAUTHD} -eq 0 ]] && [[ ${SMTP_ONLY} -eq 1 ]]
|
||||
then
|
||||
if [[ ${ENABLE_SASLAUTHD} -eq 0 ]] && [[ ${SMTP_ONLY} -eq 1 ]]; then
|
||||
sed -i -E \
|
||||
's|^smtpd_sasl_auth_enable =.*|smtpd_sasl_auth_enable = no|g' \
|
||||
/etc/postfix/main.cf
|
||||
|
@ -61,8 +58,7 @@ EOF
|
|||
__postfix__log 'trace' "Configuring virtual mailbox size limit to '${POSTFIX_MAILBOX_SIZE_LIMIT}'"
|
||||
postconf "virtual_mailbox_limit = ${POSTFIX_MAILBOX_SIZE_LIMIT}"
|
||||
|
||||
if [[ ${POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME} -eq 1 ]]
|
||||
then
|
||||
if [[ ${POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME} -eq 1 ]]; then
|
||||
__postfix__log 'trace' 'Enabling reject_unknown_client_hostname to dms_smtpd_sender_restrictions'
|
||||
sedfile -i -E \
|
||||
's|^(dms_smtpd_sender_restrictions = .*)|\1, reject_unknown_client_hostname|' \
|
||||
|
@ -75,21 +71,18 @@ function _setup_postfix_late
|
|||
_log 'debug' 'Configuring Postfix (late setup)'
|
||||
|
||||
__postfix__log 'trace' 'Configuring user access'
|
||||
if [[ -f /tmp/docker-mailserver/postfix-send-access.cf ]]
|
||||
then
|
||||
if [[ -f /tmp/docker-mailserver/postfix-send-access.cf ]]; then
|
||||
sed -i -E 's|(smtpd_sender_restrictions =)|\1 check_sender_access texthash:/tmp/docker-mailserver/postfix-send-access.cf,|' /etc/postfix/main.cf
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/docker-mailserver/postfix-receive-access.cf ]]
|
||||
then
|
||||
if [[ -f /tmp/docker-mailserver/postfix-receive-access.cf ]]; then
|
||||
sed -i -E 's|(smtpd_recipient_restrictions =)|\1 check_recipient_access texthash:/tmp/docker-mailserver/postfix-receive-access.cf,|' /etc/postfix/main.cf
|
||||
fi
|
||||
|
||||
__postfix__log 'trace' 'Configuring relay host'
|
||||
_setup_relayhost
|
||||
|
||||
if [[ -n ${POSTFIX_DAGENT} ]]
|
||||
then
|
||||
if [[ -n ${POSTFIX_DAGENT} ]]; then
|
||||
__postfix__log 'trace' "Changing virtual transport to '${POSTFIX_DAGENT}'"
|
||||
# Default value in main.cf should be 'lmtp:unix:/var/run/dovecot/lmtp'
|
||||
postconf "virtual_transport = ${POSTFIX_DAGENT}"
|
||||
|
@ -102,8 +95,7 @@ function __postfix__setup_override_configuration
|
|||
{
|
||||
__postfix__log 'debug' 'Overriding / adjusting configuration with user-supplied values'
|
||||
|
||||
if [[ -f /tmp/docker-mailserver/postfix-main.cf ]]
|
||||
then
|
||||
if [[ -f /tmp/docker-mailserver/postfix-main.cf ]]; then
|
||||
cat /tmp/docker-mailserver/postfix-main.cf >>/etc/postfix/main.cf
|
||||
_adjust_mtime_for_postfix_maincf
|
||||
|
||||
|
@ -117,12 +109,10 @@ function __postfix__setup_override_configuration
|
|||
__postfix__log 'trace' "No extra Postfix settings loaded because optional '/tmp/docker-mailserver/postfix-main.cf' was not provided"
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/docker-mailserver/postfix-master.cf ]]
|
||||
then
|
||||
if [[ -f /tmp/docker-mailserver/postfix-master.cf ]]; then
|
||||
while read -r LINE
|
||||
do
|
||||
if [[ ${LINE} =~ ^[0-9a-z] ]]
|
||||
then
|
||||
if [[ ${LINE} =~ ^[0-9a-z] ]]; then
|
||||
postconf -P "${LINE}"
|
||||
fi
|
||||
done < /tmp/docker-mailserver/postfix-master.cf
|
||||
|
@ -155,21 +145,18 @@ function _setup_SRS
|
|||
|
||||
POSTSRSD_SECRET_FILE='/etc/postsrsd.secret'
|
||||
|
||||
if [[ -n ${SRS_SECRET} ]]
|
||||
then
|
||||
if [[ -n ${SRS_SECRET} ]]; then
|
||||
(
|
||||
umask 0077
|
||||
echo "${SRS_SECRET}" | tr ',' '\n' >"${POSTSRSD_SECRET_FILE}"
|
||||
)
|
||||
else
|
||||
if [[ ! -f ${POSTSRSD_SECRET_FILE} ]]
|
||||
then
|
||||
if [[ ! -f ${POSTSRSD_SECRET_FILE} ]]; then
|
||||
__generate_secret "${POSTSRSD_SECRET_FILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n ${SRS_EXCLUDE_DOMAINS} ]]
|
||||
then
|
||||
if [[ -n ${SRS_EXCLUDE_DOMAINS} ]]; then
|
||||
sedfile -i -E \
|
||||
"s|^#?(SRS_EXCLUDE_DOMAINS=).*|\1${SRS_EXCLUDE_DOMAINS}|" \
|
||||
/etc/default/postsrsd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue