Re: BIND in chroot jail

From: Matthew Seaman (m.seaman_at_infracaninophile.co.uk)
Date: 01/21/04

  • Next message: Andrew Hall: "Re: Netgear WG511 (no driver attached)"
    Date: Wed, 21 Jan 2004 00:06:10 +0000
    To: Robert Fitzpatrick <robert@webtent.com>
    
    
    

    On Tue, Jan 20, 2004 at 05:04:16PM -0500, Robert Fitzpatrick wrote:
    > I see the bind user is defined as BIND Sandbox, does this mean the
    > default port install of bind9 sets bind up in a chroot jail?

    No -- all that means is that named(8) runs as a non-privileged user by
    default.

    However, running Bind9 in a chroot jail is really quite easy. First
    of all, with Bind9, there's no need to install the software under the
    chroot path. Just install the Bind9 port as normal.

    Add the following (mutatis mutandem) to your /etc/rc.conf to make
    named(8) from Bind9 start up and chroot itself:

        named_enable="YES"
        named_flags="-c /etc/namedb/named.conf -u bind -t /var/named"
        named_program="/usr/local/sbin/named"

    That chroots named(8) under /var/named -- so the named.conf file
    referred to is actually /var/named/etc/named/named.conf -- you'll also
    want a named.root file in /var/named/etc/namedb which you can copy
    from /etc/namedb.

    Now set up the chroot area. You need to create directories:

        drwxr-xr-x root wheel /var/named
        drwxr-xr-x root wheel /var/named/var
        drwxr-xr-x bind bind /var/named/var/run
        drwxr-xr-x root wheel /var/named/etc
        drwxr-xr-x root wheel /var/named/etc/namedb
        drwxr-xr-x root wheel /var/named/etc/namedb/p [Optional]
        drwxr-xr-x bind bind /var/named/etc/namedb/s [Optional]
        drwxr-xr-x bind bind /var/named/etc/namedb/dump [Optional]
        drwxr-xr-x root wheel /var/named/dev

    The directories I've marked optional are set up in my named.conf as
    the locations for: 'p' -- zone files which this is the master for, 's'
    -- zone files this server is a secondary for and 'dump' -- the default
    location to dump named cache and statistics.

    Copy the configuration files previously mentioned into place in
    /var/named/etc/namedb.

    Additionally you will need to:

        cp /etc/localtime /var/named/etc/localtime

    and you will need to set up the following character devices:

        -r-xr-xr-x 1 root wheel 44235 Sep 25 2002 MAKEDEV* [FBSD 4.x only]
        crw-rw-rw- 1 root wheel 2, 2 Sep 25 2002 null
        crw-r--r-- 1 root wheel 2, 3 Sep 25 2002 random
        crw-rw-rw- 1 root wheel 22, 2 Sep 25 2002 stderr
        crw-rw-rw- 1 root wheel 22, 0 Sep 25 2002 stdin
        crw-rw-rw- 1 root wheel 22, 1 Sep 25 2002 stdout
        crw-rw-rw- 1 root wheel 1, 0 Sep 25 2002 tty
        crw-r--r-- 1 root wheel 2, 4 Sep 25 2002 urandom
        crw-rw-rw- 1 root wheel 2, 12 Sep 25 2002 zero

    Use MAKEDEV to do that under FreeBSD 4.x (Copy the original from
    /dev/MAKEDEV). Under FreeBSD 5.x, set these devices up by editing
    /etc/devd.conf -- see devd.conf(5).

    Finally, if you want to log named(8) events via syslogd(8), you will
    need to add to /etc/rc.conf:

        syslogd_flags="-ss -l /var/named/var/run/log"

    and that is really just about it, bar the usual chores of editing
    named.conf(5) and maintaining the various DNS zone data files.

            Cheers,

            Matthew

    -- 
    Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                          Savill Way
    PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
    Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
    
    



  • Next message: Andrew Hall: "Re: Netgear WG511 (no driver attached)"

    Relevant Pages

    • Re: Not-so-strange question about bind
      ... If you have two network interfaces on the host have bind9 running ... 2.Use views in bind9 and only run one version of bind9. ... > Can I install a simple bind package, and with it, run two bind daemons ...
      (Debian-User)
    • RE: bind9 in a chroot ?
      ... Yep it is running in the chroot. ... Subject: bind9 in a chroot? ... how do i verify that my bind is really running chrooted? ... with "unsubscribe freebsd-security" in the body of the message ...
      (FreeBSD-Security)
    • Re: WordPerfect 8.0 (installation)
      ... now that you've figured out you might not need that package after ... I'm wondering whether you have tried to install what's available ... This usually means the package got damaged somehow (while downloading, ... could try to install the whole stuff into some chroot environment. ...
      (Debian-User)
    • Re: your mail
      ... I even bought DNS and BIND from O'riley. ... For debugging Bind9, start by getting Bind to log a lot of stuff. ... continually on a busy production server. ...
      (freebsd-questions)
    • Re: 32bit multimedia software on 64bit Linux?
      ... I use a 32-bit chroot. ... In order to play certain proprietary media formats, ... 64 bit Flash is still not available. ... used to work around this problem: install 32 bit Firefox along with all ...
      (Ubuntu)