From 25ac07cae74f03a87e9256038cda0fa2640c5805 Mon Sep 17 00:00:00 2001 From: angus Date: Wed, 6 Apr 2016 19:29:39 +0200 Subject: [PATCH] Introduce the env variable ENABLE_FAIL2BAN. Modified the Makefile so that the containers startup with a short delay between each other. Corrected a small bug in start-mailserver.sh that prevented the correct configuration of the jails. --- Makefile | 5 ++++- start-mailserver.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 03899b5c..6ea1a4d4 100644 --- a/Makefile +++ b/Makefile @@ -21,18 +21,21 @@ run: -e SA_KILL=3.0 \ -e SASL_PASSWD=testing \ -h mail.my-domain.com -t $(NAME) + sleep 15 docker run -d --name mail_pop3 \ -v "`pwd`/postfix":/tmp/postfix \ -v "`pwd`/spamassassin":/tmp/spamassassin \ -v "`pwd`/test":/tmp/test \ -e ENABLE_POP3=1 \ -h mail.my-domain.com -t $(NAME) + sleep 15 docker run -d --name mail_smtponly \ -v "`pwd`/postfix":/tmp/postfix \ -v "`pwd`/spamassassin":/tmp/spamassassin \ -v "`pwd`/test":/tmp/test \ -e SMTP_ONLY=1 \ -h mail.my-domain.com -t $(NAME) + sleep 15 docker run -d --name mail_fail2ban \ -v "`pwd`/postfix":/tmp/postfix \ -v "`pwd`/spamassassin":/tmp/spamassassin \ @@ -40,7 +43,7 @@ run: -e ENABLE_FAIL2BAN=1 \ -h mail.my-domain.com -t $(NAME) # Wait for containers to fully start - sleep 60 + sleep 15 fixtures: # Sending test mails diff --git a/start-mailserver.sh b/start-mailserver.sh index 45ca5259..cff93be2 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -240,7 +240,7 @@ awk 'BEGIN{unit=0}{if ($1=="[postfix]" || $1=="[couriersmtp]" || $1=="[courierau else if ($1=="logpath" && unit==1) $3="/var/log/mail/mail.log"; print; if (unit==1 && $1~/\[/ && $1!~/postfix|couriersmtp|courierauth|sasl/) unit=0; -}'/etc/fail2ban/jail.conf > /tmp/jail.conf.new && mv /tmp/jail.conf.new /etc/fail2ban/jail.conf && rm -f /tmp/jail.conf.new +}' /etc/fail2ban/jail.conf > /tmp/jail.conf.new && mv /tmp/jail.conf.new /etc/fail2ban/jail.conf && rm -f /tmp/jail.conf.new # increase ban time and find time to 3h sed -i "/^bantime *=/c\bantime = 10800" /etc/fail2ban/jail.conf