create empty dns-server config if no (dns-enabled) domain is determined; fixes #1230

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2024-01-24 08:38:32 +01:00
parent 13e88f5b47
commit 7980b8d14d
2 changed files with 18 additions and 21 deletions

View File

@@ -55,18 +55,17 @@ class Bind extends DnsBase
$domains = $this->getDomainList(); $domains = $this->getDomainList();
if (empty($domains)) { if (empty($domains)) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, skipping...'); $this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, not creating any zones...');
return; $this->bindconf_file = '';
} } else {
$this->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";
$this->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"; foreach ($domains as $domain) {
if ($domain['is_child']) {
foreach ($domains as $domain) { // domains that are subdomains to other main domains are handled by recursion within walkDomainList()
if ($domain['is_child']) { continue;
// domains that are subdomains to other main domains are handled by recursion within walkDomainList() }
continue; $this->walkDomainList($domain, $domains);
} }
$this->walkDomainList($domain, $domains);
} }
$bindconf_file_handler = fopen(FileDir::makeCorrectFile(Settings::Get('system.bindconf_directory') . '/froxlor_bind.conf'), 'w'); $bindconf_file_handler = fopen(FileDir::makeCorrectFile(Settings::Get('system.bindconf_directory') . '/froxlor_bind.conf'), 'w');

View File

@@ -45,18 +45,16 @@ class PowerDNS extends DnsBase
$this->clearZoneTables($domains); $this->clearZoneTables($domains);
if (empty($domains)) { if (empty($domains)) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, skipping...'); $this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, not creating any zones...');
return; } else {
} foreach ($domains as $domain) {
if ($domain['is_child']) {
foreach ($domains as $domain) { // domains that are subdomains to other main domains are handled by recursion within walkDomainList()
if ($domain['is_child']) { continue;
// domains that are subdomains to other main domains are handled by recursion within walkDomainList() }
continue; $this->walkDomainList($domain, $domains);
} }
$this->walkDomainList($domain, $domains);
} }
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'PowerDNS database updated'); $this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'PowerDNS database updated');
$this->reloadDaemon(); $this->reloadDaemon();
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'Task4 finished'); $this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'Task4 finished');