From ff261675a31eaa9eb472dd838ea7d86d8536fe21 Mon Sep 17 00:00:00 2001 From: Zehir Date: Sat, 20 Aug 2016 15:40:31 +0200 Subject: [PATCH] Opendkim and Openmarc configuration Fix docker network range Adding opendkim and openmarc configuration --- target/start-mailserver.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 6e225a97..27968740 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -202,21 +202,29 @@ echo "Postfix configurations" touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox touch /etc/postfix/virtual && postmap /etc/postfix/virtual -# My Network Configuration +# 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 host in my networks" - postconf -e "$(postconf -d | grep '^mynetworks =')" + 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.0.0.0/8" + 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 =') $(ip addr show eth0 | grep 'inet ' | sed 's/[^0-9\.\/]*//g' | cut -d '/' -f 1)/32" + 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