Merge branch 'dev' into dns
This commit is contained in:
commit
2b93ad62b5
@ -2,8 +2,8 @@
|
|||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/spf.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/spf.inc.php';
|
||||||
|
|
||||||
define('state_good', '<span class="text-success">OK</span>');
|
define('state_good', '<span class="glyphicon glyphicon-ok text-success"></span>');
|
||||||
define('state_missing', "✗");
|
define('state_missing', '<span class="glyphicon glyphicon-remove text-danger"></span>');
|
||||||
define('state_nomatch', "?");
|
define('state_nomatch', "?");
|
||||||
define('state_optional', " <sup>2</sup>");
|
define('state_optional', " <sup>2</sup>");
|
||||||
|
|
||||||
@ -63,75 +63,192 @@ if (!empty($ip6)) {
|
|||||||
$https_port = strpos($_SERVER['HTTP_HOST'], ':');
|
$https_port = strpos($_SERVER['HTTP_HOST'], ':');
|
||||||
if ($https_port === FALSE) {
|
if ($https_port === FALSE) {
|
||||||
$https_port = 443;
|
$https_port = 443;
|
||||||
} else {
|
|
||||||
$https_port = substr($_SERVER['HTTP_HOST'], $https_port+1);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
$spf_link = '<a href="http://www.openspf.org/SPF_Record_Syntax" target="_blank">SPF Record Syntax</a>';
|
$https_port = substr($_SERVER['HTTP_HOST'], $https_port+1);
|
||||||
$dmarc_link = '<a href="http://www.kitterman.com/dmarc/assistant.html" target="_blank">DMARC Assistant</a>';
|
|
||||||
|
|
||||||
$records = array();
|
|
||||||
$records[] = array($mailcow_hostname, 'A', $ip);
|
|
||||||
$records[] = array($ptr, 'PTR', $mailcow_hostname);
|
|
||||||
if (!empty($ip6)) {
|
|
||||||
$records[] = array($mailcow_hostname, 'AAAA', $ip6);
|
|
||||||
$records[] = array($ptr6, 'PTR', $mailcow_hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($autodiscover_config['sieve'])) {
|
if (!isset($autodiscover_config['sieve'])) {
|
||||||
$autodiscover_config['sieve'] = array('server' => $mailcow_hostname, 'port' => array_pop(explode(':', getenv('SIEVE_PORT'))));
|
$autodiscover_config['sieve'] = array('server' => $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));
|
// Init records array
|
||||||
$records[] = array('_' . $https_port . '._tcp.' . $mailcow_hostname, 'TLSA', generate_tlsa_digest($mailcow_hostname, $https_port));
|
$records = array();
|
||||||
$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(
|
||||||
$records[] = array('_' . $autodiscover_config['imap']['tlsport'] . '._tcp.' . $autodiscover_config['imap']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['imap']['server'], $autodiscover_config['imap']['tlsport'], 1));
|
$mailcow_hostname,
|
||||||
$records[] = array('_' . $autodiscover_config['smtp']['port'] . '._tcp.' . $autodiscover_config['smtp']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['smtp']['server'], $autodiscover_config['smtp']['port']));
|
'A',
|
||||||
$records[] = array('_' . $autodiscover_config['smtp']['tlsport'] . '._tcp.' . $autodiscover_config['smtp']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['smtp']['server'], $autodiscover_config['smtp']['tlsport'], 1));
|
$ip
|
||||||
$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(
|
||||||
$records[] = array('_' . $autodiscover_config['sieve']['port'] . '._tcp.' . $autodiscover_config['sieve']['server'], 'TLSA', generate_tlsa_digest($autodiscover_config['sieve']['server'], $autodiscover_config['sieve']['port'], 1));
|
$ptr,
|
||||||
$records[] = array($domain, 'MX', $mailcow_hostname);
|
'PTR',
|
||||||
$records[] = array('autodiscover.' . $domain, 'CNAME', $mailcow_hostname);
|
$mailcow_hostname
|
||||||
$records[] = array('_autodiscover._tcp.' . $domain, 'SRV', $mailcow_hostname . ' ' . $https_port);
|
);
|
||||||
$records[] = array('autoconfig.' . $domain, 'CNAME', $mailcow_hostname);
|
if (!empty($ip6)) {
|
||||||
$records[] = array($domain, 'TXT', $spf_link, state_optional);
|
$records[] = array(
|
||||||
$records[] = array('_dmarc.' . $domain, 'TXT', $dmarc_link, state_optional);
|
$mailcow_hostname,
|
||||||
|
'AAAA',
|
||||||
|
$ip6
|
||||||
|
);
|
||||||
|
$records[] = array(
|
||||||
|
$ptr6,
|
||||||
|
'PTR',
|
||||||
|
$mailcow_hostname
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$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)
|
||||||
|
);
|
||||||
|
$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',
|
||||||
|
'<a href="http://www.openspf.org/SPF_Record_Syntax" target="_blank">SPF Record Syntax</a>',
|
||||||
|
state_optional
|
||||||
|
);
|
||||||
|
$records[] = array(
|
||||||
|
'_dmarc.' . $domain,
|
||||||
|
'TXT',
|
||||||
|
'<a href="http://www.kitterman.com/dmarc/assistant.html" target="_blank">DMARC Assistant</a>',
|
||||||
|
state_optional
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($dkim = dkim('details', $domain))) {
|
if (!empty($dkim = dkim('details', $domain))) {
|
||||||
$records[] = array($dkim['dkim_selector'] . '._domainkey.' . $domain, 'TXT', $dkim['dkim_txt']);
|
$records[] = array(
|
||||||
|
$dkim['dkim_selector'] . '._domainkey.' . $domain,
|
||||||
|
'TXT',
|
||||||
|
$dkim['dkim_txt']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV);
|
$current_records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV);
|
||||||
if (count($current_records) == 0 || $current_records[0]['target'] != '') {
|
if (count($current_records) == 0 || $current_records[0]['target'] != '') {
|
||||||
if ($autodiscover_config['pop3']['tlsport'] != '110') {
|
if ($autodiscover_config['pop3']['tlsport'] != '110') {
|
||||||
$records[] = array('_pop3._tcp.' . $domain, 'SRV', $autodiscover_config['pop3']['server'] . ' ' . $autodiscover_config['pop3']['tlsport']);
|
$records[] = array(
|
||||||
|
'_pop3._tcp.' . $domain,
|
||||||
|
'SRV',
|
||||||
|
$autodiscover_config['pop3']['server'] . ' ' . $autodiscover_config['pop3']['tlsport']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
$records[] = array('_pop3._tcp.' . $domain, 'SRV', '. 0');
|
else {
|
||||||
|
$records[] = array(
|
||||||
|
'_pop3._tcp.' . $domain,
|
||||||
|
'SRV',
|
||||||
|
'. 0'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$current_records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV);
|
$current_records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV);
|
||||||
if (count($current_records) == 0 || $current_records[0]['target'] != '') {
|
if (count($current_records) == 0 || $current_records[0]['target'] != '') {
|
||||||
if ($autodiscover_config['pop3']['port'] != '995') {
|
if ($autodiscover_config['pop3']['port'] != '995') {
|
||||||
$records[] = array('_pop3s._tcp.' . $domain, 'SRV', $autodiscover_config['pop3']['server'] . ' ' . $autodiscover_config['pop3']['port']);
|
$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') {
|
else {
|
||||||
$records[] = array('_imap._tcp.' . $domain, 'SRV', $autodiscover_config['imap']['server'] . ' ' . $autodiscover_config['imap']['tlsport']);
|
$records[] = array(
|
||||||
|
'_pop3s._tcp.' . $domain,
|
||||||
|
'SRV',
|
||||||
|
'. 0'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($autodiscover_config['imap']['port'] != '993') {
|
if ($autodiscover_config['imap']['tlsport'] != '143') {
|
||||||
$records[] = array('_imaps._tcp.' . $domain, 'SRV', $autodiscover_config['imap']['server'] . ' ' . $autodiscover_config['imap']['port']);
|
$records[] = array(
|
||||||
|
'_imap._tcp.' . $domain,
|
||||||
|
'SRV',
|
||||||
|
$autodiscover_config['imap']['server'] . ' ' . $autodiscover_config['imap']['tlsport']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($autodiscover_config['smtp']['tlsport'] != '587') {
|
if ($autodiscover_config['imap']['port'] != '993') {
|
||||||
$records[] = array('_submission._tcp.' . $domain, 'SRV', $autodiscover_config['smtp']['server'] . ' ' . $autodiscover_config['smtp']['tlsport']);
|
$records[] = array(
|
||||||
|
'_imaps._tcp.' . $domain,
|
||||||
|
'SRV',
|
||||||
|
$autodiscover_config['imap']['server'] . ' ' . $autodiscover_config['imap']['port']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($autodiscover_config['smtp']['port'] != '465') {
|
if ($autodiscover_config['smtp']['tlsport'] != '587') {
|
||||||
$records[] = array('_smtps._tcp.' . $domain, 'SRV', $autodiscover_config['smtp']['server'] . ' ' . $autodiscover_config['smtp']['port']);
|
$records[] = array(
|
||||||
|
'_submission._tcp.' . $domain,
|
||||||
|
'SRV',
|
||||||
|
$autodiscover_config['smtp']['server'] . ' ' . $autodiscover_config['smtp']['tlsport']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($autodiscover_config['sieve']['port'] != '4190') {
|
if ($autodiscover_config['smtp']['port'] != '465') {
|
||||||
$records[] = array('_sieve._tcp.' . $domain, 'SRV', $autodiscover_config['sieve']['server'] . ' ' . $autodiscover_config['sieve']['port']);
|
$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(
|
$record_types = array(
|
||||||
@ -154,9 +271,14 @@ $data_field = array(
|
|||||||
'TXT' => 'txt',
|
'TXT' => 'txt',
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
<div class="table-responsive" id="dnstable">
|
<div class="table-responsive" id="dnstable">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr> <th><?=$lang['diagnostics']['dns_records_name'];?></th> <th><?=$lang['diagnostics']['dns_records_type'];?></th> <th><?=$lang['diagnostics']['dns_records_data'];?></th ><th><?=$lang['diagnostics']['dns_records_status'];?></th> </tr>
|
<tr>
|
||||||
|
<th><?=$lang['diagnostics']['dns_records_name'];?></th>
|
||||||
|
<th><?=$lang['diagnostics']['dns_records_type'];?></th>
|
||||||
|
<th><?=$lang['diagnostics']['dns_records_data'];?></th>
|
||||||
|
<th><?=$lang['diagnostics']['dns_records_status'];?></th>
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
foreach ($records as $record) {
|
foreach ($records as $record) {
|
||||||
$record[1] = strtoupper($record[1]);
|
$record[1] = strtoupper($record[1]);
|
||||||
@ -187,10 +309,9 @@ foreach ($records as $record) {
|
|||||||
}
|
}
|
||||||
elseif ($record[1] == 'TXT') {
|
elseif ($record[1] == 'TXT') {
|
||||||
foreach ($currents as &$current) {
|
foreach ($currents as &$current) {
|
||||||
if ($current['host'] != $record[0]) {
|
unset($current);
|
||||||
$current['type'] = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
unset($current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,11 +335,7 @@ foreach ($records as $record) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($currents as &$current) {
|
foreach ($currents as &$current) {
|
||||||
if ($current['type'] != $record[1]) {
|
if ($current['type'] == 'TXT' &&
|
||||||
unset($current);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
elseif ($current['type'] == 'TXT' &&
|
|
||||||
stripos($current['txt'], 'v=dmarc') === 0 &&
|
stripos($current['txt'], 'v=dmarc') === 0 &&
|
||||||
$record[2] == $dmarc_link) {
|
$record[2] == $dmarc_link) {
|
||||||
$current['txt'] = str_replace(' ', '', $current['txt']);
|
$current['txt'] = str_replace(' ', '', $current['txt']);
|
||||||
@ -247,8 +364,10 @@ foreach ($records as $record) {
|
|||||||
}
|
}
|
||||||
unset($current);
|
unset($current);
|
||||||
|
|
||||||
if (isset($record[3]) && $record[3] == state_optional && ($state == state_missing || $state == state_nomatch)) {
|
if (isset($record[3]) &&
|
||||||
$state = state_optional;
|
$record[3] == state_optional &&
|
||||||
|
($state == state_missing || $state == state_nomatch)) {
|
||||||
|
$state = state_optional;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($state == state_nomatch) {
|
if ($state == state_nomatch) {
|
||||||
@ -266,12 +385,12 @@ foreach ($records as $record) {
|
|||||||
</tr>', $record[0], $record[1], $record[2], $state);
|
</tr>', $record[0], $record[1], $record[2], $state);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
<sup>1</sup> <?=$lang['diagnostics']['cname_from_a'];?><br />
|
<sup>1</sup> <?=$lang['diagnostics']['cname_from_a'];?><br />
|
||||||
<sup>2</sup> <?=$lang['diagnostics']['optional'];?>
|
<sup>2</sup> <?=$lang['diagnostics']['optional'];?>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo "Session invalid";
|
echo "Session invalid";
|
||||||
|
@ -55,7 +55,7 @@ exit;
|
|||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php';
|
||||||
|
|
||||||
// Set language
|
// Set language
|
||||||
if (!isset($_SESSION['mailcow_locale'])) {
|
if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) {
|
||||||
if ($DETECT_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
if ($DETECT_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
$header_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
$header_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
||||||
foreach ($AVAILABLE_LANGUAGES as $available_lang) {
|
foreach ($AVAILABLE_LANGUAGES as $available_lang) {
|
||||||
@ -68,8 +68,12 @@ if (!isset($_SESSION['mailcow_locale'])) {
|
|||||||
$_SESSION['mailcow_locale'] = strtolower(trim($DEFAULT_LANG));
|
$_SESSION['mailcow_locale'] = strtolower(trim($DEFAULT_LANG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_COOKIE['mailcow_locale'])) {
|
||||||
|
$_SESSION['mailcow_locale'] = $_COOKIE['mailcow_locale'];
|
||||||
|
}
|
||||||
if (isset($_GET['lang']) && in_array($_GET['lang'], $AVAILABLE_LANGUAGES)) {
|
if (isset($_GET['lang']) && in_array($_GET['lang'], $AVAILABLE_LANGUAGES)) {
|
||||||
$_SESSION['mailcow_locale'] = $_GET['lang'];
|
$_SESSION['mailcow_locale'] = $_GET['lang'];
|
||||||
|
setcookie("mailcow_locale", $_GET['lang'], time()+30758400); // one year
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en.php';
|
||||||
|
Loading…
Reference in New Issue
Block a user