首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用视图绑定RPZ无效

用视图绑定RPZ无效
EN

Unix & Linux用户
提问于 2016-10-21 15:23:00
回答 2查看 2.3K关注 0票数 3

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

named.conf.options:

代码语言:javascript
复制
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; };
};

named.conf.local:

代码语言:javascript
复制
//
// 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";
};

filter.zone:

代码语言:javascript
复制
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

filter2专区:

代码语言:javascript
复制
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的真实地址。

我在做实验,这就是为什么有两个区域。

EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2016-10-21 18:24:22

第一次改正记录:

代码语言:javascript
复制
bad.com A   filter.wsi.org 

至:

代码语言:javascript
复制
bad.com A   192.168.1.1

或者改变如下:

代码语言:javascript
复制
bad.com CNAME   filter.wsi.org

和下面的测试配置:

代码语言:javascript
复制
response-policy {zone "filter";};
票数 3
EN

Unix & Linux用户

发布于 2016-10-22 16:32:16

我发现了另一个问题,您在rpz区域文件中找不到ns记录。

代码语言:javascript
复制
@   NS    127.0.0.1.

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

代码语言:javascript
复制
named-checkconf

对于检查区域文件语法:

代码语言:javascript
复制
named-checkzone filter /etc/bind/filter.zone

对于检查,bind运行时没有出现错误:

代码语言:javascript
复制
netstat -lntup | grep 53
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/317976

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档