分享
 
 
 

A simple chroot of bind9.2.3 on FreeBSD5.x

王朝厨房·作者佚名  2007-01-02
窄屏简体版  字體: |||超大  

FreeBSD5.2.1-RELEASE-p8

bind9.2.3 installed by port_replace_base

Notes: It is just a install memo of me but not a text for named.

[code:1:d452d51f00]

$ man named

......

OPTIONS

-t directory

chroot() to directory after processing the command line argu-

ments, but before reading the configuration file.

Warning: This option should be used in conjunction with the -u

option, as chrooting a process running as root doesn't enhance

security on most systems; the way chroot() is defined allows a

process with root privileges to escape a chroot jail.

......

# ps -ax|grep named

2611 ?? Ss 0:00.79 /usr/sbin/named -c /etc/namedb/named.conf -u bind

[/code:1:d452d51f00]

the original bind's working directory in FreeBSD5.x

[code:1:d452d51f00]

working directory:

/etc/namedb

/var/run/named

/etc

/dev

files options of the original named.conf:

......

include "/etc/namedb/rndc.key";

controls {

inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };

inet ::1 allow { localhost; } keys { "rndc-key"; };

};

options {

directory "/etc/namedb";

pid-file "/var/run/named/pid";

version "Windows 95";

recursion no;

auth-nxdomain yes;

listen-on-v6 {

any;

};

dump-file "s/named_dump.db";

};

logging {

channel bind_log {

file "/var/log/named/named.log";

severity info;

};

category xfer-out {

bind_log;

};

category default {

default_syslog;

};

};

zone "." {

type hint;

file "named.root";

};

......

[/code:1:d452d51f00]

Then, Let's run a named with "option -t".

Step 1: check what is chroot's named process need.

[code:1:d452d51f00]

+/var/named($chroot)

+---dev/

| +null

| +random

|

+---etc/

| +localtime

| +namedb/

| +named.conf

| +rndc.conf

| +rndc.key

| +*.zone

| +*.rev

| +named.root

| +s/

|

+var/

+log/

| +named/named.log

|

+run/

+named/

+pid

[/code:1:d452d51f00]

Step 3: Make new chroot directory for bind9

[code:1:d452d51f00]

# cd /var/ && mkdir named && cd /var/named

# mkdir -p dev etc/namedb dev var/run/named var/log/named

# cd dev && mknod null c 1 3 && mknod random c 249 0 && chmod 666 *

# cd ../etc && cp /etc/localtime .

# cd namedb ; cp -Rp /etc/namedb/* .

# cd ../../var ; chown -R bind:bind *

[/code:1:d452d51f00]

Step 4: restart named service.

[code:1:d452d51f00]

# kill `cat /var/run/named/pid`

# /usr/sbin/named -t /var/named -c /etc/namedb/named.conf -u bind

# ps -aux | grep named

bind 2858 1.8 1.6 4168 2900 ?? Ss 9:36AM 0:00.13 /usr/sbin/named -t /var/named -c /etc/namedb/named.conf -u bind

# tail /var/log/messages

May 30 09:36:26 tech named[2858]: starting BIND 9.2.3 -t /var/named -c /etc/namedb/named.conf -u bind

May 30 09:36:26 tech named[2858]: command channel listening on 127.0.0.1#953

May 30 09:36:26 tech named[2858]: command channel listening on ::1#953

# /usr/sbin/rndc status

number of zones: 12

debug level: 0

xfers running: 0

xfers deferred: 0

soa queries in progress: 0

query logging is OFF

server is up and running

* It is OK !

[/code:1:d452d51f00]

Step 5: edit the named service option in /etc/rc.conf

[code:1:d452d51f00]

# vi /etc/rc.conf

.....

named_enable="YES"

named_program="/usr/sbin/named"

named_flags="-t /var/named -c /etc/namedb/named.conf -u bind"

.....

[/code:1:d452d51f00]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有