BIND 9 の設定(rndc)
rndc の設定
このサイトを参考に rndc を設定する。
認証キーの作成
/tmp ディレクトリで作業する。
# cd /tmp # dnssec-keygen -a hmac-md5 -b 512 -n user rndc 2種類のファイルが生成( xxxxx はランダム) Krndc.+157+xxxxx.key Krndc.+157+xxxxx.private
Krndc.+157+xxxxx.private
ファイル Krndc.+157+xxxxx.private 内の ***...*** の部分を rndc.conf で使う。
# cat Krndc.+157+xxxxx.private Private-key-format: v1.3 Algorithm: 157 (HMAC_MD5) Key: ***...*** ← 93 文字 Bits: AAA= Created: 20100507140045 Publish: 20100507140045 Activate: 20100507140045
Krndc.+157+xxxxx.key
Krndc.+157+xxxxx.private と同じく、Krndc.+157+xxxxx.key 内の ***...*** の部分を用いる。
# cat Krndc.+157+xxxxx.key
rndc. IN KEY 0 3 157 ***...*** ← 93 文字
rndc.conf の設定
***...*** の部分には、Krndc.+157+xxxxx.private のキーを使う。
# cd /etc/namedb/ # cp rndc.conf.sample rndc.conf options { default-server localhost; default-key "rndc-key"; }; server localhost { key "rndc-key"; }; key "rndc-key" { algorithm hmac-md5; secret "***...***"; };
rndc.key
***...*** の部分には、Krndc.+157+xxxxx.private のキーを使う。
# cd /etc/namedb # touch rndc.key # vi rndc.key key "rndc-key" { algorithm hmac-md5; secret "***...***"; };
named.conf の設定
named.conf の先頭に、次を記述する。(行末のセミコロンの有無に注意)
# vi /etc/namedb/named.conf controls { inet ::1 allow { ::1; } keys { "rndc-key"; }; inet 127.0.0.1 allow { 127.0.0.1; } keys { "rndc-key"; }; }; include "/etc/namedb/rndc.key";
パーミッションの変更
# cd /etc/namedb # chown bind:wheel rndc.conf # chmod 400 rndc.conf # chown bind:wheel rndc.key # chmod 400 rndc.key
BIND の再起動
# /etc/rc.d/named restart