UPDATEHOSTS(1)

NAME
updatehosts - update DNS and static host tables

SYNOPSIS
updatehosts [ -d dbdirectory ] [ -f configfile ] [ -l ] [ -n ] [ -s ] [ -v ] [ file ... ]

DESCRIPTION
Updates the DNS and static host database zone files.

updatehosts is a front-end to the gendns and genstatic programs which generate DNS zone files the and static host file from a set of input files organized as a set of flat relational files. updatehosts is driven off of a configuration file usually found in /usr/local/etc/updatehosts.env which sets variables such as the location of the input database files. An alternate configuration file location can be specified by the -f option.

The input database files are normally kept in the directory /var/named/db. The location of this directory can be specified by the -d option or with the DB_DIR environment variable. Output from updatehosts is normally placed in the /var/named directory. An alternate output directory location may be specified by setting the NAMED_DIR variable.

The following files are maintained in the DB_DIR directory:

main
    Contains information about each host within a set of domains. Information such as the domain name of each host and its IP address are maintained in this file.

cname
    Contains information about aliases for hosts

global
    Contains some global parameters

mx  Contains information about MX (mail exchanger) records.

options
    Contains information about BIND V8 optios.

ns  Contains information about NS (nameserver) records.

secondary
    Contains information about secondary zones served by this server

soa Contains information about SOA (start of authority) records.

txt Contains information about TXT (text) records.

subnet
    Contains information about local subnets which is used to generate an optional BOOTP or DHCP configuration file.

Each of the database files is organized tabularly. These files are preprocessed by the readinfo command. (see readinfo.1)

updatehosts may takes arguments which are the names of the database files which the user wants to edit. All database files may optionally kept under SCCS control by setting the USE_SCCS variable or by placing the -s flag on the command line. Similarly RCS control can be maintained by setting the USE_RCS variable or setting the -r flag on the command line. A user using updatehosts must have write permission in the DB_DIR and the NAMED_DIR directory. Each database file is edited by the vi editor or whatever program the user has set in the EDITOR environment variable.

After each edit, the database files are optionally checked back in using SCCS or RCS. Then the static host file is generated using the genstatic command. The host file is normally placed in the NAMED_DIR directory under the name static. This name may be changed by setting the STATICHOSTS variable.

Then the DNS zone files and bootstrap file are updated using the gendns command. Both BIND Version 4 or Version 8 configuration files are generated.

The local nameserver is restarted with the newly updated zone and bootstrap files by calling poke_ns restart or poke_ns reload if the -l flag is specified

Optionally, the POSTPROCESS environment variable can be set to the name of a command to run after the nameserver zone files and static host files are generated. This can be any arbitrary command. Normally, this may be a command to update NIS or NIS+ host maps from the generated static host file.

Environment variables should normally be set in the configuration file except when testing. An exception to this rule is the EDITOR environment variable which is normally set to the user's favorite editor.

Normal Configuration Setup

updatehosts provides a great deal of flexibility in how a nameserver zone files and static host table are generated and the various permissions on those files. In normal practice it is desirable to set up a group (say, staff) to manage the nameserver files. Setting the directory permissions on the NAMED_DIR tree to allow staff to create and modify files in that tree allows updatehosts to be run by anyone in the staff group without root access. The poke_ns program must be run as root to restart the nameserver. So setting it setuid to root, but only executable by the staff group allows any member of the staff group to restart the running nameserver.

See also

gendns(1), genstatic(1), poke_ns(1)