Skip to content

Commit

Permalink
dns/bind: Use BindAddressMatchField for ACL definitions (opnsense#4435)
Browse files Browse the repository at this point in the history
Switch the UI for ACL definitions and ACL for filter-aaaa to use the BindAddressMatchField type.

Because the introduction of negation makes the ACL entry order critical, this switches the user interface to a textbox, with one entry per line instead of the tokenized list. This interface allows much easier ordering of the entries.

This change intorduces no model changes and thus no upgrade migrations are necessary.

If ACLs are created with negation or references to the built-in ACLs, and the plugin is downgrated, the configuration templates will render correctly, but updating the configuration will require removing the negation and/or built-in ACL references to pass validation.
  • Loading branch information
jfieber committed Feb 2, 2025
1 parent ceafd05 commit ec18c75
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
<field>
<id>acl.networks</id>
<label>Network List</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>List of networks for this ACL.</help>
<type>textbox</type>
<help>List of addresses and network prefixes, one address or prefix per line. Use a leading exclamation mark (!) for negation. These built in ACLs may also be used: any, none, localhost, and localnets. If more than one element in an ACL is found to match a given IP address or prefix, preference is given to the one that came first in the ACL definition.</help>
</field>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@
<field>
<id>general.filteraaaaacl</id>
<label>ACL for filter-aaaa</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Specifies a list of client addresses for which AAAA filtering is to be applied.</help>
<type>textbox</type>
<help>Specifies a list of client addresses, one per line, for which AAAA filtering is to be applied.</help>
</field>
<field>
<id>general.logsize</id>
Expand Down
4 changes: 1 addition & 3 deletions dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Acl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
</check001>
</Constraints>
</name>
<networks type="NetworkField">
<FieldSeparator>,</FieldSeparator>
<networks type=".\BindAddressMatchField">
<Required>Y</Required>
<asList>Y</asList>
</networks>
</acl>
</acls>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@
<Default>0</Default>
<Required>Y</Required>
</filteraaaav6>
<filteraaaaacl type="NetworkField">
<FieldSeparator>,</FieldSeparator>
<asList>Y</asList>
</filteraaaaacl>
<filteraaaaacl type=".\BindAddressMatchField"/>
<logsize type="IntegerField">
<Default>5</Default>
<Required>Y</Required>
Expand Down

0 comments on commit ec18c75

Please sign in to comment.