diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php index e753a04ba..7b519c177 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php @@ -266,44 +266,6 @@ class SettingsController extends ApiMutableModelControllerBase return $this->toggleBase('aliases.alias', $uuid, $enabled); } - /* Domain overrides */ - - public function searchDomainOverrideAction() - { - return $this->searchBase( - 'domains.domain', - ['enabled', 'domain', 'server', 'description'], - "domain", - null, - SORT_NATURAL | SORT_FLAG_CASE - ); - } - - public function getDomainOverrideAction($uuid = null) - { - return $this->getBase('domain', 'domains.domain', $uuid); - } - - public function addDomainOverrideAction() - { - return $this->addBase('domain', 'domains.domain'); - } - - public function delDomainOverrideAction($uuid) - { - return $this->delBase('domains.domain', $uuid); - } - - public function setDomainOverrideAction($uuid) - { - return $this->setBase('domain', 'domains.domain', $uuid); - } - - public function toggleDomainOverrideAction($uuid, $enabled = null) - { - return $this->toggleBase('domains.domain', $uuid, $enabled); - } - /* ACLs */ public function searchAclAction() diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/OverridesController.php b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/OverridesController.php index d6fea3426..7584c0fb0 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/OverridesController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/OverridesController.php @@ -1,7 +1,7 @@ + * Copyright (C) 2022-2024 Deciso B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +37,5 @@ class OverridesController extends IndexController $this->view->pick('OPNsense/Unbound/overrides'); $this->view->formDialogHostOverride = $this->getForm("dialogHostOverride"); $this->view->formDialogHostAlias = $this->getForm("dialogHostAlias"); - $this->view->formDialogDomainOverride = $this->getForm("dialogDomainOverride"); } } diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogDomainOverride.xml b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogDomainOverride.xml deleted file mode 100644 index 3a0ffc311..000000000 --- a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogDomainOverride.xml +++ /dev/null @@ -1,44 +0,0 @@ -
- - domain.enabled - - checkbox - Enable this domain override - - - domain.domain - - text - - Domain to override (NOTE: this does not have to be a valid TLD!), - e.g. 'test' or 'mycompany.localdomain' or '1.168.192.in-addr.arpa' - - - - domain.server - - text - - IP address of the authoritative DNS server for this domain, - e.g. '192.168.100.100'. To use a non-default port for communication, - append an '@' with the port number. - - - - domain.forward_tcp_upstream - - checkbox - true - - Upstream queries use TCP only for transport regardless of global flag tcp-upstream. - Please note this setting applies to the domain, so when multiple forwarders are defined for the same domain, - all are assumed to use tcp only. - - - - domain.description - - text - You may enter a description here for your reference (not parsed). - -
diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/UnboundDomainField.php b/src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/UnboundDomainField.php deleted file mode 100755 index 3c008331a..000000000 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/UnboundDomainField.php +++ /dev/null @@ -1,71 +0,0 @@ -internalValue != null) { - $validators[] = new CallbackValidator([ - "callback" => function ($data) { - if (substr($data, 0, 6) == '_msdcs') { - $subdomain = substr($data, 7); - if (substr($data, 6, 1) != '.' || !Util::isDomain($subdomain)) { - return [gettext("A valid domain must be specified after '_msdcs', prefixed with a dot")]; - } - } elseif (!Util::isDomain($data)) { - return [gettext("A valid domain must be specified")]; - } - return []; - } - ]); - } - - return $validators; - } -} diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/UnboundServerField.php b/src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_11.php similarity index 51% rename from src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/UnboundServerField.php rename to src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_11.php index 895bc8d21..c139bdcf1 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/UnboundServerField.php +++ b/src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_11.php @@ -1,7 +1,7 @@ internalValue != null) { - $validators[] = new CallbackValidator([ - "callback" => function ($value) { - $parts = explode("@", $value); - if (count($parts) == 2 && (!Util::isIpAddress($parts[0]) || !Util::isPort($parts[1]))) { - return [gettext("A valid IP address and port must be specified, for example 192.168.100.10@5353.")]; - } elseif (count($parts) != 2 && !Util::isIpAddress($value)) { - return [gettext("A valid IP address must be specified, for example 192.168.100.10.")]; - } - return []; + $config = Config::getInstance()->object(); + if (isset($config->OPNsense->unboundplus) && isset($config->OPNsense->unboundplus->domains->domain)) { + foreach ($config->OPNsense->unboundplus->domains->children() as $domain) { + $new_item = $model->dots->dot->Add(); + $new_item->enabled = (string)$domain->enabled; + $new_item->type = 'forward'; + $new_item->domain = (string)$domain->domain; + $parts = explode('@', (string)$domain->server); + $new_item->server = $parts[0]; + if (isset($parts[1])) { + $new_item->port = $parts[1]; } - ]); + } } - return $validators; } } diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml b/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml index 7f4f7852c..9f15e2d1a 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml @@ -1,7 +1,7 @@ //OPNsense/unboundplus Unbound configuration - 1.0.10 + 1.0.11 @@ -390,26 +390,5 @@ - - - - 1 - Y - - - Y - A valid domain must be specified. - - - Y - A valid IP must be specified. - - - 0 - Y - - - - diff --git a/src/opnsense/mvc/app/views/OPNsense/Unbound/overrides.volt b/src/opnsense/mvc/app/views/OPNsense/Unbound/overrides.volt index 8b2ff1ef2..587e04074 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Unbound/overrides.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Unbound/overrides.volt @@ -185,7 +185,6 @@ $( document ).ready(function() {
@@ -220,35 +219,6 @@ $( document ).ready(function() { {{ lang._('Keep in mind that all resource record types (i.e. A, AAAA, MX, etc. records) of a specified host below are being overwritten.') }}
- -
- - - - - - - - - - - - - - - - - - - -
{{ lang._('ID') }}{{ lang._('Enabled') }}{{ lang._('Domain') }}{{ lang._('IP') }}{{ lang._('Description') }}{{ lang._('Edit') }} | {{ lang._('Delete') }}
- - -
-
- {{ lang._('Entries in this area override an entire domain by specifying an authoritative DNS server to be queried for that domain.') }} -
-
diff --git a/src/opnsense/service/templates/OPNsense/Unbound/core/domainoverrides.conf b/src/opnsense/service/templates/OPNsense/Unbound/core/domainoverrides.conf index 35bc4d10c..d26dd309e 100644 --- a/src/opnsense/service/templates/OPNsense/Unbound/core/domainoverrides.conf +++ b/src/opnsense/service/templates/OPNsense/Unbound/core/domainoverrides.conf @@ -1,29 +1 @@ -{% if not helpers.empty('OPNsense.unboundplus.domains.domain') %} -{% set forwardlocal = namespace(found=False) %} -{% set domain_opts = namespace(forward_tcp_upstream=False) %} -{% set prev_domain = namespace(name='') %} -{% for domain in helpers.toList('OPNsense.unboundplus.domains.domain', 'domain') %} -{% if domain.enabled == '1' %} -{% if not loop.previtem or prev_domain.name != domain.domain %} -{% set domain_opts.forward_tcp_upstream = False %} -forward-zone: - name: "{{ domain.domain }}" -{% set prev_domain.name = domain.domain %} -{% if domain.server.startswith('127.') or domain.server == '::1' %} -{% set forwardlocal.found = True %} -{% endif %} -{% set domain_opts.forward_tcp_upstream = domain_opts.forward_tcp_upstream or domain.forward_tcp_upstream == '1' %} -{% endif %} - forward-addr: {{ domain.server }} -{% if not loop.nextitem or loop.nextitem.domain != domain.domain %} -{% if domain_opts.forward_tcp_upstream %} - forward-tcp-upstream: yes -{% endif %} -{% endif %} -{% endif %} -{% endfor %} -{% if forwardlocal.found %} -server: - do-not-query-localhost: no -{% endif %} -{% endif %} +# contents migrated to dot.conf ({empty} file kept intentionally) \ No newline at end of file