dns/bind: add forcing safesearch (#984)

This commit is contained in:
Michael
2018-12-03 21:55:56 +01:00
committed by Franco Fichtner
parent 435aee386a
commit 74d17e5567
8 changed files with 68 additions and 8 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
PLUGIN_NAME= bind
PLUGIN_VERSION= 1.2
PLUGIN_REVISION= 1
PLUGIN_VERSION= 1.3
PLUGIN_COMMENT= BIND domain name service
PLUGIN_DEPENDS= bind912
PLUGIN_MAINTAINER= m.muenz@gmail.com
@@ -1,7 +1,7 @@
<form>
<field>
<id>dnsbl.enabled</id>
<label>Enable DNSBL</label>
<label>Enable DNSBL and RPZ</label>
<type>checkbox</type>
<help>This will enable the use of DNS Blocklists for ADs, Malware, or both.</help>
</field>
@@ -19,4 +19,16 @@
<allownew>true</allownew>
<help>List of domains to whitelist. It will add a entry for the domains itself and all sub domains.</help>
</field>
<field>
<id>dnsbl.forcesafegoogle</id>
<label>Enable Google SafeSearch</label>
<type>checkbox</type>
<help>This will force SafeSearch.</help>
</field>
<field>
<id>dnsbl.forcesafeyoutube</id>
<label>Enable Youtube Adult Restrictions</label>
<type>checkbox</type>
<help>This will force safe Youtube browsing.</help>
</field>
</form>
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/bind/dnsbl</mount>
<description>DNSBL configuration</description>
<version>1.0.3</version>
<version>1.0.4</version>
<items>
<enabled type="BooleanField">
<default>0</default>
@@ -28,5 +28,13 @@
<whitelists type="CSVListField">
<Required>N</Required>
</whitelists>
<forcesafegoogle type="BooleanField">
<default>0</default>
<Required>Y</Required>
</forcesafegoogle>
<forcesafeyoutube type="BooleanField">
<default>0</default>
<Required>Y</Required>
</forcesafeyoutube>
</items>
</model>
@@ -1,12 +1,16 @@
<model>
<mount>//OPNsense/bind/general</mount>
<description>BIND configuration</description>
<version>1.0.3</version>
<version>1.0.4</version>
<items>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
<enablerpz type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enablerpz>
<listenv4 type="NetworkField">
<default>127.0.0.1</default>
<FieldSeparator>,</FieldSeparator>
@@ -1,6 +1,8 @@
blacklist.db:/usr/local/etc/namedb/master/blacklist.db
google.db:/usr/local/etc/namedb/master/google.db
named:/etc/rc.conf.d/named
named.conf:/usr/local/etc/namedb/named.conf
rndc.conf:/usr/local/etc/namedb/rndc.conf
whitelist.db:/usr/local/etc/namedb/master/whitelist.db
whitelist.inc:/usr/local/etc/namedb/whitelist.inc
youtube.db:/usr/local/etc/namedb/master/youtube.db
@@ -0,0 +1,12 @@
$TTL 86400
@ IN SOA opnsense.localdomain. hostmaster.opnsense.localdomain. (
2018111401
28800
7200
864000
3600 )
@ NS localhost.
{% if helpers.exists('OPNsense.bind.dnsbl.forcesafegoogle') and OPNsense.bind.dnsbl.forcesafegoogle == '1' %}
google.com IN CNAME forcesafesearch.google.com.
www.google.com IN CNAME forcesafesearch.google.com.
{% endif %}
@@ -27,9 +27,7 @@ options {
{% endif %}
{% if helpers.exists('OPNsense.bind.dnsbl.enabled') and OPNsense.bind.dnsbl.enabled == '1' %}
{% if helpers.exists('OPNsense.bind.dnsbl.type') and OPNsense.bind.dnsbl.type != '' %}
response-policy { zone "whitelist.localdomain"; zone "blacklist.localdomain"; };
{% endif %}
response-policy { {% if helpers.exists('OPNsense.bind.dnsbl.type') and OPNsense.bind.dnsbl.type != '' %}zone "whitelist.localdomain"; zone "blacklist.localdomain";{% endif %}{% if helpers.exists('OPNsense.bind.dnsbl.forcesafegoogle') and OPNsense.bind.dnsbl.forcesafegoogle == '1' %}zone "rpzgoogle";{% endif %}{% if helpers.exists('OPNsense.bind.dnsbl.forcesafeyoutube') and OPNsense.bind.dnsbl.forcesafeyoutube == '1' %}zone "rpzyoutube";{% endif %} };
{% endif %}
{% if helpers.exists('OPNsense.bind.general.recursion') and OPNsense.bind.general.recursion != '' %}
@@ -72,6 +70,16 @@ zone "whitelist.localdomain" { type master; file "/usr/local/etc/namedb/master/w
zone "blacklist.localdomain" { type master; file "/usr/local/etc/namedb/master/blacklist.db"; notify no; check-names ignore; };
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.bind.dnsbl.enabled') and OPNsense.bind.dnsbl.enabled == '1' %}
{% if helpers.exists('OPNsense.bind.dnsbl.forcesafegoogle') and OPNsense.bind.dnsbl.forcesafegoogle == '1' %}
zone "rpzgoogle" { type master; file "/usr/local/etc/namedb/master/google.db"; notify no; check-names ignore; };
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.bind.dnsbl.enabled') and OPNsense.bind.dnsbl.enabled == '1' %}
{% if helpers.exists('OPNsense.bind.dnsbl.forcesafeyoutube') and OPNsense.bind.dnsbl.forcesafeyoutube == '1' %}
zone "rpzyoutube" { type master; file "/usr/local/etc/namedb/master/youtube.db"; notify no; check-names ignore; };
{% endif %}
{% endif %}
logging {
channel default_log {
@@ -0,0 +1,15 @@
$TTL 86400
@ IN SOA opnsense.localdomain. hostmaster.opnsense.localdomain. (
2018111401
28800
7200
864000
3600 )
@ NS localhost.
{% if helpers.exists('OPNsense.bind.dnsbl.forcesafeyoutube') and OPNsense.bind.dnsbl.forcesafeyoutube == '1' %}
www.youtube.com IN CNAME restrict.youtube.com.
m.youtube.com IN CNAME restrict.youtube.com.
youtubei.googleapis.com IN CNAME restrict.youtube.com.
youtube.googleapis.com IN CNAME restrict.youtube.com.
www.youtube-nocookie.com IN CNAME restrict.youtube.com.
{% endif %}