unbound: fixup defaults in migration and namespace changes

This commit is contained in:
Stephan de Wit 2023-03-17 15:57:30 +01:00
parent a50897b517
commit ffc1c438e0
4 changed files with 16 additions and 9 deletions

View File

@ -289,9 +289,6 @@
</range>
</lan>
</dhcpd>
<unbound>
<enable>1</enable>
</unbound>
<snmpd>
<syslocation/>
<syscontact/>
@ -381,4 +378,12 @@
<sequence>system_information-container:00000000-col3:show,services_status-container:00000001-col4:show,gateways-container:00000002-col4:show,interface_list-container:00000003-col4:show</sequence>
<column_count>2</column_count>
</widgets>
<OPNsense>
<unboundplus version="1.0.5">
<general>
<enabled>1</enabled>
<port>53</port>
</general>
</unboundplus>
</OPNsense>
</opnsense>

View File

@ -221,7 +221,7 @@ function unbound_generate_config()
unbound_add_host_entries($ifconfig_details);
unbound_acls_config();
$port = $general['port'] ?? '53';
$port = $general['port'];
/* do not touch prefer-ip6 as it is defaulting to 'no' anyway */
$do_ip6 = isset($config['system']['ipv6allow']) ? 'yes' : 'no';

View File

@ -39,13 +39,15 @@ class M1_0_5 extends BaseModelMigration
$new = [];
foreach ($model->general->iterateItems() as $key => $node) {
if (isset($config->unbound->$key)) {
if ($key == 'port' && empty($config->unbound->port)) {
$model->general->port->applyDefault();
continue;
}
$new[$key] = $config->unbound->$key;
}
}
if (isset($config->unbound->enable)) {
$new['enabled'] = $config->unbound->enable;
}
$new['enabled'] = isset($config->unbound->enable) ? '1' : '0';
$model->general->setNodes($new);
}

View File

@ -114,13 +114,13 @@
<name>Enable Resolver</name>
<type>checkbox</type>
<value>yes</value>
<bindstofield>unbound->enable</bindstofield>
<bindstofield>OPNsense->unboundplus->general->enabled</bindstofield>
</field>
<field>
<name>Enable DNSSEC Support</name>
<type>checkbox</type>
<value></value>
<bindstofield>unbound->dnssec</bindstofield>
<bindstofield>OPNsense->unboundplus->general->dnssec</bindstofield>
</field>
<field>
<name>Harden DNSSEC data</name>