dns/bind: refine previous

It was decided we only want the 'ports' trick for DNS so make
sure the prerequistes for it match the reality of the setup.
This was we can also extend the validation of the DNS port like
we are going to do for Unbound to ensure a functional DNS setup
when multiple DNS servers are being used on the same box.
This commit is contained in:
Franco Fichtner
2023-03-29 08:53:52 +02:00
parent 73abcfe3b5
commit a69fa0d77d
2 changed files with 15 additions and 1 deletions
+1
View File
@@ -14,6 +14,7 @@ Plugin Changelog
* Allow multiple ACLs to be selected for Transfers/Queries (contributed by Robbert Rijkse)
* Rename Master/Slave to Primary/Secondary (contributed by Robbert Rijkse)
* Add necessary hooks to allow the plugin to be used as a standalone core DNS server
1.25
+14 -1
View File
@@ -49,9 +49,22 @@ function bind_services()
$model = new \OPNsense\Bind\General();
/* DNS service is eligable for core use when both 127.0.0.1 and ::1 are set */
$localhost4 = false;
$localhost6 = false;
foreach (explode(',', (string)$model->listenv4) as $addr) {
$localhost4 |= $addr === '127.0.0.1';
}
foreach (explode(',', (string)$model->listenv6) as $addr) {
$localhost6 |= $addr === '::1';
}
$services[] = [
/* the port may still be something other than 53, but it's safe to register a conflict for it */
'ports' => ($localhost4 && $localhost6 ? [(string)$model->port] : []),
'description' => gettext('BIND Daemon'),
'ports' => [(string)$model->port],
'configd' => [
'restart' => ['bind restart'],
'start' => ['bind start'],