Commit 86615b21 by Alin Voinea

Refs #70500 - Support more environment variables

parent fd6917f2
......@@ -13,6 +13,7 @@ The relay is set in `MTP_RELAY` and the port in `MTP_PORT`.
- `:latest` [*Dockerfile*](https://github.com/eea/eea.docker.postfix/blob/master/Dockerfile) (default)
- `:eionet` [*Dockerfile*](https://github.com/eea/eea.docker.postfix/blob/master/eionet/Dockerfile) (EEA specific)
- `:2.10.1` [*Dockerfile*](https://github.com/eea/eea.docker.postfix/blob/2.10.1/Dockerfile) (centos 7, chaperone, support more environment variables)
- `:2.10` [*Dockerfile*](https://github.com/eea/eea.docker.postfix/blob/2.10/Dockerfile) (centos 7, chaperone)
- `:2.6` [*Dockerfile*](https://github.com/eea/eea.docker.postfix/blob/2.6/Dockerfile) (centos 6)
......@@ -59,6 +60,18 @@ From another application container ("app"):
>>> s = smtplib.SMTP('postfixcontainer')
>>> s.sendmail('test@mydomain.com', ['user@example.com'], 'test')
## Supported environment variables
* `MTP_HOST` The `myhostname` parameter specifies the internet hostname of this mail system
* `MTP_DESTINATION` The `mydestination` parameter specifies the list of domains that this machine considers itself the final destination for.
* `MTP_BANNER` The `smtpd_banner` parameter specifies the text that follows the 220 code in the SMTP server's greeting banner.
* `MTP_RELAY` The `relayhost` parameter specifies the default host to send mail to when no entry is matched in the optional transport(5) table.
* `MTP_RELAY_DOMAINS` The `relay_domains` parameter restricts what destinations this system will relay mail to.
* `MTP_PORT` The `relayhost` port
* `MTP_USER` The user used to connect to the `relayhost`
* `MTP_PASS` The password used to connect to the `relayhost`
* `MTP_INTERFACES` The `inet_interfaces` parameter specifies the network interface addresses that this mail system receives mail on.
## Copyright and license
The Initial Owner of the Original Code is European Environment Agency (EEA).
......
......@@ -10,14 +10,32 @@ function setup_conf_and_secret {
postconf -e 'smtp_sasl_security_options = noanonymous'
postconf -e 'smtp_tls_security_level = may'
postconf -e 'mynetworks = 127.0.0.0/8 172.17.0.0/16'
postconf -e 'local_recipient_maps ='
echo "$MTP_RELAY $MTP_USER:$MTP_PASS" > /etc/postfix/relay_passwd
postmap /etc/postfix/relay_passwd
}
postconf -e "myhostname = $MTP_HOST"
postconf -e 'inet_interfaces = all'
if [ -z "$MTP_INTERFACES" ]; then
postconf -e 'inet_interfaces = all'
else
postconf -e 'inet_interfaces = $MTP_INTERFACES'
fi
if [ ! -z "$MTP_HOST" ]; then
postconf -e 'myhostname = $MTP_HOST'
fi
if [ ! -z "$MTP_DESTINATION" ]; then
postconf -e 'mydestination = $MTP_DESTINATION'
fi
if [ ! -z "$MTP_BANNER" ]; then
postconf -e 'smtpd_banner = $MTP_BANNER'
fi
if [ ! -z "$MTP_RELAY_DOMAINS" ]; then
postconf -e 'relay_domains = $MTP_RELAY_DOMAINS'
fi
if [ ! -z "$MTP_RELAY" -a ! -z "$MTP_PORT" -a ! -z "$MTP_USER" -a ! -z "$MTP_PASS" ]; then
setup_conf_and_secret
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment