From: Alan Stebbens <aks%anywhere@hub.ucsb.edu>
Subject: Re: More on DNS stuff 
Reply-To: aks%anywhere@hub.ucsb.edu
Organization: The Internet
Date: Fri, 18 Dec 1992 00:38:34 GMT

Sorry it's been so long since I announced it, but here's the info on the
Perl scripts to maintain a host and subdomain database for a 2nd-level
DNS domain (like "ucsb.edu"), with possibly delegated 3rd-level
subdomains (like "dept.ucsb.edu").

I am announcing these for the benefit of some people who have asked for
them, but they are provided completely without any warranty or promise
of support.  They were written over a period of four years, with gradual
improvements and complete rewrites.  Some amount of history is visible
through RCS files.

There are two tar files to look at, with anonymous FTP to hub.ucsb.edu:
DNSHosts.tar.Z and named.conf.tar.Z.

DNSHosts.tar.Z	- this directory contains our scripts and files which
	construct a complete set of DNS files for the "ucsb.edu" domain,
	including other ancillary files, like /etc/hosts, /etc/networks,
	etc, from a master Jinx database, and some associated library
	files.

These scripts accept a master host database, managed through Jinx,
and generate a configurable set of files.  The table is defined in
lib/header.pl, and it is very simple to add new files.  All of the DNS
files are constructed by "modules", each of which is a very small Perl
script which extracts the relevant piece of info from the database and
writes to a standard filehandle in the format expected for the kind of
file being constructed.

It is very easy to add new files to be generated during a "make".  For
example, one of the the things we recently decided to do was have our
host database define host "categories", and to generate a file which,
for each host on a separate line, listed its associated categories.
This file is used by other scripts to perform routine system tasks by
host category.  Here's the module which creates the category file
(comments omitted) (we called the categories: "system groups"):

    file: MakeSysGroups
    ==================
    #/eci/bin/perl
    require '/eci/etc/hosts/lib/header.pl';
    require "$BIN/MakeUtil.pl";
    
    sub SysgroupMethod {
	local(@groups) = sort split(' ',$rec[$Fields{'GroupList'}]);
	local($grouplist) = join(' ',@groups);
	printf "%-20s%s\n",$name,$grouplist;
	$Lines++;
    }
    &MakeFileWithIfNames($SYSGROUP,'','SysgroupMethod','');
    ====================

and, here's the line from "lib/header.pl", which describes this module
and the file it creates:

  # variable  localfile   installed as    create-module
   SysGroups  sysgroups   /etc/sysgroups  MakeSysGroups

Here are the files created by the scripts currently:

    /usr/lib/mail/ether.hosts      
    /usr/local/lib/motd/motd.hosts 
    /usr/lib/news/nntp_access      
    /etc/ucsbhosts                 
    /etc/ucsbhosts.rev             
    /etc/hosts                     
    /etc/named.bootBot             
    /etc/named.ca                  
    /etc/ucsb.subdomains           
    /etc/ucsb.subdomains.rev       
    /etc/sysgroups                 
    /etc/networks                  

These scripts require: perl, jinx, cterm, "host"; the program "sf" (shellform)
is optional, but allows the script "HE" (a form-oriented Host Entry) to
work.

There is also a file "HostRegForm", which can be completed and sent via
email to our "hostmaster".  Whomever is wearing the hostmaster hat that
day then feeds the completed form to a script (part of this package)
called "convHostForm" which then automatically updates the host database
(assuming the form's input is valid).  After an update, a "make" will
drive the file creation, distribution, installation, and effectation
process.

named.conf.tar.Z - this directory contains a much simpler set of scripts
	and a single master file to build a 3rd level subdomain, such as
	"DEPT.ucsb.edu".  Several departments on our campus are using
	these scripts, possibly with slight alterations.

	Uses "make" and Perl.

The Perl scripts are NOT usable without some local customization (like
the Perl path, for example).  I cannot say how much will be needed; in
particular, you will need to look at DNSHosts/lib/header.pl and
DNSHosts/bin/*

The Jinx database requires, of course, a working installation of Jinx
(and cterm, which comes with it).  If you browse around on hub, you'll
also find those packages.

I do not have the time to help anyone get these working, but, the
DNSHosts scripts are an *EXACT* copy of our working scripts, minus the
local database.

You will need the "host" command, a program to talk to the resolver,
like nslookup, but, IHMO, much simpler and nicer.  host.tar.Z is also
available on hub.

If you have trouble with some of this, I'll answer questions as I can,
but please be patient, and do not expect a very quick response.

Enjoy, and good luck.

Alan Stebbens   Computer Resource Manager
		Center for Computational Sciences and Engineering (CCSE)
		University of California, Santa Barbara
		3111 Engineering I
		Santa Barbara, CA 93106

Internet: aks@hub.ucsb.edu
Voice:    (805) 893-8135 (CCSE Office: 893-3221)