omcmd 0.4.6 review

Download
by rbytes.net on

omcmd is a scriptable CLI program for performing actions on a running ISC DHCP server using OMAPI. It can currently be used to cre

License: GPL (GNU General Public License)
File size: 0K
Developer: David L. Parsley
0 stars award from rbytes.net

omcmd is a scriptable CLI program for performing actions on a running ISC DHCP server using OMAPI.

It can currently be used to create, remove, modify, and look up hosts and leases. It was created for use with a home-grown netreg application.

Building:

You must install dhcp-devel first. Check the locations of the include files
for dhcp. I don't know squat about autoconf & friends, just type 'make' and
correct any errors you get.

Usage: omcmd [-k keyname secret | -K keyfile ] [-s server] [-v]
< command > < objtype > < args >

The keyname & secret are the same as the values in the dhcpd.conf file; the secret is base64 encoded. If using a 'keyfile', line1=keyname, line2=secret.

-v for verbose output (see below)

command is one of:

lookup - find an object and print properties
create - create a new object
remove - remove an object
modify - modify an object

objtype is one of:

host
lease

For all commands, the first arg should be of the form property=value, and should be a 'lookup' value (see OMAPI in man dhcpd), i.e.: ip-address=10.20.30.40. For remove, this is the only required argument.

For create & modify, the remaining arguments are more property=value strings
supported properties so far:

ip-address - e.g. "ip-address=10.20.30.40"
hardware-type - e.g. "hardware-type=1" (you almost always use this when
specifying the hardware-address)
hardware-address - e.g. "hardware-address=00:10:20:30:40:50"
state - e.g. "state=free" (you can use this to free an active lease)
name - e.g. "name=mylaptop"
client-hostname (similar)

For the appropriate properties for an object type, see 'man dhcp'.

For 'lookup', you can leave off remaining args, and it will print what it finds (in verbose mode). You can also specify property names you want found, and it will spit them out one per line (non-verbose mode), or as property=value strings (verbose). Lookup properties supported are: ends, tstp, tsfp, cltt, ip-address, client-hostname, name, dhcp-client-identifier, hardware-address, hardware-type, and state.

Currenlty, only host & lease objects are supported, but adding support for
other known object types shouldn't be hard.

The return value is 255 for invalid usage, otherwise a value of type
isc_result_t.
(see include/isc-dhcp/result.h)

omcmd 0.4.6 search tags