Adding the PERMIT_DOCKER option

See README.md for more informations
This commit is contained in:
Zehir 2016-08-19 11:22:12 +02:00
parent 0e8934c151
commit 3ce36b9848
3 changed files with 27 additions and 1 deletions

View File

@ -141,3 +141,10 @@ Otherwise, `iptables` won't be able to ban IPs.
- self-signed => Enables self-signed certificates
Please read [the SSL page in the wiki](https://github.com/tomav/docker-mailserver/wiki/Configure-SSL) for more information.
##### PERMIT_DOCKER
Set different options for mynetworks option (can be overwrite in postfix-main.cf)
- **empty** => localhost only
- host => Add docker host (ipv4 only)
- network => Add all docker containers (ipv4 only)

View File

@ -11,7 +11,7 @@ alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.17.0.0/16
mynetworks = 127.0.0.0/8 [::1]/128 [fe80::]/64
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

View File

@ -202,6 +202,25 @@ echo "Postfix configurations"
touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox
touch /etc/postfix/virtual && postmap /etc/postfix/virtual
# My Network Configuration
case $PERMIT_DOCKER in
"host" )
echo "Adding host in my networks"
postconf -e "$(postconf -d | grep '^mynetworks =')"
;;
"network" )
echo "Adding docker network in my networks"
postconf -e "$(postconf | grep '^mynetworks =') 172.0.0.0/8"
;;
* )
echo "Adding container ip in my networks"
postconf -e "$(postconf | grep '^mynetworks =') $(ip addr show eth0 | grep 'inet ' | sed 's/[^0-9\.\/]*//g' | cut -d '/' -f 1)/32"
;;
esac
#
# Override Postfix configuration
#