dns-ng

Langue: en

Version: dnsutl (mandriva - 01/05/08)

Section: 1 (Commandes utilisateur)

NAME

dns-ng - generate /etc/netgroup entries from DNS tables

SYNOPSIS

dns-ng [ option... ][ infile [ outfile ]]
dns-ng -Help
dns-ng -VERSion

DESCRIPTION

The dns-ng program is used to generate a netgroup file from DNS information.

Each host is given a netgroup. Higher-level netgroups can be created from patterns applied to the HINFO field.

OPTIONS

The following options are understood:
-Help

Provide some help with using the dns-ng program.
-VERSion

Print the version of the dns-ng program being executed.
-Group name pattern

In addition to one netgroup for each host, a netgroup of the given name will be created for all hosts with a second HINFO field matching the given pattern. This option may be specified more than once. The first pattern match found is used, machines are not placed in more than one of these groups. Patterns are regular expressions.
-Delete_Foreign_Names
This option may be used to delete A and NS records which reference names in domains outside the domain specified in the closest preceeding SOA record.
-Idirectory

This option may be used to set the search path for include files.

All other options will produce a diagnostic error. Options may be abbreviated, the minimum abbreviation is shown in upper-case. Options are case insensitive. Options and file names may be mixed arbitrarily on the command line.

EXIT STATUS

The dns-ng command will exit with a status of 1 on any error. The dns-ng command will only exit with a status of 0 if there are no errors.

EXAMPLE

The idea is that you have all of the information concerning each computer in the one file. This makes it less likely that something will be omitted, and simpler to change if the name or IP address changes.

By using netgroups, you can assign NFS mount permissions (the /etc/exports file) and rlogin permissions (the /etc/hosts.equiv file) based on the kind of machine they are.

Given a database file called ``example.com'' and which contains the following text

 
 $origin example.com.
 @       in      soa     exmaple.com. hostmaster.example.com. (
                         990101001       ; serial
                         10800           ; refresh: 3 hours
                         1800            ; retry: 30 minutes
                         3600000         ; expire: 1000 hours
                         86400 )         ; minimum: 24 hours
 mercury in      a       182.168.1.1
         ether   a       2:7:1:f:b7:fb
         in      hinfo   "IBM-PC 486" "MSDOS"
 venus   in      a       182.168.1.2
         ether   a       2:60:8c:2d:20:c4
         in      hinfo   "IBM-6000/590" "UNIX AIX 3.2.5"
 earth   in      a       182.168.1.3
         ether   a       08:00:20:79:1f:0d
         in      hinfo   "Sun-4/5 (SPARCstation 5)" "UNIX SunOS 5.4"
 mars    in      a       182.168.1.4
         ether   a       aa:0:4:0:86:53
         in      hinfo   "DEC-Alpha 3000" "UNIX OSF/1 V3.2"
 jupiter in      a       182.168.1.5
         ether   a       8:0:2b:99:49:ad
         in      hinfo   "DEC-VXT2000+ XTerminal" "Other: X11R5"
         bootp   tc      dec-vxt-2000
 saturn  in      a       182.168.1.6
         ether   a       0:40:10:56:43:57
         in      hinfo   "Apple-Macintosh IIsi" "MacOS 7.5.3"
 neptune in      a       182.168.1.7
         ether   a       0:aa:0:69:7c:5b
         in      hinfo   "IBM-PC" "MSDOS"
 uranus  in      a       182.168.1.8
         ether   a       0:0:e8:a4:0:25
         in      hinfo   "IBM-PC" "MSDOS"
 pluto   in      a       182.168.1.9
         ether   a       8:0:9:d:2a:87
         in      hinfo   "HP-Laser-Jet 4" "None"
 lp      in      cname   pluto
 
You can generate the /etc/netgroup file using the following command
 % dns-ng example.com /etc/netgroup \
         -g pc MSDOS -g mac MacOS \
         -g unix UNIX -g other '.*'
 %
 
Here is what you would see as the output
 
 mercury (mercury,-,) (mercury.example.com,-,)
 venus (venus,-,) (venus.example.com,-,)
 earth (earth,-,) (earth.example.com,-,)
 mars (mars,-,) (mars.example.com,-,)
 jupiter (jupiter,-,) (jupiter.example.com,-,)
 saturn (saturn,-,) (saturn.example.com,-,)
 neptune (neptune,-,) (neptune.example.com,-,)
 uranus (uranus,-,) (uranus.example.com,-,)
 pluto (pluto,-,) (pluto.example.com,-,) (lp,-,) (lp.example.com,-,)
 unix venus earth mars
 mac saturn
 pc mercury neptune uranus
 other jupiter pluto
 
Note that the output uses relative names.

Makefile

All of this can be automated using the following makefile fragment:
 
 /etc/netgroup: example.com
         dns-ng example.com $@ -g pc MSDOS \
                 -g mac MacOS -g unix UNIX -g other '.*'
 
By doing this, all you need to do is edit the example.com file, and the use the make(1) command to bring everything up-to-date.

If you were using NIS, NIS+ or LDAP you would update them, rather than the static file, especially since on many systems the static file doesn't do anything.

dns-ng version 1.8,
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Peter Miller; All rights reserved.

The dns-ng program comes with ABSOLUTELY NO WARRANTY; for details use the 'dns-ng -VERSion Warranty' command. The dns-ng program is free software, and you are welcome to redistribute it under certain conditions; for details use the 'dns-ng -VERSion Redistribution' command.

AUTHOR

Peter Miller E-Mail: millerp@canb.auug.org.au
/\/\* Web: http://www.canb.auug.org.au/~millerp/