11 - Set permissions on BIND chroot-ed directories

Information

The following actions are specific to chroot-ed BIND directories and have been tested on both the build from source instructions given, and the Red Hat bind-chroot RPM.

Rationale:

The permissions set for the chroot are a bit more restrictive than those outlined in beginning of this section, as other access is mostly zero (no access). However since other users have no need to read the BIND chrooted directories, it is a prudent application of the principle of least privilege

NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.

Solution

Check that no parent directories to the chroot are writable by the named user. The following command will check every parent directory except /. Any writable directories need to be corrected. If the command echo's the directory names without reporting any directories as writable, then the permissions are ok.
cd $ROOTDIR
su -m named -c 'D=$PWD; while [ '$D' != '/' ]; do echo $D; test -w $D && echo $D is writable.; D=`dirname $D`; done'
First, set the ownership and permissions on the chroot directory.
chown root:named $ROOTDIR
chmod u=rwx,g=rx,o= $ROOTDIR.
Change everything to be owned by root, read-only by named, no access for other.
cd $ROOTDIR
chown -R root:named etc var
chmod -R g-w,o= etc var
chown root:named dev proc
chmod g,o=rx dev
chmod a=rx proc
Next, add the minimal write access to the necessary directories and any files in the directories. Create and chmod the slave directory only if slave zones are configured. Likewise only create and chmod g+w the ddns directory only if dynamic updates are configured.
chmod -R g+w var/run/named var/tmp var/log var/named/data
chmod -R g+w var/named/slaves
chmod -R g+w var/named/ddns

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-6

Plugin: Unix

Control ID: 0df71fa4c6a081c59c1acd6707ac05ef295c77af3019352ad381a39a8d3b3208