
У меня есть DNS-сервер, который имеет два представления: одно для внутренних пользователей и одно для внешних (например, Интернет). Я хочу настроить RPZ так, чтобы при запросе внутренними пользователями (внешние рекурсивные запросы будут отклонены в любом случае) образца веб-сайта они перенаправлялись на другой веб-сайт (страницу фильтра), показывающую, что доступ к этому веб-сайту не разрешен. Но RPZ не работает, запрос для bad.com возвращает его настоящий адрес. Я не могу понять, в чем проблема.
именованные.conf.options:
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
Я обнаружил еще одну проблему: вы не определяете запись ns в файле зоны rpz.
@ NS 127.0.0.1.
и используйте инструменты привязки для устранения неполадок в вашей конфигурации. Для проверки синтаксиса конфигурации:
named-checkconf
и для проверки синтаксиса файла зоны:
named-checkzone filter /etc/bind/filter.zone
и для проверки того, что bind работает без ошибок:
netstat -lntup | grep 53