您的位置:首页 > 其它

DNS controls 语句

2016-02-23 17:56 127 查看
文章转自:http://blog.sina.com.cn/s/blog_6c2e6f1f0100l982.html
controls语句规定了rndc如何控制一个正在与行的named进程。rndc可以启动和停止named,转储其状态,将其转入调试模式等。
rndc是一个网络程序,如果配置不正确非常危险。

语法是:
controls {

inet ip_addr port ip-port allow { address_match_list } keys {
key_list };
如果没有定义port子句指定端口,那么rndc使用默认端口953

例子:
[root@test1
test]# cat
/etc/named.conf

options {

version "i donot know";

directory "/var/named";

recursion
no;

dump-file
"/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

};

key "rndckey"
{

algorithm hmac-md5;

secret
"Wpsjg97qGN/y5R3dLq1wb+fWqupxFaIllL0E159Z0DQ=";

};

controls {

inet 127.0.0.1 port 953

allow { 127.0.0.1; } keys { "rndckey"; };

zone "." {

type hint;

file "named.ca";

};

.....

例中的key由rndc-confgen命令输出:
[root@test1 test]#
rndc-confgen

# Start of rndc.conf

key "rndckey" {

algorithm hmac-md5;

secret "Wpsjg97qGN/y5R3dLq1wb+fWqupxFaIllL0E159Z0DQ=";

};

options {

default-key "rndckey";

default-server 127.0.0.1;

default-port 953;

};

# End of rndc.conf

# Use with the following in
named.conf, adjusting the allow list as needed:

# key "rndckey" {

#
algorithm hmac-md5;

#
secret "Wpsjg97qGN/y5R3dLq1wb+fWqupxFaIllL0E159Z0DQ=";

# };

#

# controls {

#
inet 127.0.0.1 port 953

#
allow { 127.0.0.1; } keys { "rndckey"; };

# };

# End of named.conf

其中被#注释掉的就是加到named.conf中的行,他们能让named和rndc一起工作。

或者运行rndc-confgen -a -b
256就会生成文件 /etc/rndc.key,其中包括:
key "rndckey" {

algorithm hmac-md5;

secret "Wpsjg97qGN/y5R3dLq1wb+fWqupxFaIllL0E159Z0DQ=";

};
这个文件模式为600,属主为named或者root,然后使用include语句把它加到named.conf中,例如:
[root@test1
test]# more
/etc/named.conf

options {

directory "/var/named";

dump-file "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

};

include "/etc/rndc.key";
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: