配置DNSSEC在BIND9(9.7.3)在Debian Squeeze / Ubuntu 11.10

在BIND9(9.7.3)上配置DNSSEC在Debian Squeeze / Ubuntu 11.10

本指南介绍了如何在Debian Squeeze和Ubuntu 11.10上配置BIND9(Debian Squeeze / Ubuntu 11.10上的9.7.3版本)上的DNSSEC。 它涵盖了如何在权威的Nameservers(主从)上启用DNSSEC,以及解析Nameservers,创建密钥(KSK和ZSK),签名区域,滚动滚动键盘滚动,使用甜甜圈进行区域文件检查,创建信任锚点,使用DLV (DNSSEC后备验证),并将您的DS记录存入父级区域。

我不会保证这将为您工作!

1初步说明

我在这里使用三个Debian Squeeze服务器:

  • server1.example.com (主DNS服务器,权威性):IP地址192.168.0.100
  • server2.example.com (从属DNS服务器,权威):IP地址192.168.0.101
  • server3.example.com (解析DNS服务器,不具权威性):IP地址192.168.0.102

我假设BIND已经安装并在所有三个服务器上工作。

我在本教程中使用zone example.org来演示DNSSEC设置。 该区域已经在主服务器( server1 )和从站( server2 )上已经设置并工作(通过“正常”DNS)。

server1(master):

BIND配置目录是Debian Squeeze / Ubuntu 11.10上的/ etc / bind 。 该目录看起来如下:

cd /etc/bind/
ls -l
root@server1:/etc/bind# ls -l
total 60
-rw-r--r-- 1 root root  665 Jan 15  2011 bind.keys
-rw-r--r-- 1 root root  237 Jan 15  2011 db.0
-rw-r--r-- 1 root root  271 Jan 15  2011 db.127
-rw-r--r-- 1 root root  237 Jan 15  2011 db.255
-rw-r--r-- 1 root root  353 Jan 15  2011 db.empty
-rw-r--r-- 1 root root  270 Jan 15  2011 db.local
-rw-r--r-- 1 root root 2994 Jan 15  2011 db.root
-rw-r--r-- 1 root bind  463 Jan 15  2011 named.conf
-rw-r--r-- 1 root bind  490 Jan 15  2011 named.conf.default-zones
-rw-r--r-- 1 root bind  167 Apr 13 10:06 named.conf.local
-rw-r--r-- 1 root bind  572 Jan 15  2011 named.conf.options
-rw-r--r-- 1 root bind  722 Apr 13 10:06 pri.example.org
-rw-r----- 1 bind bind   77 Feb  7  2011 rndc.key
drwxr-s--- 2 root bind 4096 Feb  7  2011 slave
-rw-r--r-- 1 root root 1317 Jan 15  2011 zones.rfc1918
root@server1:/etc/bind#

如您所见,我的example.org区域文件名为pri.example.org 。 您的名称可能有所不同,因此您必须在本教程的命令中调整区域名称。

我的example.org区域如下(没有什么特别的,正常的BIND区域):

cat pri.example.org
$TTL        3600
@       IN      SOA     server1.example.com. zonemaster.example.com. (
                        2012041305       ; serial, todays date + todays serial #
                        7200              ; refresh, seconds
                        540              ; retry, seconds
                        604800              ; expire, seconds
                        86400 )            ; minimum, seconds
;

example.org. 3600 A        1.2.3.4
example.org. 3600      MX    10   mail.example.org.
example.org. 86400      NS        server1.example.com.
example.org. 86400      NS        server2.example.com.
example.org. 3600      TXT        "v=spf1 a mx ptr -all"
mail 3600 A        1.2.3.4
www 3600 A        1.2.3.4

我的named.conf.local如下所示:

cat named.conf.local
zone "example.org" {
        type master;
        allow-transfer {192.168.0.101;};
        also-notify {192.168.0.101;};
        file "/etc/bind/pri.example.org";
};

server2(slave):

我已经配置了从站,将其从属区域文件(称为sec.example.org )存储在/ etc / bind / slave目录中,如/etc/bind/named.conf.local文件中所示:

cat /etc/bind/named.conf.local
zone "example.org" {
        type slave;
        masters {192.168.0.100;};
        allow-notify {192.168.0.100;};
        allow-transfer {none;};
        file "/etc/bind/slave/sec.example.org";
};

