FreeBSD8 bind9

Bindの入れ替え


Counter: 2104, today: 1, yesterday: 0

2012-12-15 (土) 16:24:18


http://www.yomaigoto.jp/archives/437

portinstall bind98

ports から最新のBIND をインストールする。このとき、make のオプションに "WITH_REPLACE_BASE=yes" を加えると、BASE の BIND を ports のものと完全に置き換えることが出来るが、これはお勧めしない。なぜなら、freebsd-update を実行する度に BASE の BIND に戻そうとするから。BASE と ports と両方インストールしておき、rc.conf で named のパスを指定することで使い分ける方法を採る。

*************************************************************************
*           _  _____ _____ _____ _   _ _____ ___ ___  _   _             *
*          / \|_   _|_   _| ____| \ | |_   _|_ _/ _ \| \ | |            *
*         / _ \ | |   | | |  _| |  \| | | |  | | | | |  \| |            *
*        / ___ \| |   | | | |___| |\  | | |  | | |_| | |\  |            *
*       /_/   \_\_|   |_| |_____|_| \_| |_| |___\___/|_| \_|            *
*                                                                       *
*       If you are running BIND 9 in a chroot environment, make         *
*       sure that there is a /dev/random device in the chroot.          *
*                                                                       *
*       BIND 9 also requires configuration of rndc, including a         *
*       "secret" key.  The easiest, and most secure way to configure    *
*       rndc is to run 'rndc-confgen -a' to generate the proper conf    *
*       file, with a new random key, and appropriate file permissions.  *
*                                                                       *
*       The /etc/rc.d/named script in the base will do both for you.    *
*                                                                       *
*************************************************************************
===>   Compressing manual pages for bind98-9.8.4.1
===>   Registering installation for bind98-9.8.4.1

rndc.key はインストール時に生成される模様。

# rndc-confgen -b 512 > /usr/local/etc/rndc.conf

このとき、/usr/local/etc/rndc.key が /etc/namedb/rndc.key のシンボリックリンクとして作成される。rndc.key は元々存在するファイルであるため、新たに生成されたrndc.conf とは内容が一致しない。念のため、rndc.conf に合わせて rndc.key の内容も修正しておく。具体的には、secret 行を新しい rndc.conf のものと差し替える。

続いて、/etc/rc.conf に以下の一文を追加。

[/etc/rc.conf]
named_program="/usr/local/sbin/named"
hotshot# named -v
BIND 9.8.1-P1
hotshot# ps ax | grep named
 6614   0  S+       0:00.01 grep named
hotshot# /usr/local/sbin/named -t /var/named -u bind
hotshot# ps ax | grep named
 6616  ??  Ss       0:00.26 /usr/local/sbin/named -t /var/named -u bind
 6619   0  S+       0:00.01 grep named
hotshot#

named: the working directory is not writable

http://d.hatena.ne.jp/tama0905/20110729/1311934233

/etc/mtree/BIND.chroot.distの「/set type=dir uname=root gname=wheel mode=0755」をuname=bindへ修正すると、エラーが出なくなりましたし、ディレクトリ所有者もbindになりました。

/usr/sbin/named-checkzone niihama-med.or.jp /var/named/etc/namedb/niihama-med.or.jp.db

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2012-12-15 (土) 16:24:18