From 1415dcccc24a88b1e5e5f0cca6854cb41c867e00 Mon Sep 17 00:00:00 2001
From: Zane Chua <4265429+zanechua@users.noreply.github.com>
Date: Wed, 2 Feb 2022 23:31:47 -0800
Subject: [PATCH] dns/bind: Implement filter-aaaa (#1722)
---
.../OPNsense/Bind/forms/general.xml | 20 +++++++++++++++++++
.../mvc/app/models/OPNsense/Bind/General.xml | 13 ++++++++++++
.../templates/OPNsense/Bind/named.conf | 14 +++++++++++++
3 files changed, 47 insertions(+)
diff --git a/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml b/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml
index da2938c35..8c1521210 100644
--- a/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml
+++ b/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml
@@ -69,6 +69,26 @@
true
Set one or more hosts to send your DNS queries if the request is unknown.
+
+ general.filteraaaav4
+
+ checkbox
+ This will filter AAAA records on IPv4 Clients
+
+
+ general.filteraaaav6
+
+ checkbox
+ This will filter AAAA records on IPv6 Clients
+
+
+ general.filteraaaaacl
+
+
+ select_multiple
+ true
+ Specifies a list of client addresses for which AAAA filtering is to be applied.
+
general.logsize
diff --git a/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml b/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml
index 5d67e7931..edd75d160 100644
--- a/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml
+++ b/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml
@@ -56,6 +56,19 @@
N
Y
+
+ 0
+ Y
+
+
+ 0
+ Y
+
+
+ ,
+ N
+ Y
+
5
Y
diff --git a/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf b/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf
index abb5b5720..d0c552157 100644
--- a/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf
+++ b/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf
@@ -193,3 +193,17 @@ logging {
category lame-servers { null; };
};
{% endif %}
+
+{% if helpers.exists('OPNsense.bind.general.filteraaaav4') and OPNsense.bind.general.filteraaaav4 == '1' or helpers.exists('OPNsense.bind.general.filteraaaav6') and OPNsense.bind.general.filteraaaav6 == '1' %}
+plugin query "/usr/local/lib/named/filter-aaaa.so" {
+{% if helpers.exists('OPNsense.bind.general.filteraaaav4') and OPNsense.bind.general.filteraaaav4 == '1' %}
+ filter-aaaa-on-v4 yes;
+{% endif %}
+{% if helpers.exists('OPNsense.bind.general.filteraaaav6') and OPNsense.bind.general.filteraaaav6 == '1' %}
+ filter-aaaa-on-v6 yes;
+{% endif %}
+{% if helpers.exists('OPNsense.bind.general.filteraaaaacl') and OPNsense.bind.general.filteraaaaacl != '' %}
+ filter-aaaa { {{ OPNsense.bind.general.filteraaaaacl.replace(',', '; ') }}; };
+{% endif %}
+ };
+{% endif %}