Skip to content

Install DNS Safety on FreeBSD 11

The following steps show how to install DNS Safety filter on 64-bit FreeBSD 11. It is recommended to download installation scripts mentioned on each step from our GitHub repository (sub folder scripts.freebsd11). Just run them one by one as root.

Step 1. Update

It is recommended to update the system prior to installation. Run sh in the console.


# update the system
freebsd-update fetch
freebsd-update install

# bootstrap pkg
env ASSUME_ALWAYS_YES=YES pkg bootstrap

# and reboot

Step 2. Install

The following script installs the latest stable version of DNS Safety. Note the /opt/dnssafety/bin/dsdnsd daemon runs as standard bind user in FreeBSD.


# setup some configuration variables
ARCH=`uname -m`

# get latest version of dns safety

# and install it
env ASSUME_ALWAYS_YES=YES pkg install -y dnssafety-$MAJOR-$ARCH.txz

# autostart DNS server
grep -e '^\s*dsdnsd_enable\s*=\s*\"YES\"\s*$' /etc/rc.conf
if [ $? -ne 0 ]; then
    echo "dsdnsd_enable=\"YES\"" >> /etc/rc.conf

# relabel folder (note we reuse the bind user here!)
chown -R bind:bind /opt/dnssafety

Step 3. Integrate

DNS Safety Filter runs as bind user by default. This user is not privileged, thus it cannot bind to port 53 as required by any normal DNS Server. We will work around this issue by modifying the system to allow bind user to bind to DNS port.

Note, that the following discussion is based on instructions here and here.

First, modify your /boot/loader.conf to load the mac_portacl_load kernel module upon start.

# /boot/loader.conf:

Then change your /etc/sysctl.conf to contain the following values. Note how we reuse the user id 53 of the standard system bind user in the ACL rule.

# /etc/sysctl.conf:  

Finally, to integrate DNS Safety filter into the system run sh Note how we relabel the installation folder to bind user.


# finally relabel folder (note we reuse the bind user here!)
chown -R bind:bind /opt/dnssafety

# restart all daemons
service dsdnsd restart

Reboot your server now to see that everything comes back to life correctly after it.