I am trying to run BIND under chroot on Ubuntu and CentOS. Installing it on CentOS is pretty straight forward with just installing the packages – bind and bind-chroot, while Ubuntu is a little more involved.
I've been following the below links to get it running on Ubuntu,
https://help.ubuntu.com/community/BIND9ServerHowto
http://www.tokiwinter.com/installing-chrooted-bind-ubuntu-12-04-server/
I can get it up and running but I am unable to figure out if BIND is running in chroot.
From what I can see it isn't running in chroot since there is no pid file inside the chroot directory but instead there is still a pid file in the /var/run/named directory.
Also trying to see where the process directory is mapped using the below
[root@centos-test etc]# ls -ld /proc/2839/root
lrwxrwxrwx. 1 named named 0 Feb 11 04:01 /proc/2839/root -> /
[root@centos-test etc]#
But from what i read at various places the above command is supposed to point to the chroot'ed directory if it is running inside a jail.
How can i accurately identify that I am inside a chroot jail or not?
Best Answer
It's simple: if
named
is running with-t <directory>
flag, then it's chrooted. Otherwise - it's not.