From 2e4e65b705bf3d53710f56e87a60af079e1bd5db Mon Sep 17 00:00:00 2001 From: alinmear Date: Wed, 7 Jun 2017 15:35:42 +0200 Subject: [PATCH] Fix Container Startup Fails on daemon start: opendkim #621 (#627) --- Makefile | 8 ++++++++ target/start-mailserver.sh | 3 +++ test/tests.bats | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/Makefile b/Makefile index ede3f53c..d8a99868 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,13 @@ run: -e OVERRIDE_HOSTNAME=mail.my-domain.com \ -t $(NAME) sleep 15 + docker run -d --name mail_smtponly_without_config \ + -e SMTP_ONLY=1 \ + -e ENABLE_LDAP=1 \ + -e PERMIT_DOCKER=network \ + -e OVERRIDE_HOSTNAME=mail.mydomain.com \ + -t $(NAME) + sleep 15 docker run -d --name mail_override_hostname \ -v "`pwd`/test/config":/tmp/docker-mailserver \ -v "`pwd`/test":/tmp/docker-mailserver-test \ @@ -177,6 +184,7 @@ clean: mail \ mail_pop3 \ mail_smtponly \ + mail_smtponly_without_config \ mail_fail2ban \ mail_fetchmail \ fail-auth-mailer \ diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 94bddb6c..220a1e0c 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -734,6 +734,9 @@ function _setup_dkim() { chmod -R 0700 /etc/opendkim/keys/ else notify 'warn' "No DKIM key provided. Check the documentation to find how to get your keys." + + local _f_keytable="/etc/opendkim/KeyTable" + [ ! -f "$_f_keytable" ] && touch "$_f_keytable" fi } diff --git a/test/tests.bats b/test/tests.bats index 05c73536..c8700da2 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -472,6 +472,12 @@ load 'test_helper/bats-assert/load' assert_output 2 } +@test "checking opendkim: /etc/opendkim/KeyTable dummy file generated without keys provided" { + run docker exec mail_smtponly_without_config /bin/bash -c "cat /etc/opendkim/KeyTable" + assert_success +} + + @test "checking opendkim: /etc/opendkim/keys/ should contain 2 entries" { run docker exec mail /bin/sh -c "ls -l /etc/opendkim/keys/ | grep '^d' | wc -l" assert_success