Skip to content

Commit ce24078

Browse files
dns/bind: Forwarding feature expansion
Expands the forwarding feature set by: 1. Adding global "forward only" option to forwarders 2. Adding "forward only" option to forward zones 3. Improving forward zone dialog help expansion and reformatting 4. Bumps model versions: * General to v1.0.13 * Domain to v1.1.3 Signed-off-by: benyamin-codez <[email protected]>
1 parent 25b4d65 commit ce24078

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/dialogEditBindForwardDomain.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99
<id>domain.domainname</id>
1010
<label>Zone Name</label>
1111
<type>text</type>
12-
<help>Set the name for this zone. Both forward and reverse zones may be specified, i.e. example.com or 0.168.192.in-addr.arpa.</help>
12+
<help>Set the name for this zone. Both forward and reverse zones may be specified, e.g. "example.com" or "0.168.192.in-addr.arpa"</help>
13+
</field>
14+
<field>
15+
<id>domain.forwardonly</id>
16+
<label>Forward Only</label>
17+
<type>checkbox</type>
18+
<help>Disables recursion if forwarding fails. The default is to attempt resolution via forwarders first and only perform recursive lookups if forwarding fails. This setting is only meaningful if the list of forwarders is not empty. Can be used to override global forwarding behaviour for this domain by specifying the same servers below as those on the General tab.</help>
1319
</field>
1420
<field>
1521
<id>domain.forwardserver</id>
16-
<label>Primary IP</label>
22+
<label>Forwarder IPs</label>
1723
<style>tokenize</style>
1824
<type>select_multiple</type>
1925
<allownew>true</allownew>
20-
<help>Set the IP address of server to forward requests to.</help>
26+
<help>Set any combination of IPv4 and IPv6 addresses. Queries for this domain will be forwarded to these addresses. Used to override global forwarders for this domain.</help>
2127
</field>
2228
</form>

dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,20 @@
6161
<advanced>true</advanced>
6262
<help>Specify the IPv6 address used as a source for zone transfers.</help>
6363
</field>
64+
<field>
65+
<id>general.forwardonly</id>
66+
<label>Forward Only</label>
67+
<type>checkbox</type>
68+
<advanced>true</advanced>
69+
<help>Disables recursion if forwarding fails. The default is to attempt resolution via forwarders first and only perform recursive lookups if forwarding fails. This setting is only meaningful if the list of forwarders is not empty.</help>
70+
</field>
6471
<field>
6572
<id>general.forwarders</id>
66-
<label>DNS Forwarders</label>
73+
<label>Forwarders</label>
6774
<style>tokenize</style>
6875
<type>select_multiple</type>
6976
<allownew>true</allownew>
70-
<help>Set one or more hosts to send your DNS queries if the request is unknown.</help>
77+
<help>Set any combination of IPv4 and IPv6 addresses to forward queries to when the answer is unknown.</help>
7178
</field>
7279
<field>
7380
<id>general.filteraaaav4</id>

dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Domain.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<model>
22
<mount>//OPNsense/bind/domain</mount>
33
<description>BIND domain configuration</description>
4-
<version>1.1.2</version>
4+
<version>1.1.3</version>
55
<items>
66
<domains>
77
<domain type="ArrayField">
@@ -21,6 +21,10 @@
2121
<primaryip type="NetworkField">
2222
<AsList>Y</AsList>
2323
</primaryip>
24+
<forwardonly type="BooleanField">
25+
<Default>0</Default>
26+
<Required>Y</Required>
27+
</forwardonly>
2428
<forwardserver type="NetworkField">
2529
<AsList>Y</AsList>
2630
</forwardserver>

dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<model>
22
<mount>//OPNsense/bind/general</mount>
33
<description>BIND configuration</description>
4-
<version>1.0.12</version>
4+
<version>1.0.13</version>
55
<items>
66
<enabled type="BooleanField">
77
<Default>0</Default>
@@ -45,6 +45,10 @@
4545
<Default>53530</Default>
4646
<Required>Y</Required>
4747
</port>
48+
<forwardonly type="BooleanField">
49+
<Default>0</Default>
50+
<Required>Y</Required>
51+
</forwardonly>
4852
<forwarders type="NetworkField">
4953
<AsList>Y</AsList>
5054
</forwarders>

dns/bind/src/opnsense/mvc/app/views/OPNsense/Bind/general.volt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
<tr>
201201
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
202202
<th data-column-id="domainname" data-type="string" data-visible="true">{{ lang._('Zone') }}</th>
203+
<th data-column-id="forwardonly" data-type="string" data-formatter="boolean" data-visible="true">{{ lang._('Forward Only') }}</th>
203204
<th data-column-id="forwardserver" data-type="string" data-visible="true">{{ lang._('Forwarder IPs') }}</th>
204205
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
205206
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>

dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ options {
3939
{% endif -%}
4040

4141
{% if helpers.exists('OPNsense.bind.general.forwarders') and OPNsense.bind.general.forwarders != '' %}
42-
forwarders { {{ OPNsense.bind.general.forwarders.replace(',', '; ') }}; };
42+
{% if helpers.exists('OPNsense.bind.general.forwardonly') and OPNsense.bind.general.forwardonly == '1' %}
43+
forward only
44+
{% endif -%}
45+
forwarders { {{ OPNsense.bind.general.forwarders.replace(',', '; ') }}; };
4346
{% endif -%}
4447

4548
{% if helpers.exists('OPNsense.bind.dnsbl.enabled') and OPNsense.bind.dnsbl.enabled == '1' %}
@@ -154,6 +157,11 @@ zone "rpzbing" { type primary; file "/usr/local/etc/namedb/primary/bing.db"; not
154157
zone "{{ domain.domainname }}" {
155158
type {{ domain.type }};
156159
{% if domain.type == 'forward' %}
160+
{% if domain.forwardonly == '1' %}
161+
forward only;
162+
{% else %}
163+
forward first;
164+
{% endif %}
157165
forwarders { {{ domain.forwardserver.replace(',', '; ') }}; };
158166
{% elif domain.type == 'secondary' %}
159167
{% if domain.transferkey is defined %}

0 commit comments

Comments
 (0)