From 95492f41bd66ec9669fa43c211ff6818a66d8484 Mon Sep 17 00:00:00 2001 From: Akuario Date: Mon, 1 Aug 2016 10:29:15 +0200 Subject: [PATCH 1/4] Added config folder for Postfix --- docker-compose.yml | 1 + postfix/conf/main.cf | 6 +++++- postfix/start.sh | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9a3a9cb0..497a501a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,6 +47,7 @@ services: volumes: - /freeposte/freeposte:/data - /freeposte/certs:/certs + - /freeposte/config/postfix:/config milter: build: rmilter diff --git a/postfix/conf/main.cf b/postfix/conf/main.cf index 97ac8b13..6cbeca97 100644 --- a/postfix/conf/main.cf +++ b/postfix/conf/main.cf @@ -48,4 +48,8 @@ lmtp_host_lookup = native smtpd_milters = inet:milter:9900 milter_protocol = 6 milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} -milter_default_action = tempfail \ No newline at end of file +milter_default_action = tempfail + +############### +# Extra Settings +############### diff --git a/postfix/start.sh b/postfix/start.sh index 7891be74..c8af059c 100755 --- a/postfix/start.sh +++ b/postfix/start.sh @@ -5,6 +5,25 @@ for VARIABLE in `env | cut -f1 -d=`; do sed -i "s={{ $VARIABLE }}=${!VARIABLE}=g" /etc/postfix/*.cf done +# Override Postfix configuration +if [ -f /config/main.cf ]; then + while read line; do + postconf -e "$line" + done < /config/main.cf + echo "Loaded 'config/main.cf'" +else + echo "No extra postfix settings loaded because optional '/config/main.cf' not provided." +fi + +# Include table-map files +if [ "$(ls -A /config/*.map)" ]; then + cp /config/*.map /etc/postfix/ + postmap /etc/postfix/*.map + rm /etc/postfix/*.map + chown root:root /etc/postfix/*.db + chmod 0600 /etc/postfix/*.db +fi + # Actually run Postfix rm -f /var/run/rsyslogd.pid /usr/lib/postfix/master & From 8018e9c8478ff047d24c358141746a196c8de965 Mon Sep 17 00:00:00 2001 From: Akuario Date: Mon, 1 Aug 2016 11:17:57 +0200 Subject: [PATCH 2/4] Added logs for table-map config files --- postfix/start.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/postfix/start.sh b/postfix/start.sh index c8af059c..17c7e43b 100755 --- a/postfix/start.sh +++ b/postfix/start.sh @@ -16,12 +16,15 @@ else fi # Include table-map files -if [ "$(ls -A /config/*.map)" ]; then +if ls -A /config/*.map 1> /dev/null 2>&1; then cp /config/*.map /etc/postfix/ postmap /etc/postfix/*.map rm /etc/postfix/*.map chown root:root /etc/postfix/*.db chmod 0600 /etc/postfix/*.db + echo "Loaded 'map files'" +else + echo "No extra map files loaded because optional '/config/*.map' not provided." fi # Actually run Postfix From 0bf53d023d22a92485bbd323b694f38c2f88607a Mon Sep 17 00:00:00 2001 From: Akuario Date: Tue, 2 Aug 2016 03:14:10 +0200 Subject: [PATCH 3/4] Added mac docker-compose yml to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 37cbdd4e..324b2201 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__ /admin/include pip-selfcheck.json /data +/docker-compose.mac.yml From efff62c4f80d363c31e12154d4a6de970211f8b5 Mon Sep 17 00:00:00 2001 From: Akuario Date: Tue, 2 Aug 2016 03:16:16 +0200 Subject: [PATCH 4/4] Changed config volume to overrides volume --- docker-compose.yml | 2 +- postfix/start.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 497a501a..bc99b5e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,7 +47,7 @@ services: volumes: - /freeposte/freeposte:/data - /freeposte/certs:/certs - - /freeposte/config/postfix:/config + - /freeposte/overrides:/overrides milter: build: rmilter diff --git a/postfix/start.sh b/postfix/start.sh index 17c7e43b..c0931433 100755 --- a/postfix/start.sh +++ b/postfix/start.sh @@ -6,25 +6,25 @@ for VARIABLE in `env | cut -f1 -d=`; do done # Override Postfix configuration -if [ -f /config/main.cf ]; then +if [ -f /overrides/postfix.cf ]; then while read line; do postconf -e "$line" - done < /config/main.cf - echo "Loaded 'config/main.cf'" + done < /overrides/postfix.cf + echo "Loaded '/overrides/postfix.cf'" else - echo "No extra postfix settings loaded because optional '/config/main.cf' not provided." + echo "No extra postfix settings loaded because optional '/overrides/postfix.cf' not provided." fi # Include table-map files -if ls -A /config/*.map 1> /dev/null 2>&1; then - cp /config/*.map /etc/postfix/ +if ls -A /overrides/*.map 1> /dev/null 2>&1; then + cp /overrides/*.map /etc/postfix/ postmap /etc/postfix/*.map rm /etc/postfix/*.map chown root:root /etc/postfix/*.db chmod 0600 /etc/postfix/*.db echo "Loaded 'map files'" else - echo "No extra map files loaded because optional '/config/*.map' not provided." + echo "No extra map files loaded because optional '/overrides/*.map' not provided." fi # Actually run Postfix