$mailcow_hostname, 'port' => array_pop(explode(':', getenv('SIEVE_PORT')))); } $records[] = array('_25._tcp.' . $autodiscover_config['smtp']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['smtp']['server'], 25, 1)); $records[] = array('_' . $https_port . '._tcp.' . $mailcow_hostname, 'TLSA', generate_tlsa_digest($mailcow_hostname, $https_port)); $records[] = array('_' . $autodiscover_config['pop3']['tlsport'] . '._tcp.' . $autodiscover_config['pop3']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['pop3']['server'], $autodiscover_config['pop3']['tlsport'], 1)); $records[] = array('_' . $autodiscover_config['imap']['tlsport'] . '._tcp.' . $autodiscover_config['imap']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['imap']['server'], $autodiscover_config['imap']['tlsport'], 1)); $records[] = array('_' . $autodiscover_config['smtp']['port'] . '._tcp.' . $autodiscover_config['smtp']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['smtp']['server'], $autodiscover_config['smtp']['port'])); $records[] = array('_' . $autodiscover_config['smtp']['tlsport'] . '._tcp.' . $autodiscover_config['smtp']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['smtp']['server'], $autodiscover_config['smtp']['tlsport'], 1)); $records[] = array('_' . $autodiscover_config['imap']['port'] . '._tcp.' . $autodiscover_config['imap']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['imap']['server'], $autodiscover_config['imap']['port'])); $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_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']); } $current_records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV); if (count($current_records) == 0 || $current_records[0]['target'] != '') { if ($autodiscover_config['pop3']['tlsport'] != '110') { $records[] = array('_pop3._tcp.' . $domain, 'SRV', $autodiscover_config['pop3']['server'] . ' ' . $autodiscover_config['pop3']['tlsport']); } } else { $records[] = array('_pop3._tcp.' . $domain, 'SRV', '. 0'); } $current_records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); if (count($current_records) == 0 || $current_records[0]['target'] != '') { if ($autodiscover_config['pop3']['port'] != '995') { $records[] = array('_pop3s._tcp.' . $domain, 'SRV', $autodiscover_config['pop3']['server'] . ' ' . $autodiscover_config['pop3']['port']); } } else { $records[] = array('_pop3s._tcp.' . $domain, 'SRV', '. 0'); } if ($autodiscover_config['imap']['tlsport'] != '143') { $records[] = array('_imap._tcp.' . $domain, 'SRV', $autodiscover_config['imap']['server'] . ' ' . $autodiscover_config['imap']['tlsport']); } if ($autodiscover_config['imap']['port'] != '993') { $records[] = array('_imaps._tcp.' . $domain, 'SRV', $autodiscover_config['imap']['server'] . ' ' . $autodiscover_config['imap']['port']); } if ($autodiscover_config['smtp']['tlsport'] != '587') { $records[] = array('_submission._tcp.' . $domain, 'SRV', $autodiscover_config['smtp']['server'] . ' ' . $autodiscover_config['smtp']['tlsport']); } if ($autodiscover_config['smtp']['port'] != '465') { $records[] = array('_smtps._tcp.' . $domain, 'SRV', $autodiscover_config['smtp']['server'] . ' ' . $autodiscover_config['smtp']['port']); } if ($autodiscover_config['sieve']['port'] != '4190') { $records[] = array('_sieve._tcp.' . $domain, 'SRV', $autodiscover_config['sieve']['server'] . ' ' . $autodiscover_config['sieve']['port']); } } $record_types = array( 'A' => DNS_A, 'AAAA' => DNS_AAAA, 'CNAME' => DNS_CNAME, 'MX' => DNS_MX, 'PTR' => DNS_PTR, 'SRV' => DNS_SRV, 'TXT' => DNS_TXT, ); $data_field = array( 'A' => 'ip', 'AAAA' => 'ipv6', 'CNAME' => 'target', 'MX' => 'target', 'PTR' => 'target', 'SRV' => 'data', 'TLSA' => 'data', 'TXT' => 'txt', ); ?>

0 && count($cname) > 0) { if ($a[0]['ip'] == $cname[0]['ip']) { $currents = array(array('host' => $record[0], 'class' => 'IN', 'type' => 'CNAME', 'target' => $record[2])); $aaaa = dns_get_record($record[0], DNS_AAAA); $cname = dns_get_record($record[2], DNS_AAAA); if (count($aaaa) == 0 || count($cname) == 0 || $aaaa[0]['ipv6'] != $cname[0]['ipv6']) { $currents[0]['target'] = $aaaa[0]['ipv6']; } } else { $currents = array(array('host' => $record[0], 'class' => 'IN', 'type' => 'CNAME', 'target' => $a[0]['ip'])); } } } foreach ($currents as &$current) { if ($current['type'] != $record[1]) { continue; } 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 && $record[2] == $spf_link) { $state = state_optional . '
' . $current[$data_field[$current['type']]]; } 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; } else if ($current['type'] != 'TXT' && isset($data_field[$current['type']]) && $state != state_good) { $state = state_nomatch; if ($current[$data_field[$current['type']]] == $record[2]) $state = state_good; } } unset($current); if (isset($record[3]) && $record[3] == state_optional && ($state == state_missing || $state == state_nomatch)) { $state = state_optional; } if ($state == state_nomatch) { $state = array(); foreach ($currents as $current) { $state[] = $current[$data_field[$current['type']]]; } $state = implode('
', $state); } echo sprintf('', $record[0], $record[1], $record[2], $state); } ?>
%s%s%s%s