From 6090ec0c2f9f4a04267acb026f3a5f1a90415ce9 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Tue, 2 Jan 2018 10:32:30 +0100 Subject: [PATCH 1/3] 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/3] 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 ); From cde250a989e9a9d72c6856663e383d0a8e73d770 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Mon, 8 Jan 2018 19:56:44 +0100 Subject: [PATCH 3/3] Properly wait for MySQL to come up before starting SOGo --- data/Dockerfiles/sogo/bootstrap-sogo.sh | 7 ++++--- docker-compose.yml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/data/Dockerfiles/sogo/bootstrap-sogo.sh b/data/Dockerfiles/sogo/bootstrap-sogo.sh index 77fad531..4bd9d570 100755 --- a/data/Dockerfiles/sogo/bootstrap-sogo.sh +++ b/data/Dockerfiles/sogo/bootstrap-sogo.sh @@ -1,7 +1,10 @@ #!/bin/bash # Wait for MySQL to warm-up -while mysqladmin ping --host mysql -u${DBUSER} -p${DBPASS}${DBPASS} --silent; do +while ! mysqladmin ping --host mysql -u${DBUSER} -p${DBPASS} --silent; do + echo "Waiting for database to come up..." + sleep 2 +done # Wait until port becomes free and send sig until ! nc -z sogo-mailcow 20000; @@ -101,5 +104,3 @@ chown sogo:sogo -R /var/lib/sogo/ chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist exec gosu sogo /usr/sbin/sogod - -done diff --git a/docker-compose.yml b/docker-compose.yml index 7f7b548b..438ef4dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -124,7 +124,7 @@ services: - phpfpm sogo-mailcow: - image: mailcow/sogo:1.12 + image: mailcow/sogo:1.13 build: ./data/Dockerfiles/sogo environment: - DBNAME=${DBNAME}