Clearing all registrations
One feature missing from NetReg is the ability to clear all registrations in order to force network users to register again. Forcing everyone to register again gives another opportunity to scan their machines for vulnerabilities with the Nessus ScanLite plugin.
All that needs to be done to clear registrations is to empty the netreg.registered file contents. NetReg stores registrations in this file in the form of a dhcpd.conf host entry. The dhcpd.conf file includes this NetReg file in order to pick up the known hosts that have registered. Making any change to this file will trigger a dhcpd restart via the refresh-dhcpdconf script, then all hosts will be unknown again. However, the dhcpd server will remember the leases that it has given out, so these need to be cleared, as well.
I added a function to the admin.cgi script to clear all registrations by emptying out the netreg.registered file (this will be shown in a following post that covers other changes to admin.cgi). I made corresponding changes to the refresh-dhcpdconf script to look at the size of the netreg.registered file and if it is zero, also remove the dhcpd.leases files (see previous post with refresh-dhcpdconf).
The result is a button on the admin site to clear all registrations that empties the netreg.registered file, triggering the clearing of dhcpd leases and a dhcpd restart.