通知主服务器上的区域文件更改,以便它可以检索新的区域文件。

如你所见,没有什么特别的 - 一个正常的BIND设置。

2启用主服务器上的DNSSEC(server1)

server1(master):

我将在本教程中使用dnssec-tools包,因为它附带了一些方便的工具,如区域管理员滚筒 ,使DNSSEC管理更容易。

我们可以安装它(和一些其他推荐的软件包)如下:

apt-get install dnssec-tools libnet-dns-sec-perl libmailtools-perl libcrypt-openssl-random-perl

现在去/ etc / bind目录:

cd /etc/bind

打开named.conf.options ...

vi named.conf.options

...并添加dnssec-enable yes;dnssec验证是的;dnssec-lookaside auto;选项部分:

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 {
        //      0.0.0.0;
        // };

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;
        //bindkeys-file "/etc/bind/bind.keys";
};

仅当bind.keys文件位于/etc/bind/bind.keys之外的位置时,才需要bindkeys-file行 - 如果是/etc/bind/bind.keys ,则默认情况下会加载它。

dnssec-lookaside汽车 使该命名在第一次执行时从bind.keys读取DLV密钥。 这是dlv.isc.org键。

通常,从根区( )到自己的区域应该有一个完全签名的路径,这意味着您的父区域(例如.org for example.org )也必须被签名。 不幸的是,并不是所有的TLD都已经签了。 如果您的任何一个父母都没有签名,链条将被破坏,您不能将根区域的密钥用作BIND配置中的受信任的锚点。

这就是为什么DNSSEC看门狗验证(DLV)被发明的。 简而言之,DLV可作为可信密钥的备用存储库,如果没有完全签名的路径,则可以提交区域密钥。 最突出的DLV存储库是dlv.isc.org (ISC是制造BIND的公司)。 根区域密钥和dlv.isc.org密钥都包含在/etc/bind/bind.keys中 (如果没有,请更新BIND ...

apt-get install bind9

...并再次检查)。

您可以在https://www.isc.org/solutions/dlvhttps://dlv.isc.org/about/background上找到有关DNSSEC前瞻验证(DLV)的更多 信息 。 如果要将密钥提交到dlv.isc.org信息库,可以在https://dlv.isc.org/注册

您可以在http://stats.research.icann.org/dns/tld_report/http://www.tldwithdnssec.se/上找到已签名TLD的列表。 如果您的TLD已签名,首选方法是将密钥提交到注册表,以便可以为您的区域创建DS记录。 你不需要DLV记录。

在BIND 9.8和9.9中,来自bind.keys的根区域密钥可以加载dnssec-validation auto; - 不幸的是,在BIND 9.7(我们使用)中,没有dnssec验证的 自动选项(这就是为什么我们使用dnssec-validation yes; ),这意味着没有加载根区域密钥(参见https://www.isc。 org / bind-keys )。 为了克服这个问题,我们可以从bind.keys添加根区域密钥...

cat bind.keys
[...]
managed-keys {
        # ISC DLV: See https://www.isc.org/solutions/dlv for details.
        # NOTE: This key is activated by setting "dnssec-lookaside auto;"
        # in named.conf.
        dlv.isc.org. initial-key 257 3 5 "BEAAAAPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2
                brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+
                1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5
                ymX4BI/oQ+cAK50/xvJv00Frf8kw6ucMTwFlgPe+jnGxPPEmHAte/URk
                Y62ZfkLoBAADLHQ9IrS2tryAe7mbBZVcOwIeU/Rw/mRx/vwwMCTgNboM
                QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt
                TDN0YUuWrBNh";

        # ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml
        # for current trust anchor information.
        # NOTE: This key is activated by setting "dnssec-validation auto;"
        # in named.conf.
        . initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
                FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
                bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
                X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz
                W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
                Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
                QxA+Uk1ihz0=";
};

named.conf.options ,或者我们只是在named.conf.options中包含bind.keys (我更喜欢后一种方法):

vi named.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 {
        //      0.0.0.0;
        // };

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;
        //bindkeys-file "/etc/bind/bind.keys";
};

//managed-keys {
//        # ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml
//        # for current trust anchor information.
//        . initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
//                FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
//                bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
//                X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz
//                W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
//                Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
//                QxA+Uk1ihz0=";
//};

include "/etc/bind/bind.keys";

之后重启BIND:

/etc/init.d/bind9 restart
赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