/named-admin

Ruby command line application for zone file administration on Bind DNS servers

Primary LanguageRuby

named-admin

named-admin is a command line tool for bind named.conf zone administration.

Reads, writes and sorts the file and finds, inserts, deletes and counts zones.

  • zones can be inserted based on customizable zone templates
  • the find action accepts wildcards (*) i.e. to find all zones of a certain domain
  • zones will be alphabetically sorted within your configuration file after each manipulation
  • option to automatically check the zone file syntax after manipulations with named-checkconf
  • option to aks for a named service restart after changes on the named configuration

Usage

Launch the main ruby script: named-admin COMMAND [argument] [options]

Examples

  • find all zones which begin with “example”: named-admin find example*
  • add a zone named “example.org”: named-admin add example.org
  • remove the zone “example.org”, check the zone file but don’t ask to restart named: named-admin remove example.org --check --no-restart

Check out named-admin --help for commands and options.

Installation

  • Download named-admin and move it to the desired application directory (i.e. /usr/local/share/named-admin)
  • Create a symlink in order to have named-admin in your execution path
    • ln -s /usr/local/share/named-admin/named-admin.rb /usr/local/sbin/named-admin
  • Copy the two configuration files from the templates and adapt them to your needs:
    • copy the base configuration file: cp config/config.yml.dist config/config.yml
    • copy the zone templates file: cp config/zones.yml.dist config/zones.yml
  • have fun and start using named-admin to simplify your daily named zone management!

Configuration

config/config.yml

  • specify the default path to you named.conf bind configuration file
  • activate automatic syntax checking with named-checkconf
  • configure whether to ask for a named restart after configuration changes

Example config.yml:


 #
 # base configuration file for named-admin
 #

 # specify the location of the named.conf or
 # the file which contains you named zone configurations
 named_zone_file:   '/etc/named.conf'

 # Define the command to execute in order to restart named
 # and reload the configuration
 restart_cmd:       'service named restart'
 restart_enable:    true

 # configuration of logging
 log_enable:        true
 log_file:          '/var/log/named-admin.log'

 # settings for automatically testing the configuration with named-checkconf
 checkconf_path:    '/usr/sbin/named-checkconf'
 checkconf_enable:  false

config/zones.yml

  • define different zone templates which can be used by the “add zone” action

Example zones.yml:


 # define your default zone settings
 # {{name}} is replaced by the real zone name

 example-slave:
    type: slave
    masters: '{ 192.168.1.1; 192.168.1.2; }'
    allow-query: '{ any; }'
    file: '"{{name}}.db"'

 example-master:
    type: master
    also-notify: '{ 192.168.1.3; 192.168.1.4; }'
    allow-query: '{ none; }'
    file: '"{{name}}.db"'

Credits

Copyright © 2009 Nik Wolfgramm, released under the MIT license