From 6090ec0c2f9f4a04267acb026f3a5f1a90415ce9 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Tue, 2 Jan 2018 10:32:30 +0100 Subject: [PATCH 1/2] DNS diagnostics: show correct TXT records --- data/web/diagnostics.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/data/web/diagnostics.php b/data/web/diagnostics.php index b988747d..09d5740d 100644 --- a/data/web/diagnostics.php +++ b/data/web/diagnostics.php @@ -73,13 +73,16 @@ $records[] = array('_' . $autodiscover_config['imap']['port'] . '._tcp.' . $a $records[] = array('_' . $autodiscover_config['pop3']['port'] . '._tcp.' . $autodiscover_config['pop3']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['pop3']['server'], $autodiscover_config['pop3']['port'])); $records[] = array('_' . $autodiscover_config['sieve']['port'] . '._tcp.' . $autodiscover_config['sieve']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['sieve']['server'], $autodiscover_config['sieve']['port'], 1)); +$spf_link = 'SPF Record Syntax'; +$dmarc_link = 'DMARC Assistant'; + foreach ($domains as $domain) { $records[] = array($domain, 'MX', $mailcow_hostname); $records[] = array('autodiscover.' . $domain, 'CNAME', $mailcow_hostname); $records[] = array('_autodiscover._tcp.' . $domain, 'SRV', $mailcow_hostname . ' ' . $https_port); $records[] = array('autoconfig.' . $domain, 'CNAME', $mailcow_hostname); - $records[] = array($domain, 'TXT', 'SPF Record Syntax', state_optional); - $records[] = array('_dmarc.' . $domain, 'TXT', 'DMARC Assistant', state_optional); + $records[] = array($domain, 'TXT', $spf_link, state_optional); + $records[] = array('_dmarc.' . $domain, 'TXT', $dmarc_link, state_optional); if (!empty($dkim = dkim('details', $domain))) { $records[] = array($dkim['dkim_selector'] . '._domainkey.' . $domain, 'TXT', $dkim['dkim_txt']); @@ -200,14 +203,14 @@ foreach ($records as $record) continue; } - elseif ($current['type'] == 'TXT' && strpos($current['txt'], 'v=DMARC1') === 0) { + elseif ($current['type'] == 'TXT' && strpos($current['txt'], 'v=DMARC1') === 0 && $record[2] == $dmarc_link) { $current['txt'] = str_replace(' ', '', $current['txt']); $state = state_optional . '
' . $current[$data_field[$current['type']]]; } - else if ($current['type'] == 'TXT' && strpos($current['txt'], 'v=spf1') === 0) { + else if ($current['type'] == 'TXT' && strpos($current['txt'], 'v=spf1') === 0 && $record[2] == $spf_link) { $state = state_optional . '
' . $current[$data_field[$current['type']]]; } - else if ($current['type'] == 'TXT' && strpos($current['txt'], 'v=DKIM1') === 0) { + else if ($current['type'] == 'TXT' && strpos($current['txt'], 'v=DKIM1') === 0 && strpos($record[2], 'v=DKIM1') === 0) { $current['txt'] = str_replace(' ', '', $current['txt']); if ($current[$data_field[$current['type']]] == $record[2]) $state = state_good; From 74bd635505ac2ad9173b9c741c0104fee8a3e8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Peters?= Date: Wed, 3 Jan 2018 21:00:29 +0100 Subject: [PATCH 2/2] Update dns_diagnostics.php Oops, forgot 2 vars. --- data/web/inc/ajax/dns_diagnostics.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/web/inc/ajax/dns_diagnostics.php b/data/web/inc/ajax/dns_diagnostics.php index 13179bed..d6c989b3 100644 --- a/data/web/inc/ajax/dns_diagnostics.php +++ b/data/web/inc/ajax/dns_diagnostics.php @@ -73,6 +73,9 @@ if (!isset($autodiscover_config['sieve'])) { } // Init records array +$spf_link = 'SPF Record Syntax'; +$dmarc_link = 'DMARC Assistant'; + $records = array(); $records[] = array( $mailcow_hostname, @@ -164,13 +167,13 @@ $records[] = array( $records[] = array( $domain, 'TXT', - 'SPF Record Syntax', + $spf_link, state_optional ); $records[] = array( '_dmarc.' . $domain, 'TXT', - 'DMARC Assistant', + $dmarc_link, state_optional );