OpenNetAdmin

Search:   

build_bind

This is the module that will enable the ability to extract and build BIND DNS server configurations from the database. It will output the configuration text that would normally be located in something like /etc/named.conf or similar.

Requirements

  • A working install of the base ONA system
  • An installed version of BIND v9+
  • A defined “dns server” in the ONA database, also a few domains and hosts would be useful as well.
  • The scripts will expect to have the ONA system install path located in the /etc/onabase file (usually /opt/ona)

Download

You can download this plugin directly from its current github repository location. http://github.com/opennetadmin/build_bind

Install

  • Download the file to the ONA web server
  • tar -C /opt/ona/www/local/plugins -zxvf build_bind.tar.gz #i.e. untar it into the local plugins directory
  • chown -r www-data /opt/ona/www/local/plugins/build_bind #grant the web server access to the directory
  • In Menu → Plugins → Manage Plugins, click the install icon and follow any instructions.

You will want to copy the example script /opt/ona/www/local/plugins/build_bind/build_bind to your bind server and put it into /opt/ona/bin.

Usage

First off, you must have at least one DNS domain defined in the database as well as a host definition for the server you will be running the DNS server on. This host definition should have the same name and IP address as what your server is actually configured to use. By default the script will use the current hostname to look up data within ONA. If you need to provide a different hostname you can use the -s option to specify an alternate server name to build for.

The host within ONA should be assigned as a DNS server for whatever domains you expect it to be responsible for. This is done by navigating to Menu → View → List DNS domain servers.

You should now see the configuration being built real time in the web interface each time you select the server host and view its DNS server display page.

This now also exposes the dcm.pl module called build_bind_conf as well as a few others. It is used by the build_bind script to extract the configuration. It is also used by the web interface to generate configuration data.

Add the following line to your system named.conf file. Probably in /etc/bind/named.conf or named.conf.local depending on your system. The placement of this line could vary depending on how your distribution organizes named. named.conf.local should be used for ubuntu/debian based systems.

  include "/opt/ona/etc/bind/named.conf.ona";

Now that it is installed you should be able to execute /opt/ona/bin/build_bind as root. This will build a configuration file from the data in ONA and place it into the file /opt/ona/etc/bind/named.conf.ona. Assuming you have proper information in your system level named.conf file and that includes this new file built by ONA then your server will now be able to test that configuration and restart.

Once you have a successful rebuild of your configuration, you can then put the /opt/ona/bin/build_bind build script into a cron that runs at whatever interval you see as appropriate for your environment. I would suggest at least 2 times a day all the way down to once every hour. Remember, you can always run it on demand if needed. You will need to run it as root since it needs to restart the named daemon.

Since this is a reference design script I have left a few things commented out that you will need to uncomment and or adjust for your system. Specifically I use named-checkconf and rndc to check and restart the server. These commands may not be appropriate for your environment. Just read through /opt/ona/bin/build_bind to understand what it is actually doing

 
utils/build_bind.txt · Last modified: 2012/04/17 20:47 by matt