Kostis Netzwerkberatung
Konstantinos Kostis
Talstr. 25, D-63322 Rödermark
Tel. +49 6074 881056, FAX 881058
kosta@kostis.net, http://www.kostis.net/

You may use this software free of charge at your own risk

netdb 3.0.6 (2001-01-29)


/etc/netdb/bin/

netdb binaries and scripts

File   Type   Function
arp2mac   perl5   filter: convert arpwatch MAC format to netdb MAC format
arp2date   perl5   filter: convert arpwatch date format to ISO 8601 format
in.dhcpd.update   perl5   inetd/xinetd server for locally updating and restarting dhcpd
in.netdb.export   perl5   export netdb data through network port netdb-export (1329)
netdb   C bin   main netdb work horse
netdb.add   shell   add an entry to netdb if data is valid and does not collide
netdb.allow   shell   check authorization (is user allowed to administer?)
netdb.backup   shell   backup all
netdb.backup.data   shell   backup data only
netdb.backup.sansdata   shell   backup all but data
netdb.check   shell   check if netdb data seems intact
netdb.chkaddr   perl5   check if addresses (ipaddr, ipx, decnet, x25) collide
netdb.chkcname   perl5   check if cnames collide
netdb.count   shell   count number of entries in netdb or in a virtual subdomain
netdb.del   shell   delete an entry from netdb
netdb.dhcpd   shell   control dhcpd
netdb.dnsadd   shell   add entry to DNS (A, PTR and CNAME)
netdb.dnsdel   shell   delete an entry from DNS
netdb.export   shell   export netdb data in CSV format
netdb.getvalue   shell   get value of a given property in an entry
netdb.import   shell   import CSV data into netdb
netdb.init   shell   initialize netdb: file permissions and such
netdb.install   shell   compile Standard C programmes and install them
netdb.mkdhcpd.conf   shell   create dhcpd.conf file for a virtual subdomain (stdout)
netdb.mkdhcpd.conf.all   shell   create dhcpd.conf file for all virtual subdomains
netdb.mkdomain   shell   create a virtual subdomain
netdb.mklist   shell   create list of virtual subdomains using user's rights for netdb
netdb.mknamed   shell   create bind 8/9 DNS zone files under /var/named
netdb.mknamed.conf   shell   create bind 8/9 named.conf file (stdout)
netdb.mknamed.dlr   shell   special application (for DAF)
netdb.rmdomain   shell   delete a virtual subdomain
netdb.tid   shell   increment and return current transaction id (for rollbacks)
netdb.vsatping   shell   special application (for DAF)
netdbcsv   perl5   filter: convert CSV format into netdb format
netdbdel   perl5   filter: delete given entry from netdb data input stream
netdberr   perl5   report authorization failure
netdbget   perl5   filter: get given entry from netdb data input stream
netdbipc   C bin   IP calculator
splitfrm   perl5   filter: convert POST method data into environment variables
tab2csv   perl5   filter: convert tab separated format (from Excel) into proper CSV format

/etc/netdb/bin/arp2date

perl 5 script

Converts a date in arpwatch format (epoch date) into ISO 8601 hence human readable format.

This script is not used anywhere in netdb. It was created to help work with arpwatch.

Syntax

arp2date <arpwatch-data >output

Example

cat /var/arpwatch/arp.dat | arp2mac | arp2date

/etc/netdb/bin/arp2mac

perl 5 script

Converts a MAC address in arpwatch format into the netdb format for mac addresses.

This script is not used anywhere in netdb. It was created to help import data gathered by arpwatch but this is not supported anymore.

There is only supported way of importing data into netdb: netdb.import

Syntax

arp2mac <arpwatch-mac >mac

Example

echo "0:1:2:3:aa:5" | arp2mac

Output: 00-01-02-03-AA-05

/etc/netdb/bin/in.dhcpd.update

perl 5 script

Only if this script is called by inetd/xinetd from the local machine, this script will run netdb.mkdhcpd.conf.all and then restart dhcpd.

Currently only the isc dhcpd configuration file format is created. The command used for restarting dhcpd is somewhat Red Hat Linux specific:

/etc/rc.d/init.d/dhcpd restart

You may want to change this on other platforms. Please backup your changes since future netdb updates will overwrite this file.

In order to activate this, add the following line to /etc/services:

dhcpdupdate 65432/tcp # dhcpd update for netdb

If you use inetd, please add the following line to /etc/inetd.conf and restart inetd using killall -HUP inetd:

dhcpdupdate stream tcp nowait root /etc/netdb/bin/in.dhcpd.update

If you use xinetd, create a file /etc/xinetd.d/dhcpupdate with the following content and restart xinetd using killall -USR xinetd:

# default: on
# description: The dhcpdupdate server allows to update /etc/dhcpd.conf \
# and restart dhcpd; it will only work on the local machine.
service dhcpdupdate
{
        flags = REUSE
        socket_type = stream
        wait = no
        user = root
        server = /etc/netdb/bin/in.dhcpd.update
        log_on_success += USERID
        log_on_failure += USERID
}

Directories on your platform may vary. It's a shame there isn't a single standard for these things.

The above example is good on a Red Hat Linux 7.0 system.

If did not run dhcpd on your machine, you may need to create a file as user root called /var/lib/dhcp/dhcpd.leases like this:

touch /var/lib/dhcp/dhcpd.leases

Again, this may be somewhat Red Hat Linux specific.

To actually invoke this script and hence have /etc/dhcpd.conf rewritten and dhcpd restarted, do the following on the machine that is running netdb.

telnet localhost dhcpdupdate

No special user rights are required for this, which is why you don't want to install netdb on machine with normal users. Ideally there is only the default system accounts, netdb and any number of other necessary system administrator accounts.

/etc/netdb/bin/in.netdb.export

perl 5 script

If this script is called by inetd/xinetd, this script will export all netdb data.

In order to activate this, add the following line to /etc/services if not already present:

netdb-export 1329/tcp # netdb export

If you use inetd, please add the following line to /etc/inetd.conf and restart inetd using killall -HUP inetd:

netdb-export stream tcp nowait netdb /etc/netdb/bin/in.netdb.export

If you use xinetd, create a file /etc/xinetd.d/dhcpupdate with the following content and restart xinetd using killall -USR xinetd:

# default: on
# description: The netdb-export server exports netdb data \
service netdb-export
{
        flags = REUSE
        socket_type = stream
        wait = no
        user = netdb
        server = /etc/netdb/bin/in.netdb.export
        log_on_success += USERID
        log_on_failure += USERID
}

Directories on your platform may vary. It's a shame there isn't a single standard for these things.

The above example is good on a Red Hat Linux 7.0 system.

To actually invoke this script and export all netdb data, do this.

telnet machine-running-netdb netdb-export

Then type: export<enter>

No special user rights are required for this.

/etc/netdb/bin/netdb

Standard C program binary

netdb is a filter reading netdb data from stdin, using a given format file as a template for it's output.

It replaces all occurences of placeholders in the given format file by their values and then outputs the content of the format file for each netdb entry fed to the program netdb using the properties found in each entry. Tough one, I know. Basically you have two things: a) in input stream in netdb format containing entries, each entry with some properties. Then you got a configuration file you may want to create that makes use of the data or something derived from the data. When ever you want netdb to fill in netdb data, use a placeholder in the format file.

Values can either be

All those placeholders have the format %name% ([percent sign]name[percent sign]).

%name% is checked against the list of

  1. netdb properties
  2. netdb functions
  3. environment variables

Empty or non-existing environment variables are skipped (left empty).

If the input stream is empty, nothing is output.

Syntax

netdb <netdbfile >output formatfile {-i} {-n} {-d} {-x} {-m}

or

netdb <netdbfile >output formatfile {-a}

or

netdb <netdbfile >output -c

Parameters in curly brackets are optional switches and must be entered without curly brackets.

Currently all netdb switches are optional. Optional switches may be combined using a logical AND.

The switches mentioned above have the following function:

switch   function
-i   output only if ipaddr is set
-n   output only if ipxaddr is set
-d   output only if decnet is set
-x   output only if x25 is set
-m   output only if mac is set
-a   output only if cnames is set, implies -i

The use of command line switches is an easy way to filter data depending on which values need to be set to correctly create a configuration file using a format file.

Interfaces that have no IP address value like DECnet Phase IV only or IPX only interfaces will be filtered out using -i.

This is important when trying to create configuration files for DNS/bind, DHCP and such things.

Command line switch -c checks a netdb network data entry:

The check does not cross check between entries at all. That means it doesn't check for multiple entries with identical data (ipaddr, decnet, ipxaddr, x25). This must be performed using other means and is not part of netdb.

When netdb is called with -c no format file is given since output will always be in netdb format. Sedecimal digits may be converted to capital and/or small letters as needed (ipxaddr, ipxlan, mac). Should an entry contain invalid data an error message is displayed and the error code ERR_FORMAT is returned. This check is designed to perform a check only on one single entry but if more entries are fed into netdb it will check them all.

Format files do control the output files which will contain the desired configuration data. Format files should have the extension .frm but they can have any extension like .htm. What ever pleases you.

Example

netdb <netdbfile >hosts $NETDB/frm/hosts.frm

/etc/netdb/bin/netdb.add

shell script

Add/replace an entry in netdb data. Perform both a number of checks before doing so and delete old entry with the same hostname. In that case it does replace the entry rather then add.

Used by:

The checks performed are the following:

return value   what has failed
1   syntax error
2   netdb -c (see above)
3   hostname empty
4   unknown virtual subdomain (%domain%)
5   at least one cname conflicts with an existing hostname
6   hostname and/or at least one cname conflict with existing cname
7   one of the addresses (ipaddr, ipx, decnet, x25) is already in netdb under a different hostname hence not unique

If all checks are "go", the entry is added/replaced including logging. Please: only one entry at a time when you call netdb.add.

Syntax

netdb.add <netdb-entry

netdb-entry must be in netdb data file format.

/etc/netdb/bin/netdb.allow

shell script

Perform authorizational checks when accessing netdb GUI and administering netdb data.

Depending on the parameters given to this at runtime, output varies.

Syntax

netdb.allow all

If $REMOTE_USER is listed in file /etc/netdb/allow (aka $NETDB/allow) and is allowed to administer all, all is displayed, else nothing.

or

netdb.allow test

If $REMOTE_USER is listed in file /etc/netdb/allow (aka $NETDB/allow), $REMOTE_USER is displayed, else nothing.

or

netdb.allow virtual-subdomain

If $REMOTE_USER is allowed to administer the given virtual subdomain, display given parameter, else nothing.

or

netdb.allow

This will display all virtual subdomains user $REMOTE_USER is allowed to administer. An empty list means the user is effectively not allowed to administer any netdb data.

Example

Let's assume $REMOTE_USER is netdb and is allowed to administer all virtual subdomain (catch all entry "*"). Virtual subdomains are ".ext" and ".usr".

netdb.allow test

Output: netdb

netdb.allow .usr

Output: .usr

netdb.allow

Output: .ext .usr

/etc/netdb/bin/netdb.backup

shell script

Full backup of netdb under /home/netdb/netdb-all-$NETDBVER.tar.gz

Please ignore warning messages such as "tar: Removing leading `/' from member names"

Syntax

netdb.backup

/etc/netdb/bin/netdb.backup.data

shell script

Backup only netdb data files under /home/netdb/netdb-data.tar.gz

Please ignore warning messages such as "tar: Removing leading `/' from member names"

Syntax

netdb.backup.data

/etc/netdb/bin/netdb.backup.sansdata

shell script

Backup all of netdb except for data files under /home/netdb/netdb-$NETDBVER.tar.gz

Please ignore warning messages such as "tar: Removing leading `/' from member names"

Syntax

netdb.backup.sansdata

/etc/netdb/bin/netdb.check

shell script

Check netdb data. If this procedure finds an error, manual repair is needed no doubt. Checks the following things:

Presence of essential files

If any of the above files are missing, netdb.check aborts.

Check general netdb data file syntax

If errors occured so far, more sophisticated checks are performed.

Check for address and name conflicts

If after all those checks no error has occured the following message is displayed:

netdb.check: no obvious errors found

File permissions are not checked.

In case of an error the return level is non-zero, else it is zero.

Syntax

netdb.check

/etc/netdb/bin/netdb.chkaddr

perl 5 script

Check given addresses (ipaddr, ipx, decnet, x25) against input stream in same format. If any of the addresses conflicts, return an error message.

return value   error
0   all is OK
1   syntax error
2   found hits (conflicts)

Syntax

netdb.chkaddr <unique-list [hostname,ipaddr,ipx,decnet,x25]

ipx is the concatenation of ipxlan and ipxaddr. unique-list is the list of all netdb entries in unique.frm format.

If no parameter is given a consistency check only is performed.

/etc/netdb/bin/netdb.chkcname

perl 5 script

Check given hostname and cnames against input stream in same format. If any of the names conflicts, return an error message.

return value   error
0   all is OK
1   syntax error
2   found hits (conflicts)

Syntax

netdb.chkcname <cnameslist [hostname] [cname1] ...

If no parameter is given a consistency check only is performed.

/etc/netdb/bin/netdb.count

shell script

Count number of entries in a virtual subdomain or complete netdb.

Syntax

netdb.count [virtual-subdomain]

Example for virtual subdomain .usr

netdb.count .usr

/etc/netdb/bin/netdb.del

shell script

Delete an entry from netdb.

Used by:

Syntax

netdb.del hostname

/etc/netdb/bin/netdb.dhcpd

shell script

Control dhcpd.

Used by:

/etc/netdb/bin/netdb.dnsadd

shell script

Add an entry to DNS. If option cnames is given only CNAMEs are added, not A and PTR also.

Used by:

Syntax

netdb.dnsadd <netdb-entry [cnames]

/etc/netdb/bin/netdb.dnsdel

shell script

Delete an entry from DNS. If option cnames is given only CNAMEs are deleted, A and PTR remain.

Used by:

Syntax

netdb.dnsdel hostname [cnames]

/etc/netdb/bin/netdb.export

shell script

Export all netdb data or only data from one virtual subdomain in CSV format.

Syntax

netdb.export >csvfile [virtual-subdomain]

Example for virtual subdomain .usr

netdb.export >csvfile .usr

/etc/netdb/bin/netdb.getvalue

shell script

Get value for a given property using given entries.

Syntax

netdb.getvalue <netdb-entries property

Example - return domain value for hostname example

cat $DOMAIN.* | netdbget example | netdb.getvalue domain

/etc/netdb/bin/netdb.import

shell script

Import data in CSV format into netdb.

Syntax

netdb.import <csvfile

csvfile must be in CSV format.

/etc/netdb/bin/netdb.init

shell script

Adjust file permissions, create directories and such.

Syntax

netdb.install

/etc/netdb/bin/netdb.install

shell script

Compile and install Standard C program binaries.

Syntax

netdb.install

/etc/netdb/bin/netdb.mkdhcpd.conf

shell script

Create dhcpd.conf configuration file for a given virtual subdomain.

Syntax

netdb.mkdhcpd.conf >dhcpd.conf virtual-subdomain

Example for virtual subdomain .usr

netdb.mkdhcpd.conf >/etc/dhcpd.conf .usr

/etc/netdb/bin/netdb.mkdhcpd.conf.all

shell script

Create /etc/dhcpd.conf configuration file for all virtual subdomains. Must be called from a user with rights to write /etc/dhcpd.conf.

Syntax

netdb.mkdhcpd.conf.all

/etc/netdb/bin/netdb.mkdomain

shell script

Create a virtual subdomain.

Syntax

netdb.mkdomain virtual-subdomain,ipnetaddr,ipmask,location,remark

Example

netdb.mkdomain .example,10.7.150.0,255.255.254.0,where-is-it,what-is-it

/etc/netdb/bin/netdb.mklist

shell script

Display list of choices depending on user and /etc/netdb/allow file for netdb admin GUI.

Used by

Syntax

netdb.mklist directory-pattern cgi-script-to-call parameter-to-cgi-script

/etc/netdb/bin/netdb.mknamed

shell script

Create DNS/bind zone files under /var/named. Check file permissions before running this script. Should probably run as user root.

This method of creating DNS/bind zone files is no longer supported and my vanish in netdb 3.1. Please use dynamic DNS instead. If you don't want to use dynamic DNS and insist on using this method, make sure to create a file /etc/netdb/nodyndns to prevent netdb from doing dynamic DNS updates and also DHCP updates.

/etc/netdb/bin/netdb.mknamed.conf

shell script

Create DNS/bind 8/9 named.conf file.

Syntax

netdb.mknamed.conf >named.conf-file

Example

netdb.mknamed.conf >/etc/named.conf

/etc/netdb/bin/netdb.mknamed.dlr

shell script

Special application for DAF (dealer DNS)

Syntax

netdb.mknamed.dlr

/etc/netdb/bin/netdb.rmdomain

shell script

Delete virtual subdomain data file.

Caution: be careful with this one since this script will not ask before it deletes all entries of a virtual subdomain and the virtual subdomain itself.

Syntax

netdb.rmdomain virtual-subdomain

Example

netdb.rmdomain .example

/etc/netdb/bin/netdb.tid

shell script

Increment and return current transaction id (for rollbacks).

Syntax

netdb.tid

Example

tid=`netdb.tid`

/etc/netdb/bin/netdb.vsatping

shell script

Special application for checking DAF VSAT network.

Syntax

netdb.vsatping >vsat-html-file

/etc/netdb/bin/netdbcsv

perl 5 script

Convert CSV data format into netdb format.

Syntax

netdbcsv <csvfile >netdbfile

/etc/netdb/bin/netdbdel

perl 5 script

Delete given entry for hostname from input file (filter)

Syntax

netdbdel <old-netdb-fille >new-netdb-file hostname

/etc/netdb/bin/netdberr

perl 5 script

Display authorization failure error message (for netdb admin GUI)

Syntax

netdberr

/etc/netdb/bin/netdbget

perl 5 script

Display given entry for hostname from input file (filter)

Syntax

netdbget <netdb-file >netdb-entry hostname

/etc/netdb/bin/netdbipc

Standard C program binary

IP address calculator

Syntax

netdbipc {-n|-b|-f|-l} ipaddr ipmask
netdbipc {-a|-s} ipaddr ipmask offset

Switch   Function/Result Meaning
-n   %ipnetaddr% subnet network address
-b   %ipbroad% subnet broadcast address
-f   %ipfirst% first ipaddr in subnet
-l   %iplast% last ipaddr in subnet
-a     add offset to ipaddr
-s     subtract offset from ipaddr

Example

netdbipc -n 192.168.0.107 255.255.255.248   (results in 192.168.0.104)
netdbipc -b 192.168.0.107 255.255.255.248   (results in 192.168.0.111)
netdbipc -f 192.168.0.107 255.255.255.248   (results in 192.168.0.105)
netdbipc -l 192.168.0.107 255.255.255.248   (results in 192.168.0.110)
netdbipc -a 192.168.0.107 255.255.255.248 2   (results in 192.168.0.109)
netdbipc -s 192.168.0.107 255.255.255.248 2   (results in 192.168.0.105)

/etc/netdb/bin/splitfrm

perl 5 script

Convert form data into script setting environment variables.

Usage: create script, execute it using ".", then remove script.

Syntax

splitfrm <form-data >shell-script

Example

splitfrm>/tmp/formdata
. /tmp/formdata
rm /tmp/formdata

/etc/netdb/bin/tab2csv

perl 5 script

Convert tab separated data into CSV format.

Syntax

tab2csv <tabfile >csvfile