Merge pull request #1899 from mailcow/alias-autodiscover
Hide autodiscover records on DNS page for alias domains
This commit is contained in:
commit
58d0f51242
@ -10,9 +10,11 @@ define('state_optional', " <sup>2</sup>");
|
|||||||
if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "admin"|| $_SESSION['mailcow_cc_role'] == "domainadmin")) {
|
if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "admin"|| $_SESSION['mailcow_cc_role'] == "domainadmin")) {
|
||||||
|
|
||||||
$domains = mailbox('get', 'domains');
|
$domains = mailbox('get', 'domains');
|
||||||
foreach(mailbox('get', 'domains') as $dn) {
|
$alias_domains = array();
|
||||||
$domains = array_merge($domains, mailbox('get', 'alias_domains', $dn));
|
foreach($domains as $dn) {
|
||||||
|
$alias_domains = array_merge($alias_domains, mailbox('get', 'alias_domains', $dn));
|
||||||
}
|
}
|
||||||
|
$domains = array_merge($domains, $alias_domains);
|
||||||
|
|
||||||
if (isset($_GET['domain'])) {
|
if (isset($_GET['domain'])) {
|
||||||
if (is_valid_domain_name($_GET['domain'])) {
|
if (is_valid_domain_name($_GET['domain'])) {
|
||||||
@ -105,6 +107,7 @@ if ($_SESSION['mailcow_cc_role'] == "admin") {
|
|||||||
'TLSA',
|
'TLSA',
|
||||||
generate_tlsa_digest($autodiscover_config['smtp']['server'], 25, 1)
|
generate_tlsa_digest($autodiscover_config['smtp']['server'], 25, 1)
|
||||||
);
|
);
|
||||||
|
if (!in_array($domain, $alias_domains)) {
|
||||||
$records[] = array(
|
$records[] = array(
|
||||||
'_'.$https_port.
|
'_'.$https_port.
|
||||||
'._tcp.'.$mailcow_hostname,
|
'._tcp.'.$mailcow_hostname,
|
||||||
@ -154,11 +157,13 @@ if ($_SESSION['mailcow_cc_role'] == "admin") {
|
|||||||
generate_tlsa_digest($autodiscover_config['sieve']['server'], $autodiscover_config['sieve']['port'], 1)
|
generate_tlsa_digest($autodiscover_config['sieve']['server'], $autodiscover_config['sieve']['port'], 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$records[] = array(
|
$records[] = array(
|
||||||
$domain,
|
$domain,
|
||||||
'MX',
|
'MX',
|
||||||
$mailcow_hostname
|
$mailcow_hostname
|
||||||
);
|
);
|
||||||
|
if (!in_array($domain, $alias_domains)) {
|
||||||
$records[] = array(
|
$records[] = array(
|
||||||
'autodiscover.'.$domain,
|
'autodiscover.'.$domain,
|
||||||
'CNAME',
|
'CNAME',
|
||||||
@ -175,6 +180,7 @@ $records[] = array(
|
|||||||
'CNAME',
|
'CNAME',
|
||||||
$mailcow_hostname
|
$mailcow_hostname
|
||||||
);
|
);
|
||||||
|
}
|
||||||
$records[] = array(
|
$records[] = array(
|
||||||
$domain,
|
$domain,
|
||||||
'TXT',
|
'TXT',
|
||||||
@ -195,6 +201,7 @@ if (!empty($dkim = dkim('details', $domain))) {
|
|||||||
$dkim['dkim_txt']
|
$dkim['dkim_txt']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (!in_array($domain, $alias_domains)) {
|
||||||
$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') {
|
||||||
@ -264,6 +271,7 @@ if ($autodiscover_config['sieve']['port'] != '4190') {
|
|||||||
$autodiscover_config['sieve']['server'] . ' ' . $autodiscover_config['sieve']['port']
|
$autodiscover_config['sieve']['server'] . ' ' . $autodiscover_config['sieve']['port']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$record_types = array(
|
$record_types = array(
|
||||||
'A' => DNS_A,
|
'A' => DNS_A,
|
||||||
|
Loading…
Reference in New Issue
Block a user