
私には 2 つのビューを持つ DNS サーバーがあります。1 つは内部ユーザー用、もう 1 つは外部 (インターネットなど) 用です。内部ユーザーがサンプル Web サイトを要求した場合 (外部の再帰クエリはいずれにしても拒否されます)、この Web サイトへのアクセスが許可されていないことを示す別の Web サイト (フィルター ページ) にリダイレクトされるように 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 の実際のアドレスを常に表示します。
実験していたので、ゾーンが 2 つあります。
答え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
そして、bind がエラーなしで実行されているかどうかを確認します。
netstat -lntup | grep 53