From 8a1584c3cb40aa6ba7c40c4a1c4d8968722ba4a5 Mon Sep 17 00:00:00 2001 From: j-marz Date: Sat, 3 Aug 2019 15:26:44 +1000 Subject: [PATCH 1/2] set Nameservers in opendkim.conf at start-up --- target/start-mailserver.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index c7830312..3541bbb9 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -850,6 +850,12 @@ function _setup_dkim() { local _f_keytable="/etc/opendkim/KeyTable" [ ! -f "$_f_keytable" ] && touch "$_f_keytable" fi + + # Setup nameservers paramater from /etc/resolv.conf if not defined + if ! grep '^Nameservers' /etc/opendkim.conf; then + echo "Nameservers $(grep '^nameserver' /etc/resolv.conf | awk -F " " '{print $2}')" >> /etc/opendkim.conf + notify 'inf' "Nameservers added to /etc/opendkim.conf" + fi } function _setup_ssl() { From 2f0e516d42f673fbfdeb025f57edf1c7aab575e0 Mon Sep 17 00:00:00 2001 From: j-marz Date: Sun, 4 Aug 2019 20:29:39 +1000 Subject: [PATCH 2/2] added test to check for nameservers in opendkim.conf --- test/tests.bats | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/tests.bats b/test/tests.bats index 7d6d177c..e65e6693 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -563,6 +563,11 @@ function count_processed_changes() { assert_output 2 } +@test "checking opendkim: /etc/opendkim.conf contains nameservers copied from /etc/resolv.conf" { + run docker exec mail /bin/bash -c "grep -E '^Nameservers ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' /etc/opendkim.conf" + assert_success +} + # this set of tests is of low quality. It does not test the RSA-Key size properly via openssl or similar # Instead it tests the file-size (here 511) - which may differ with a different domain names