Net::DNS::SEC::Tools::rollmgr3pm
Communicate with the dnssec-tools rollover manager.
Usage
use Net::DNS::SEC::Tools::rollmgr;$dir = rollmgr_dir();$idfile = rollmgr_idfile();$id = rollmgr_getid();rollmgr_dropid();rollmgr_rmid();rollmgr_cmdint();$runflag = rollmgr_running();rollmgr_halt();rollmgr_phasemsg('long');rollmgr_channel(1);($cmd,$data) = rollmgr_getcmd();$ret = rollmgr_verifycmd($cmd);rollmgr_sendcmd(CHANNEL_CLOSE,ROLLCMD_ROLLZSK,"example.com");rollmgr_sendcmd(CHANNEL_WAIT,ROLLCMD_ROLLZSK,"example.com");($retcode, $respmsg) = rollmgr_getresp();$descr = rollmgr_get_phase('KSK', $phasecnt);
Overview
The Net::DNS::SEC::Tools::rollmgr module provides standard, platform-independent methods for a program to communicate with DNSSEC-Tools' rollerd rollover manager. There are two interface classes described here: general interfaces and communications interfaces.
General interfaces
The interfaces to the Net::DNS::SEC::Tools::rollmgr module are given below.
- rollmgr_dir()
-
This routine returns
rollerd's directory.
- rollmgr_idfile()
-
This routine returns
rollerd's id file.
- rollmgr_getid()
-
This routine returns
rollerd's process id. If a non-zero value is passed as an argument, the id file will be left open and accessible through the PIDFILE file handle. See the WARNINGS section below.Return Values:
On success, the first portion of the file contents(up to 80 characters) is returned.-1 is returned if the id file does not exist.
- rollmgr_dropid()
-
This interface ensures that another instance of
rollerdis not running and then creates a id file for future reference.Return Values:
1 - the id file was successfully created for this process0 - another process is already acting as rollerd-1 - unable to create the id file
- rollmgr_rmid()
-
This interface deletes
rollerd's id file.Return Values:
1 - the id file was successfully deleted0 - no id file exists-1 - the calling process is not rollerd-2 - unable to delete the id file
- rollmgr_cmdint()
-
This routine informs
rollerdthat a command has been sent via rollmgr_sendcmd().Return Values:
-1 - an invalid process id was found for rollerdAnything else indicates the number of processes that weresignaled.(This should only ever be 1.)
- rollmgr_running()
-
This routine determines if rollerd is running and returns a value indicating the status.
Return Values:
1 - rollerd is running.0 - The process listed in the rollerd process id fileis not running.-1 - Unable to get the rollerd process id.
- rollmgr_halt()
-
This routine informs
rollerdto shut down.In the current implementation, the return code from the
kill()command is returned.-1 - an invalid process id was found for rollerdAnything else indicates the number of processes that weresignaled.(This should only ever be 1.)
- rollmgr_loadzone(ctlprog,opts,zone)
-
This routine informs a name server to reload a zone's zone file. The $ctlprog argument is the command that will be run to control the name server. If this is an empty string, then the default value for DNSSEC-Tools will be used. The $opts argument is a set of options to be passed to ctlprog. The $zone argument is the name of the zone to be reloaded.
The command line to be run is built in this format:
<$zone> <$opts> reload <$zone>This format assumes that the
rndccommand will be used for signalling the name server.The return value will be the return code from running $ctlprog.
- rollmgr_phasemsg()
-
This routine sets the phase-message length. of phase-related log messages used by
rollerd. The valid levels are "long" and "short", with "long" being the default value.The long message length means that a phase description will be included with some log messages. For example, the long form of a message about ZSK rollover phase 3 will look like this: "ZSK phase 3 (Waiting for old zone data to expire from caches)".
The short message length means that a phase description will not be included with some log messages. For example, the short form of a message about ZSK rollover phase 3 will look like this: "ZSK phase 3".
Return Values:
1 - the phase-message length was set0 - an invalid phase-message length was specified
Rollerd communications interfaces
- rollmgr_channel(serverflag)
-
This interface sets up a persistent channel for communications with
rollerd. If serverflag is true, then the server's side of the channel is created. If serverflag is false, then the client's side of the channel is created.Currently, the connection may only be made to the localhost. This may be changed to allow remote connections, if this is found to be needed.
Return Values:
1 - Communications channel successfully established.0 - Unable to connect to the server.-1 - Unable to create a Unix socket.-2 - Unable to bind to the Unix socket. (server only)-3 - Unable to change the permissions on the Unix socket. (server only)-4 - Unable to listen on the Unix socket. (server only)-5 - The socket name was longer than allowed for a Unix socket.
- rollmgr_queuecmd(cmdname, value)
-
This interface internally remembers a command and it's optional value for later processing. See the rollmgr_getcmd() next for further details.
- rollmgr_getcmd()
-
rollmgr_getcmd() processes commands that need to be dealt with. If there are any internally stored commands queued via the rollmgr_queuecmd() function, they are dealt with first. After that it retrieves a command sent over
rollerd's communications channel by a client program. The command and the command's data are sent in each message.The command and the command's data are returned to the caller.
- rollmgr_sendcmd(closeflag,cmd,data)
-
rollmgr_sendcmd() sends a command to
rollerd. The command must be one of the commands from the table below. This interface creates a communications channel torollerdand sends the message. The channel is not closed, in case the caller wants to receive a response fromrollerd.The available commands and their required data are:
command data purpose------- ---- -------ROLLCMD_DISPLAY 1/0 start/stop rollerd'sgraphical displayROLLCMD_DSPUB zone-name a DS record has beenpublishedROLLCMD_DSPUBALL none DS records published for allzones in KSK rollover phase 5ROLLCMD_GETSTATUS none currently unusedROLLCMD_LOGFILE log filename change the log fileROLLCMD_LOGLEVEL log level set a new logging levelROLLCMD_LOGMSG log message add a message to the logROLLCMD_LOGTZ timezone set timezone for log messagesROLLCMD_MERGERRFS rollrec files merge rollrec files with thecurrent rollrec fileROLLCMD_PHASEMSG long/short set long or short phasemessagesROLLCMD_QUEUELIST none returns the names and nextevent time of zones in the"soon queue(experimental)ROLLCMD_QUEUESTATUS none returns information aboutthe state of soon-queueprocessing(experimental)ROLLCMD_ROLLALL none resume rollover for allsuspended zonesROLLCMD_ROLLALLZSKS none force all zones to startZSK rolloverROLLCMD_ROLLKSK zone-name force a zone to startKSK rolloverROLLCMD_ROLLREC rollrec-name change rollerd's rollrec fileROLLCMD_ROLLZONE zone name restart rollover for asuspended zoneROLLCMD_ROLLZSK zone-name force a zone to startZSK rolloverROLLCMD_RUNQUEUE none rollerd runs throughits queueROLLCMD_SHUTDOWN none stop rollerdROLLCMD_SIGNZONE zone sign a zone (no rollover)ROLLCMD_SIGNZONEs all or active sign all or active zonesROLLCMD_SKIPALL none suspend all rolloversROLLCMD_SKIPZONE zone name suspend rollover for arolling zoneROLLCMD_SLEEPTIME seconds-count set rollerd's sleep timeROLLCMD_SPLITRRF rollrec-name, move a set of zones from thezone names current rollrec file into anew rollrec fileROLLCMD_STATUS none get status of rollerdROLLCMD_ZONEGROUP zonegroup name get info on all zonegroupsor a particular zonegroupROLLCMD_ZONELOG zone name set the logging level forlogging level a particular zoneROLLCMD_ZONESTATUS none get status of the zonesROLLCMD_ZSARGS zonesigner args add a (probably temporary)zone list set of options to the signingof a set of zonesThe data aren't checked for validity by rollmgr_sendcmd(); validity checking is a responsibility of
rollerd.If the caller does not need a response from
rollerd, then closeflag should be set toCHANNEL_CLOSE; if a response is required then closeflag should beCHANNEL_WAIT. These values are boolean values, and the constants aren't required.On success, 1 is returned. If an invalid command is given, 0 is returned.
- rollmgr_getresp()
-
After executing a client command sent via rollmgr_sendcmd(),
rollerdwill send a response to the client. rollmgr_getresp() allows the client to retrieve the response.A return code and a response string are returned, in that order. Both are specific to the command sent.
- rollmgr_verifycmd(cmd)
-
rollmgr_verifycmd() verifies that cmd is a valid command for
rollerd. 1 is returned for a valid command; 0 is returned for an invalid command.1 is returned for a valid command; 0 is returned for an invalid command.
- rollmgr_get_phase(phasetype, phasenum)
-
rollmgr_get_phase() returns a description of a particular phase for a particular type of rollover. phasetype specifies the type of rollover, and may be "KSK" or "ZSK". phasenum specifies the phase number whose description is desired. This must be an integer between 0 and 7 (KSK) or 0 and 4 (ZSK). If an invalid phase type or phase number is specified, an empty string is returned.
Warnings
1. rollmgr_getid() attempts to exclusively lock the id file. Set a timer if this matters to you.
2. rollmgr_getid() has a nice little race condition. We should lock the file prior to opening it, but we can't do so without it being open.
Releases
3 releases since Debian 6.0 (Squeeze); the text changed 2 times.