Allow to set comfortably inet_protocols

Setting `inet_protocols = ipv4` is almost a requirement when running behind Docker. Provide a way to make it easy.

@Tecnativa TT22925
This commit is contained in:
Jairo Llopis 2020-03-19 08:35:25 +00:00
parent c075a0e436
commit ab22450364
No known key found for this signature in database
GPG Key ID: 0CFC348F9B242B08
3 changed files with 28 additions and 1 deletions

View File

@ -304,6 +304,8 @@ Set different options for mynetworks option (can be overwrite in postfix-main.cf
- network => Add the docker default bridge network (172.16.0.0/12); **WARNING**: `docker-compose` might use others (e.g. 192.168.0.0/16) use `PERMIT_DOCKER=connected-networks` in this case
- connected-networks => Add all connected docker networks (ipv4 only)
Note: you probably want to [set `POSTFIX_INET_PROTOCOLS=ipv4`](#postfix_inet_protocols) to make it work fine with Docker.
##### VIRUSMAILS_DELETE_DELAY
Set how many days a virusmail will stay on the server before being deleted
@ -369,6 +371,14 @@ Set the message size limit for all users. If set to zero, the size will be unlim
This option has been added in November 2019. Using other format than Maildir is considered as experimental in docker-mailserver and should only be used for testing purpose. For more details, please refer to [Dovecot Documentation](https://wiki2.dovecot.org/MailboxFormat).
##### POSTFIX_INET_PROTOCOLS
- **all** => All possible protocols.
- ipv4 => Use only IPv4 traffic. Most likely you want this behind Docker.
- ipv6 => Use only IPv6 traffic.
Note: More details in http://www.postfix.org/postconf.5.html#inet_protocols
## Reports
##### PFLOGSUMM_TRIGGER

View File

@ -130,6 +130,14 @@ REPORT_SENDER=
# Note: This Variable actually controls logrotate inside the container and rotates the log depending on this setting. The main log output is still available in its entirety via `docker logs mail` (Or your respective container name). If you want to control logrotation for the docker generated logfile see: [Docker Logging Drivers](https://docs.docker.com/config/containers/logging/configure/)
REPORT_INTERVAL=daily
# Choose TCP/IP protocols to use
# **all** => All possible protocols.
# ipv4 => Use only IPv4 traffic. Most likely you want this behind Docker.
# ipv6 => Use only IPv6 traffic.
#
# Note: More details in http://www.postfix.org/postconf.5.html#inet_protocols
POSTFIX_INET_PROTOCOLS=all
# -----------------------------------------------------------------------------------------------------------------------------
# --------------------- Spamassassin section ----------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------------------------------------------------

View File

@ -25,6 +25,7 @@ DEFAULT_VARS["POSTGREY_AUTO_WHITELIST_CLIENTS"]="${POSTGREY_AUTO_WHITELIST_CLIEN
DEFAULT_VARS["POSTGREY_TEXT"]="${POSTGREY_TEXT:="Delayed by postgrey"}"
DEFAULT_VARS["POSTFIX_MESSAGE_SIZE_LIMIT"]="${POSTFIX_MESSAGE_SIZE_LIMIT:="10240000"}" # ~10 MB by default
DEFAULT_VARS["POSTFIX_MAILBOX_SIZE_LIMIT"]="${POSTFIX_MAILBOX_SIZE_LIMIT:="0"}" # no limit by default
DEFAULT_VARS["POSTFIX_INET_PROTOCOLS"]="${POSTFIX_INET_PROTOCOLS:="all"}"
DEFAULT_VARS["ENABLE_SASLAUTHD"]="${ENABLE_SASLAUTHD:="0"}"
DEFAULT_VARS["SMTP_ONLY"]="${SMTP_ONLY:="0"}"
DEFAULT_VARS["DMS_DEBUG"]="${DMS_DEBUG:="0"}"
@ -118,6 +119,9 @@ function register_functions() {
_register_setup_function "_setup_dkim"
_register_setup_function "_setup_ssl"
if [ "$POSTFIX_INET_PROTOCOLS" != "all" ]; then
_register_setup_function "_setup_inet_protocols"
fi
_register_setup_function "_setup_docker_permit"
_register_setup_function "_setup_mailname"
@ -175,7 +179,7 @@ function register_functions() {
if [ "$LOGWATCH_TRIGGER" != "none" ]; then
_register_setup_function "_setup_logwatch"
fi
_register_setup_function "_setup_user_patches"
# Compute last as the config files are modified in-place
@ -1100,6 +1104,11 @@ function _setup_postfix_vhost() {
fi
}
function _setup_inet_protocols() {
notify 'task' 'Setting up POSTFIX_INET_PROTOCOLS option'
postconf -e "inet_protocols = $POSTFIX_INET_PROTOCOLS"
}
function _setup_docker_permit() {
notify 'task' 'Setting up PERMIT_DOCKER Option'