How To Configure Solaris 10 BIND Chroot

Disclaimer: This post was originally posted in 2008 as an article on the now-defunct website zazzybob.com. While the software version and actual commands used may vary, the concepts are still similar and give a general idea of how to approach a given problem.

The default BIND installation in Solaris 10 does not run in a chroot environment, which is an obvious security risk. Starting BIND to run in a chroot environment is a no-brainer, but getting it to managed by SMF in Solaris 10 requires a bit more work …

Configuration

We’re using the bundled version of BIND for this

First, create a named group

Next, add a named user. After testing, you should set the shell to /bin/false or similar.

Check that the standard dns/server:default service is disabled

If not, disable it

Create your chroot tree (note: you do not need to create dev and populate it)

Run rndc-confgen and use the output to populate your /var/named/etc/rndc.key and /var/named/etc/named.conf files. Also, enter any configuration into your named.conf as required.

Change ownership of the chroot tree

Check that you can run named in your chroot environment as the named user

Create a copy of the server manifest

You’ll need to make a few modifications to the server-chroot.xml file. The following diff shows the edits required:

NOTE: The privileges lines have been split for clarity only in the output above, and should be on a single line in your xml files!

Next, validate your new xml manifest:

Now, the manifest can be imported into SMF:

Check that the import was successful:

Good, now we can enable the service, and test that it’s running:

If things do not work as expected, check the service log (/var/svc/log/network-dns-server-chroot:default.log) as well as /var/adm/messages, and your BIND logs if you’ve enabled logging.

Conclusion

SMF provides a great deal of fault tolerance (and guards against human error) but can make major modifications to existing services tricky. Bringing BIND into a chroot, whilst still having it under SMF control (and not reverting to init.d scripts) takes a bit of work, but is worth it.