I am preparing to re-install my home server using Gentoo to replace an old Centos 8 installation. To make this as pain-free as possible, I have built a dummy Gentoo machine under VirtualBox on a Windows 10 Host so I can practise in a safe manner and get it right first time on the real installation.
The Gentoo basic installation (6.1.67-gentoo-x86_64) is working nicely using OpenRC rather than systemd and I began my tests by trying to setup a BIND DNS server under a chroot jail.
I searched for information, but could not find anything very clear to me. The best I could find was in the Gentoo BIND Wiki, which seemed to indicate that I should install BIND in the "unjailed" way, then run an emerge --config.
I did the basic installation and followed the instructions printed out at the end:-
Code: Select all
*
* You can edit /etc/conf.d/named to customize named settings
*
* If you'd like to run bind in a chroot AND this is a new
* install OR your bind doesn't already run in a chroot:
* 1) Uncomment and set the CHROOT variable in /etc/conf.d/named.
* 2) Run `emerge --config '=net-dns/bind-9.16.42'`
*Code: Select all
[root@localhost:/]$$ rc-service named checkconfig
* Checking named configuration ...
* No /chroot/dns/etc/bind/named.conf file exists!
[root@localhost:/]$
[root@localhost:/]$
[root@localhost:/]$
[root@localhost:/]$ rc-service named checkzones
* Checking named configuration and zones ...
open: /etc/bind/named.conf: file not found [ !! ]
[root@localhost:/]$
I then investigated the basic installation directories under /etc/bind and compared them to those under /chroot/dns/etc/bind and found that the latter was empty.
The other directories (/chroot/dns/dev and /chroot/dns/var) were populated with what looked to be reasonable files and sub-directories when compared to my Centos chrooted BIND.
Code: Select all
[root@localhost:/]$ ls -l /etc/bind
total 12
-rw-r----- 1 root named 1991 Jan 4 19:32 bind.keys
lrwxrwxrwx 1 root root 18 Jan 4 19:32 dyn -> ../../var/bind/dyn
-rw-r----- 1 root named 4020 Jan 4 19:32 named.conf
lrwxrwxrwx 1 root root 18 Jan 4 19:32 pri -> ../../var/bind/pri
-rw-r----- 1 root named 100 Jan 4 16:10 rndc.key
lrwxrwxrwx 1 root root 18 Jan 4 19:32 sec -> ../../var/bind/sec
[root@localhost:/]$
[root@localhost:/]$
[root@localhost:/]$
[root@localhost:/]$ ls -lR /chroot/dns
/chroot/dns:
total 16
drwxr-xr-x 2 root root 4096 Jan 4 19:39 dev
drwxr-xr-x 3 root root 4096 Jan 4 19:39 etc
drwxr-xr-x 3 root root 4096 Jan 4 19:39 run
drwxr-xr-x 4 root root 4096 Jan 4 19:39 var
/chroot/dns/dev:
total 0
crw-rw-rw- 1 root root 1, 3 Jan 4 19:39 null
crw-rw-rw- 1 root root 1, 9 Jan 4 19:39 urandom
crw-rw-rw- 1 root root 1, 5 Jan 4 19:39 zero
/chroot/dns/etc:
total 4
drwxr-x--- 2 root named 4096 Jan 4 19:39 bind
/chroot/dns/etc/bind:
total 0
/chroot/dns/run:
total 4
drwxrwx--- 2 root named 4096 Jan 4 19:39 named
/chroot/dns/run/named:
total 0
/chroot/dns/var:
total 8
drwxrwx--- 2 root named 4096 Jan 4 19:39 bind
drwxr-xr-x 3 root root 4096 Jan 4 19:39 log
/chroot/dns/var/bind:
total 0
/chroot/dns/var/log:
total 4
drwxrwx--- 2 root named 4096 Jan 4 19:39 named
/chroot/dns/var/log/named:
total 0I'm also not sure why there are files left outside of the jail. I thought they would all be in the jail, with just /etc/bind/named.conf remaining in the normal tree, perhaps as a symlink to the "real" one in the jail.
I'm not any kind of BIND expert, so I would appreciate any help in configuring my BIND correctly.
BR
Mick


