Merge pull request #1205 from j-marz/opendkim_nameserver

set Nameservers in opendkim.conf at start-up
This commit is contained in:
Erik Wramner 2019-08-04 18:54:08 +02:00 committed by GitHub
commit 41921f82aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -850,6 +850,12 @@ function _setup_dkim() {
local _f_keytable="/etc/opendkim/KeyTable" local _f_keytable="/etc/opendkim/KeyTable"
[ ! -f "$_f_keytable" ] && touch "$_f_keytable" [ ! -f "$_f_keytable" ] && touch "$_f_keytable"
fi 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() { function _setup_ssl() {

View file

@ -563,6 +563,11 @@ function count_processed_changes() {
assert_output 2 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 # 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 # Instead it tests the file-size (here 511) - which may differ with a different domain names