我正在尝试仅为孩子应用“restrictmoderate.youtube.com”,并让其他人使用 Bind9 访问标准的“youtube.com”。
# cat named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
==========================================================================
# cat named.conf.options
acl goodclients {
192.168.0.0/16;
localhost;
localnets;
};
acl kids { 192.168.2.0/24; };
acl adults { 192.168.1.0/24; };
options {
directory "/var/cache/bind";
recursion yes;
allow-query { goodclients; };
// forward traffic to opendns
forwarders { 208.67.222.222; 208.67.220.220; };
forward only;
dnssec-enable yes;
dnssec-validation yes;
// Conform to RFC1035
auth-nxdomain no;
// Force youtube.com to restrictmoderate.youtube.com
response-policy { zone "rpz"; };
listen-on-v6 { none; };
querylog yes;
};
==========================================================================
# cat named.conf.local
//include "/etc/bind/zones.rfc1918";
logging{
channel simple_log {
file "/var/log/bind/query.log" versions 3;
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category default{
simple_log;
};
};
zone "rpz" IN {
type master;
file "/etc/bind/rpdb.zone";
allow-query { kids; !adults; };
};
==========================================================================
# cat rpdb.zone
$ORIGIN rpz.
$TTL 1H
@ IN SOA localhost. root.localhost. (
7
1H
15m
30d
2h )
NS LOCALHOST.
www.youtube.com IN CNAME restrictmoderate.youtube.com.
m.youtube.com IN CNAME restrictmoderate.youtube.com.
youtubei.googleapis.com IN CNAME restrictmoderate.youtube.com.
youtube.googleapis.com IN CNAME restrictmoderate.youtube.com.
www.youtube-nocookie.com IN CNAME restrictmoderate.youtube.com.
google.com IN CNAME forcesafesearch.google.com.
www.google.com IN CNAME forcesafesearch.google.com.
我不明白为什么“rpz”区域适用于所有人(192.168.1.0/24 和 192.168.2.0/24),而我希望它只适用于“儿童”ACL(192.168.2.0/24) :
allow-query { kids; !adults; };
我究竟做错了什么?谢谢你的帮助。
RPZ 区域不是传统的 DNS 区域,并且该
allow-query
指令的行为与您通常期望的不同。它主要用于限制复制。来自https://www.zytrax.com/books/dns/ch7/rpz.html:您最好的方法可能是使用您的 ACL 来实现视图(不缺少指南和操作方法),而 rpz 区域仅位于“儿童”视图中。此外,您可能需要考虑像这样重写您的 ACL 以获得相同的效果
{ kids; !adults; }
(或添加“其他”ACL 以捕获不在您列出的 2 个子网中的所有内容):完全取决于你。
祝你好运!