Merge pull request #281 from nachtgeist/cron_tasks_bind
cron_tasks/bind: cleanup conditions for creation of mail-related and www DNS records
This commit is contained in:
@@ -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,6 +272,7 @@ class bind {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($domain['isemaildomain'] === '1') {
|
||||||
if (count($this->mxservers) == 0) {
|
if (count($this->mxservers) == 0) {
|
||||||
$zonefile.= '@ IN MX 10 mail' . "\n";
|
$zonefile.= '@ IN MX 10 mail' . "\n";
|
||||||
$records[] = 'mail';
|
$records[] = 'mail';
|
||||||
@@ -302,6 +307,7 @@ class bind {
|
|||||||
$zonefile.= str_replace('@', 'mail', Settings::Get('spf.spf_entry')) . "\n";
|
$zonefile.= str_replace('@', 'mail', Settings::Get('spf.spf_entry')) . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate dkim-zone-entries
|
* generate dkim-zone-entries
|
||||||
@@ -333,10 +339,11 @@ class bind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$records[] = '@';
|
$records[] = '@';
|
||||||
$records[] = 'www';
|
|
||||||
|
|
||||||
if ($domain['iswildcarddomain'] == '1') {
|
if ($domain['iswildcarddomain'] == '1') {
|
||||||
$records[] = '*';
|
$records[] = '*';
|
||||||
|
} else if ($domain['wwwserveralias'] == '1') {
|
||||||
|
$records[] = 'www';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$froxlorhost) {
|
if (!$froxlorhost) {
|
||||||
|
|||||||
Reference in New Issue
Block a user