绑定 RPZ 与视图没有效果

绑定 RPZ 与视图没有效果

我有一台 DNS 服务器,它有两个视图,一个用于内部用户,一个用于外部(例如互联网)。我想配置 RPZ,以便当内部用户请求(外部递归查询无论如何都会被拒绝)示例网站时,他们将被重定向到另一个网站(过滤器页面),显示不允许访问该网站。但 RPZ 不起作用,查询 bad.com 返回其真实地址。我找不到问题所在。

命名.conf.选项:

options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

    // If your ISP provided one or more IP addresses for stable 
    // nameservers, you probably want to use them as forwarders.  
    // Uncomment the following block, and insert the addresses replacing 
    // the all-0's placeholder.

 forwarders {
    8.8.8.8;
 };


    response-policy {zone "filter" recursive-only no;};

    //========================================================================
    // If BIND logs error messages about the root key being expired,
    // you will need to update your keys.  See https://www.isc.org/bind-keys
    //========================================================================
#   dnssec-validation auto;

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};

命名.conf.local:

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";


acl internal {172.17.116/24; 192.168.20/24; 127/8;};

view "internal" {
    match-clients {internal;};
    recursion yes;
    zone "wsi.org" {
        type master;
        file "/etc/bind/internal.zone";
    };

    zone "filter" {
        type master;
        file "/etc/bind/filter.zone";
    };



    include "/etc/bind/named.conf.default-zones";
};

view "external" {
    match-clients {any;};
    recursion no;
    zone "wsi.org" {
        type master;
        file "/etc/bind/external.zone";
    };

    zone "filter" {
        type master;
        file "/etc/bind/filter2.zone";
    };


    include "/etc/bind/named.conf.default-zones";
};

过滤区:

TTL 604800
@   IN  SOA wsi.org. root.wsi.org. (
                  3     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL

bad.com A   filter.wsi.org
bad.net A   filter.wsi.org

过滤器2区域:

TTL 604800
@   IN  SOA wsi.org. root.wsi.org. (
                  3     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL

bad.com A   filter.wsi.org
bad.net CNAME   rpz-passthru

nslookup始终显示 bad.net 和 bad.com 的真实地址。

我正在尝试,这就是为什么有两个区域。

答案1

第一个正确的 A 记录来自:

bad.com A   filter.wsi.org 

到:

bad.com A   192.168.1.1

或者像下面这样改变:

bad.com CNAME   filter.wsi.org

并使用以下测试配置:

response-policy {zone "filter";};

答案2

我发现另一个问题,你没有在 rpz 区域文件中定义 ns 记录。

@   NS    127.0.0.1.

并使用绑定工具对您的配置进行故障排除。用于检查配置语法:

named-checkconf

并检查区域文件语法:

named-checkzone filter /etc/bind/filter.zone

并检查绑定是否正在运行而没有错误:

netstat -lntup | grep 53

相关内容