免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6804 | 回复: 4
打印 上一主题 下一主题

[原创]Upgrading BIND & Running Name Server with "named" [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-06 11:44 |只看该作者 |倒序浏览
Summary:
Upgrade BIND in Solaris 10.
Run "named" with another user instead of "root".
Configure "named" in SMF.

Environment:
1. gcc 3.4.6 & libiconv 1.11 installed, required for compiling BIND source code. downloaded from sunfreeware.com.
2. "SUNWbindr"  installed from O.S. CD so that no need to create the service "svc:/network/dns/server:default" in SMF from scratch.
3. Current named binary installed at /opt/bind-9.6.1-P1, and /opt/bind points to it: /opt/bind -> /opt/bind-9.6.1-P1.
4. Current named could be managed by "svcadm", and "/usr/sbin/named"  is replaced by "/opt/bind/sbin/named" in the script "/lib/svc/method/dns-server".
5.  Logs defined in /etc/named.conf are under  /mine/bind-logs.
6.  "/opt/bind/bin:/opt/bind/sbin:/bin" is added to the environment variable PATH as the first 2 paths to be searched.


==== Preoutage Steps ====

1. Download the lastest produciton release of BIND9 from www.isc.org and unpack it.
# cd /var/tmp
# gzcat bind-9.6.1-P2.tar.gz  | tar xf -

2. Compile the source codes and install the package.
# cd bind-9.6.1-P2
# ./configure  -sysconfdir=/etc  -prefix=/opt/bind-9.6.1-P2 -disable-ipv6  -enable-threads -with-openssl=no
# make
# make install

3. Customise the enviroment to run name server with the user "named"

3.1 Create a user "named"
# groupadd -g 1688 named
# useradd -u 1688 -g named -m -d /var/named -s /sbin/noshell -c "Named" named
# rm /var/named/local.cshrc    /var/named/local.login    /var/named/local.profile

3.2 Modify "extended userattibutes database" by appending the following lines to /etc/user_attr:
named::::type=normal;defaultpriv=basic,!proc_session,!proc_info,!file_link_any,net_privaddr,file_dac_read,file_dac_search,sys_resource,proc_chroot;auths=solaris.smf.manage.bind

3.3 Change ownership of the directory "run" to be owned by "named".
# chown named:named /opt/bind-9.6.1-P2/var/run/


==== Outage Steps ====

4. Bring down name server & start it with the new release

4.1 Bring down name server.
# tail -f /mine/bind-logs/bind-misc.log
# svcadm disable dns/server
# ps -ef | grep named

4.2 Correct ownership of the directories for name server's logs and zone files.
# chown -R named:named /mine/bind-logs /var/named

4.3 Bring up the new-released name server:
# unlink /opt/bind
# ln -s /opt/bind-9.6.1-P2 /opt/bind
# /opt/bind/sbin/named -u named
# ps -ef | grep named
    root 18882  6247   0 19:20:07 pts/1       0:00 grep named
   named 18437     1   0 19:18:54 ?           0:57 /opt/bind/sbin/named -u named

4.4 Verify name server is working properly
# rndc status
# nslookup sun.engrs.its.mine.com localhost

4.5 Remove the BIND package introduced by O.S. installation(Don't remove SUNWbindr!).
# pkgrm SUNWbind


5. Configure DNS server in SMF and restart DNS server

5.1 Verify DNS server is configured in SMF
# svcs -a | grep dns/server
disabled       Dec_02   svc:/network/dns/server:default

5.2 On the script(/lib/svc/method/dns-server) for dns/server, replace
server="/usr/sbin/named"
with
server="/opt/bind/sbin/named"

5.3 Modify SMF configuration for starting the daemon "named" with the user "named"
# svccfg -s svc:/network/dns/server:default
svc:/network/dns/server:default> setprop start/group = astring: "named"
svc:/network/dns/server:default> setprop start/user = astring: "named"
svc:/network/dns/server:default> quit

# svccfg -s dns/server
svc:/network/dns/server> setprop tm_common_name/C = ustring:  "DNS Server"
svc:/network/dns/server> setprop tm_man_named/manpath = astring: /opt/bind/share/man
svc:/network/dns/server> setprop tm_man_named/section = astring: 8
svc:/network/dns/server> quit

# svcadm refresh dns/server

5.4 Shutdown named and start it by SMF
# rndc stop
# ps -ef | grep named
# svcadm enable dns/server

5.5 Verify SMF status
# svcs -l dns/server
# svcs -xv dns/server

5.6 Verify name server status
# rndc status
# nslookup sun.engrs.its.mine.com localhost

[ 本帖最后由 chinaux 于 2010-1-8 13:38 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2010-01-08 10:56 |只看该作者
感谢分享

论坛徽章:
0
3 [报告]
发表于 2010-01-08 11:03 |只看该作者
好文

论坛徽章:
0
4 [报告]
发表于 2010-01-29 17:15 |只看该作者
Upgrading BIND afterwards …

Preoutage Steps
# cd /var/tmp
# gzcat bind-9.6.1-P3.tar.gz | tar xf -
# cd bind-9.6.1-P3
# ./configure -sysconfdir=/etc -prefix=/opt/bind-9.6.1-P3 -disable-ipv6 -enable-threads -with-openssl=no
# make
# make install
# chown named:named /opt/bind-9.6.1-P3/var/run
// verify the existing named configuration is compliant with the synatx of the new BIND release
# /opt/bind-9.6.1-P3/sbin/named-checkconf

Outage Steps
# tail -f BIND-LOG

# svcadm disable dns/server
// wait until named dies
# ps -ef | grep named | grep -v grep

# unlink /opt/bind
# ln -s /opt/bind-9.6.1-P3 /opt/bind
# svcadm enable dns/server

// verify named status
# svcs dns/server; ps -ef | grep named | grep -v grep
# rndc status
# dig @localhost sun.example.com +short

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
5 [报告]
发表于 2010-01-31 14:02 |只看该作者
好文,收藏先.
不知道Solaris8上能用不
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP