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)
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
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.
arp2date <arpwatch-data >output
cat /var/arpwatch/arp.dat | arp2mac | arp2date
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
arp2mac <arpwatch-mac >mac
echo "0:1:2:3:aa:5" | arp2mac
Output: 00-01-02-03-AA-05
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.
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.
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
Empty or non-existing environment variables are skipped (left empty).
If the input stream is empty, nothing is output.
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.
netdb <netdbfile >hosts $NETDB/frm/hosts.frm
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.
netdb.add <netdb-entry
netdb-entry must be in netdb data file format.
shell script
Perform authorizational checks when accessing netdb GUI and administering netdb data.
Depending on the parameters given to this at runtime, output varies.
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.
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
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"
netdb.backup
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"
netdb.backup.data
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"
netdb.backup.sansdata
shell script
Check netdb data. If this procedure finds an error, manual repair is needed no doubt. Checks the following things:
If any of the above files are missing, netdb.check aborts.
If errors occured so far, more sophisticated checks are performed.
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.
netdb.check
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)
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.
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)
netdb.chkcname <cnameslist [hostname] [cname1] ...
If no parameter is given a consistency check only is performed.
shell script
Count number of entries in a virtual subdomain or complete netdb.
netdb.count [virtual-subdomain]
netdb.count .usr
shell script
Delete an entry from netdb.
Used by:
netdb.del hostname
shell script
Control dhcpd.
Used by:
shell script
Add an entry to DNS. If option cnames is given only CNAMEs are added, not A and PTR also.
Used by:
netdb.dnsadd <netdb-entry [cnames]
shell script
Delete an entry from DNS. If option cnames is given only CNAMEs are deleted, A and PTR remain.
Used by:
netdb.dnsdel hostname [cnames]
shell script
Export all netdb data or only data from one virtual subdomain in CSV format.
netdb.export >csvfile [virtual-subdomain]
netdb.export >csvfile .usr
shell script
Get value for a given property using given entries.
netdb.getvalue <netdb-entries property
cat $DOMAIN.* | netdbget example | netdb.getvalue domain
shell script
Import data in CSV format into netdb.
netdb.import <csvfile
csvfile must be in CSV format.
shell script
Adjust file permissions, create directories and such.
netdb.install
shell script
Compile and install Standard C program binaries.
netdb.install
shell script
Create dhcpd.conf configuration file for a given virtual subdomain.
netdb.mkdhcpd.conf >dhcpd.conf virtual-subdomain
netdb.mkdhcpd.conf >/etc/dhcpd.conf .usr
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.
netdb.mkdhcpd.conf.all
shell script
Create a virtual subdomain.
netdb.mkdomain virtual-subdomain,ipnetaddr,ipmask,location,remark
netdb.mkdomain .example,10.7.150.0,255.255.254.0,where-is-it,what-is-it
shell script
Display list of choices depending on user and /etc/netdb/allow file for netdb admin GUI.
Used by
netdb.mklist directory-pattern cgi-script-to-call parameter-to-cgi-script
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.
shell script
Create DNS/bind 8/9 named.conf file.
netdb.mknamed.conf >named.conf-file
netdb.mknamed.conf >/etc/named.conf
shell script
Special application for DAF (dealer DNS)
netdb.mknamed.dlr
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.
netdb.rmdomain virtual-subdomain
netdb.rmdomain .example
shell script
Increment and return current transaction id (for rollbacks).
netdb.tid
tid=`netdb.tid`
shell script
Special application for checking DAF VSAT network.
netdb.vsatping >vsat-html-file
perl 5 script
Convert CSV data format into netdb format.
netdbcsv <csvfile >netdbfile
perl 5 script
Delete given entry for hostname from input file (filter)
netdbdel <old-netdb-fille >new-netdb-file hostname
perl 5 script
Display authorization failure error message (for netdb admin GUI)
netdberr
perl 5 script
Display given entry for hostname from input file (filter)
netdbget <netdb-file >netdb-entry hostname
Standard C program binary
IP address calculator
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
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)
perl 5 script
Convert form data into script setting environment variables.
Usage: create script, execute it using ".", then remove script.
splitfrm <form-data >shell-script
splitfrm>/tmp/formdata
. /tmp/formdata
rm /tmp/formdata
perl 5 script
Convert tab separated data into CSV format.
tab2csv <tabfile >csvfile