cron_tasks/bind: fix conditions for mail-related records
This patch adds isemaildomain==1 as an additional condition for the creation of mx/imap/smtp/pop3/spf-txt records for a domain. For the hostname entry, this depends on the system setting dns_createmailentry.
This commit is contained in:
committed by
Daniel Reichelt
parent
627e22a2e6
commit
427b7492dc
@@ -76,9 +76,12 @@ class bind {
|
|||||||
|
|
||||||
$this->_known_filenames = array();
|
$this->_known_filenames = array();
|
||||||
|
|
||||||
$bindconf_file = '# ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf' . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n";
|
$bindconf_file = '# ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf' . "\n" .
|
||||||
|
'# Created ' . date('d.m.Y H:i') . "\n" .
|
||||||
|
'# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n";
|
||||||
$result_domains_stmt = Database::query("
|
$result_domains_stmt = Database::query("
|
||||||
SELECT `d`.`id`, `d`.`domain`, `d`.`iswildcarddomain`, `d`.`wwwserveralias`, `d`.`customerid`, `d`.`zonefile`, `d`.`bindserial`, `d`.`dkim`, `d`.`dkim_id`, `d`.`dkim_pubkey`, `c`.`loginname`, `c`.`guid`
|
SELECT `d`.`id`, `d`.`domain`, `d`.`isemaildomain`, `d`.`iswildcarddomain`, `d`.`wwwserveralias`, `d`.`customerid`,
|
||||||
|
`d`.`zonefile`, `d`.`bindserial`, `d`.`dkim`, `d`.`dkim_id`, `d`.`dkim_pubkey`, `c`.`loginname`, `c`.`guid`
|
||||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
|
FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
|
||||||
WHERE `d`.`isbinddomain` = '1' ORDER BY `d`.`domain` ASC
|
WHERE `d`.`isbinddomain` = '1' ORDER BY `d`.`domain` ASC
|
||||||
");
|
");
|
||||||
@@ -93,6 +96,7 @@ class bind {
|
|||||||
$hostname_arr = array(
|
$hostname_arr = array(
|
||||||
'id' => 'none',
|
'id' => 'none',
|
||||||
'domain' => Settings::Get('system.hostname'),
|
'domain' => Settings::Get('system.hostname'),
|
||||||
|
'isemaildomain' => Settings::Get('system.dns_createmailentry'),
|
||||||
'customerid' => 'none',
|
'customerid' => 'none',
|
||||||
'loginname' => 'froxlor.panel',
|
'loginname' => 'froxlor.panel',
|
||||||
'bindserial' => date('Ymd').'00',
|
'bindserial' => date('Ymd').'00',
|
||||||
@@ -268,38 +272,40 @@ class bind {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->mxservers) == 0) {
|
if ($domain['isemaildomain'] === '1') {
|
||||||
$zonefile.= '@ IN MX 10 mail' . "\n";
|
if (count($this->mxservers) == 0) {
|
||||||
$records[] = 'mail';
|
$zonefile.= '@ IN MX 10 mail' . "\n";
|
||||||
if ($domain['iswildcarddomain'] != '1') {
|
|
||||||
$records[] = 'imap';
|
|
||||||
$records[] = 'smtp';
|
|
||||||
$records[] = 'pop3';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ($this->mxservers as $mxserver) {
|
|
||||||
$zonefile.= '@ IN MX ' . trim($mxserver) . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings::Get('system.dns_createmailentry') == '1') {
|
|
||||||
$records[] = 'mail';
|
$records[] = 'mail';
|
||||||
if ($domain['iswildcarddomain'] != '1') {
|
if ($domain['iswildcarddomain'] != '1') {
|
||||||
$records[] = 'imap';
|
$records[] = 'imap';
|
||||||
$records[] = 'smtp';
|
$records[] = 'smtp';
|
||||||
$records[] = 'pop3';
|
$records[] = 'pop3';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
foreach ($this->mxservers as $mxserver) {
|
||||||
|
$zonefile.= '@ IN MX ' . trim($mxserver) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
if (Settings::Get('system.dns_createmailentry') == '1') {
|
||||||
* @TODO domain-based spf-settings
|
$records[] = 'mail';
|
||||||
*/
|
if ($domain['iswildcarddomain'] != '1') {
|
||||||
if (Settings::Get('spf.use_spf') == '1'
|
$records[] = 'imap';
|
||||||
/*&& $domain['spf'] == '1' */
|
$records[] = 'smtp';
|
||||||
) {
|
$records[] = 'pop3';
|
||||||
$zonefile.= Settings::Get('spf.spf_entry') . "\n";
|
}
|
||||||
if (in_array('mail', $records)) {
|
}
|
||||||
$zonefile.= str_replace('@', 'mail', Settings::Get('spf.spf_entry')) . "\n";
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @TODO domain-based spf-settings
|
||||||
|
*/
|
||||||
|
if (Settings::Get('spf.use_spf') == '1'
|
||||||
|
/*&& $domain['spf'] == '1' */
|
||||||
|
) {
|
||||||
|
$zonefile.= Settings::Get('spf.spf_entry') . "\n";
|
||||||
|
if (in_array('mail', $records)) {
|
||||||
|
$zonefile.= str_replace('@', 'mail', Settings::Get('spf.spf_entry')) . "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user