|
|
第 1 帖 | |
|
|
标题: BIND9下设置chroot的问题!!! 一 操作环境
Redhat Linux Enterprise U3,BIND9.2.4。 二 操作步骤 1. 安装bind软件包,列表: bind-libs-9.2.4-EL3_10 bind-devel-9.2.4-EL3_10 bind-utils-9.2.4-EL3_10 bind-9.2.4-EL3_10 bind-chroot-9.2.4-EL3_10 caching-nameserver-7.2-7 2. 准备chroot环境 登录作为root, chroot目录结构 /chroot +--dev +--etc | +--named +--run +--var | +--named | +--slaves | +--run | +--tmp # mknod /chroot/dev/null c 1 3 # cp -a /etc/localtime /chroot/etc 修改/etc/rc.d/init.d/syslog 中的 start部分改daemon为下面的行 daemon syslogd $SYSLOGD_OPTIONS -a /chroot/dev/log 然后用/etc/rc.d/init.d/syslog restart重启syslogd后台。 3. 准备rndc 配置文件 rndc是BIND的管理程序,可以用来启动,停止和重新装入配置文件等等。 下面的命令生成hmac-md5键。 # /usr/sbin/dnssec-keygen -a hmac-md5 -b 128 -n user rndc 这将生成两个包括密码的文件,把密钥串放入文件rndc.conf和named.conf中。 然后修改/etc/rndc.conf中相应部分成下面的 options { default-server localhost; default-key "rndckey"; }; server localhost { key "rndckey"; }; key rndckey { algorithm "hmac-md5"; secret "8voiw4i4nGqaoyqrM91sHQ=="; }; 4. 准备named.conf配置文件 用下面的配置文件,内部网络使用192.168.1.0/24。 acl ournets { 127.0.0.1;192.168.1.0/24 }; options { directory "/etc/named"; pid-file "/var/run/named.pid"; statistics-file "/var/run/named.stats"; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53; allow-recursion { ournets; }; }; controls { inet 127.0.0.1 allow { localhost; } keys { rndc_key; }; }; // zone "." IN { type hint; file "named.ca"; }; zone "localhost" IN { type master; file "localhost.zone"; allow-update { none; }; }; zone "0.0.127.in-addr.arpa" IN { type master; file "named.local"; allow-update { none; }; }; key "rndckey" { algorithm hmac-md5; secret "8voiw4i4nGqaoyqrM91sHQ=="; }; zone "0.168.192.IN-ADDR.ARPA" { type master; file "192.168.0"; }; zone "domain.com" { type master; file "named.domain"; }; 5. 准备启动named 放named.conf到/chroot/etc/named.conf 放相应的数据文件到/chroot/etc/named/ 拷贝系统自身的几个文件/etc/named.conf,/var/named/* 和自己编辑的 两个文件到192.168.1和named.domain到上面的目录中。 运行命令/usr/sbin/ntsysv去掉自动启动的named前面的标记,然后放下面的行 到/etc/rc.d/rc.local # /usr/local/sbin/named -u named -t /chroot -c /etc/named.conf 6. 目录的属性和所有者权限 # chown named:named /chroot/var/run named后台需要写pid到上面的目录,所有需要设置目录权限给用户named. # chown named:named /chroot # chmod 700 /chroot 让其它用户不可以进入该目录。 7. 启动named 运行下面的命令启动named # /usr/sbin/named -u named -t /chroot -c /etc/named.conf (无任何提示) #/usr/sbin/rndc -s localhost reload #重装配置文件,错误提示: rndc: connect failed: connection refused #/usr/sbin/rndc -s localhost stop #停止named后台,错误提示: rndc: connect failed: connection refused #/usr/sbin/rndc -s localhost stats #倾倒统计文件,错误提示: rndc: connect failed: connection refused 最后用ps ax(named没有启动)和/usr/sbin/tcpdump port 53 -n检查named是否已处于服务状态中(不在服务状态,就是没有启动)。 ++++++++++++++++++++++++++++++++++ 不知道出了什么原因,我感觉是目录权限问题,但是以不知道怎么处理! ![]() |
|
|
|
|
|
|
|
第 2 帖 | |
|
|
chown named.named -R试试chroot下bind的目录。
确保配置文件都没有写错吧。另外,我看bind-chroot你那样做得那么简单吧。比如,这些步骤。 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/bind/etc/localtime chown named.named -R /etc/bind/etc/bind chown named.named /etc/bind/var/run mknod /etc/bind/dev/null c 1 3 mknod /etc/bind/dev/random c 1 8 chmod 666 /etc/bind/dev/null chmod 644 /etc/bind/dev/random 我看不是能少的。 我用的系统是Debian,bind9是运行正常。但说实在,我还不能确定bind是到底是是在在chroot工作的呢?搞不清。。。 以前不久有讨论,顶置了不久,但也是不了了之哦。 呵呵,我觉得,你先在实在的环境中测试bind9,没有问题才到chroot中试,这样才能把问题弄清楚在那里出错了。 此帖于 04-10-14 13:54 被 faint 编辑. |
|
|
|
|
|
|
|
第 3 帖 | |
|
|
多谢!!!
|
|
|
|
|
|
|
|
第 4 帖 | |
|
|
/chroot还有bind目录!!!???
|
|
|
|
|
|
|
|
第 5 帖 | |
|
|
有什么奇怪的啊。系统不同,目录是常有的事情吧。
|
|
|
|
|
|
|
|
第 6 帖 | |
|
|
呵呵
|
|
|
|
|
|
|
|
第 7 帖 | |
|
|
重新安装以下包
1.bind-libs-9.2.4-EL3_10 #系统盘CD2 2.bind-utils-9.2.4-EL3_10 #系统盘CD2 3.bind-9.2.4-EL3_10 #系统盘CD3 4.caching-nameserver-7.2-7 #系统盘CD1 5.bind-devel-9.2.4-EL3_10 #系统盘CD3 并没有安装bind-chroot包,/etc/init.d/named start [OK] 但是nslookup无法连接到named,提示服务器未启动,我用ps ax | grep named 可以查询到named的进程,系统提示:/usr/sbin/named -u named 是什么原因??? /etc/services内有nameserver项!!! 求救!!!!! |
|
|
|
|
|
|
|
第 8 帖 | |
|
|
标题: Red Hat Enterprise Linux AS release 3 (Taroon)软件包 Red Hat Enterprise Linux AS release 3 (Taroon)软件包
[ ]X Windows System [ ]GNOME Desktop Environment [ ]KDE Desktop Environment [ ]Editors [ ]Engineering and Scientific [ ]Graphical Internet [ ]Text-based Internet [ ]Office/Productivity [ ]Sound and Video [ ]Authoring and Publishing [ ]Graphics [ ]Games and Enterainment [ ]Server Configuration Tools [ ]Web Server [ ]Mail Server [ ]Windows File Server [ ]DNS Name Server [ ]FTP Server [ ]SQL Database [ ]News Server [ ]Network Servers [ ]Legacy Network Server [ ]Development Tools [ ]Kernel Development [ ]X Software Development [ ]GNOME Software Development [ ]KDE Software Development [ ]Legacy Software Development [ ]Administration Tools [ ]System Tools [ ]Printing Support [ ]Everything 这是我安装U3时的选择,没有选择任何软件包,是不是少了软件支持所以bind无法正常使用!!!我猜```` |
|
|
|
|
|
|
|
第 9 帖 | |
|
|
在Fedora Core 2中也是这样,不过那个版本的系统,我安装了所有的软件包,可bind还是无法使用,真是让我晕`````
|
|
|
|
|
|
|
|
第 10 帖 | |
|
|
搞定了,是文件执行权限问题
|
|
|
|
|
|
|
|
第 11 帖 | |
|
|
确定bind9在chroot下工作了吗?
#ps -fCnamed #ls -l /proc/<named_pid>/root #lsof -p <named_pid> 的结果是是什么?? |
|
|
|
|
|