mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 18:15:29 +02:00
Adding the PERMIT_DOCKER option (#270)
* Adding the PERMIT_DOCKER option See README.md for more informations * Adding some test for PERMIT_DOCKER option * Fix test cases * Opendkim and Openmarc configuration Fix docker network range Adding opendkim and openmarc configuration * Adding some options for tests * Update log message * Update tests
This commit is contained in:
parent
0e8934c151
commit
8b289f6717
5 changed files with 59 additions and 1 deletions
|
@ -202,6 +202,33 @@ echo "Postfix configurations"
|
|||
touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox
|
||||
touch /etc/postfix/virtual && postmap /etc/postfix/virtual
|
||||
|
||||
# PERMIT_DOCKER Option
|
||||
container_ip=$(ip addr show eth0 | grep 'inet ' | sed 's/[^0-9\.\/]*//g' | cut -d '/' -f 1)
|
||||
container_network="$(echo $container_ip | cut -d '.' -f1-2).0.0"
|
||||
case $PERMIT_DOCKER in
|
||||
"host" )
|
||||
echo "Adding $container_network/16 to my networks"
|
||||
postconf -e "$(postconf | grep '^mynetworks =') $container_network/16"
|
||||
bash -c "echo $container_network/16 >> /etc/opendmarc/ignore.hosts"
|
||||
bash -c "echo $container_network/16 >> /etc/opendkim/TrustedHosts"
|
||||
;;
|
||||
|
||||
"network" )
|
||||
echo "Adding docker network in my networks"
|
||||
postconf -e "$(postconf | grep '^mynetworks =') 172.16.0.0/12"
|
||||
bash -c "echo 172.16.0.0/12 >> /etc/opendmarc/ignore.hosts"
|
||||
bash -c "echo 172.16.0.0/12 >> /etc/opendkim/TrustedHosts"
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Adding container ip in my networks"
|
||||
postconf -e "$(postconf | grep '^mynetworks =') $container_ip/32"
|
||||
bash -c "echo $container_ip/32 >> /etc/opendmarc/ignore.hosts"
|
||||
bash -c "echo $container_ip/32 >> /etc/opendkim/TrustedHosts"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
#
|
||||
# Override Postfix configuration
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue