File: rollctl

package info (click to toggle)
dnssec-tools 1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 16,064 kB
  • sloc: perl: 44,399; ansic: 31,547; cpp: 21,306; sh: 15,813; xml: 2,113; makefile: 1,390; pascal: 836; python: 290; csh: 11
file content (1687 lines) | stat: -rwxr-xr-x 38,936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
#!/usr/bin/perl
#
# Copyright 2006-2012 SPARTA, Inc.  All rights reserved.  See the COPYING
# file distributed with this software for details.
#
#
# rollctl
#
#	This script controls the rollover daemon.
#	See the pod for more details.
#

#
# If we're executing from a packed environment, make sure we've got the
# library path for the packed modules.
#
BEGIN
{
	if($ENV{'PAR_TEMP'})
	{
		unshift @INC, ("$ENV{'PAR_TEMP'}/inc/lib");
	}
}


use strict;

use Getopt::Long qw(:config no_ignore_case_always);
# use Getopt::Long qw(:config no_ignore_case_always debug);
# $Getopt::Long::debug = 1;

use Net::DNS::SEC::Tools::conf;
use Net::DNS::SEC::Tools::rollmgr;
use Net::DNS::SEC::Tools::rolllog;
use Net::DNS::SEC::Tools::tooloptions;

#
# Version information.
#
my $NAME   = "rollctl";
my $VERS   = "$NAME version: 1.13.0";
my $DTVERS = "DNSSEC-Tools Version: 1.13";

#######################################################################

#
# Data required for command line options.
#
my %options = ();			# Filled option array.
my @opts =
(
	"halt:s",			# Shutdown rollerd.
	"display",			# Turn on rollerd's graphical display.
	"dspub",			# Parent has published a DS record.
	"dspuball",			# Parents have published DS records.
	"logfile=s",			# Set rollerd's log file.
	"loglevel:s",			# Set rollerd's logging level.
	"logtz=s",			# Set rollerd's logging timezone.
	"mergerrfs",			# Merge a set of rollrec files.
	"phasemsg=s",			# Set rollerd's phase-message length.
	"pidfile=s",			# pid storage file.
	"nodisplay",			# Turn off rollerd's graphical display.
	"rollall",			# Resume all suspended zones.
	"rollallksks",			# KSK-roll all our zones.
	"rollallzsks",			# ZSK-roll all our zones.
	"rollksk",			# KSK roll the specified zone(s).
	"rollrec=s",			# Change the rollrec file.
	"rollzone",			# Restart the suspended, named zone(s).
	"rollzsk",			# ZSK roll the specified zone(s).
	"runqueue",			# Run the queue.
	"queuelist",			# Get list of zones in the soon queue.
	"queuestatus",			# Status of queue-soon event handler.
	"shutdown:s",			# Shutdown rollerd.
	"skipall",			# Stop all zones from rolling.
	"skipzone",			# Stop the named zone(s) from rolling.
	"signzone",			# Sign only the named zone(s).
	"signzones",			# Sign all the zones.
	"sleeptime=i",			# Set rollerd's sleep time.
	"splitrrf",			# Split a rollrec file in two.
	"status",			# Get rollerd's status.
	"zonegroup:s",			# Get a list of current zone groups.
	"zonelog",			# Set a zone's/zones' logging level.
	"zonestatus",			# Get status of zones.
	"zsargs",			# Set zonesigner args for some zones.

	"group",			# Apply command to zone group.

	"Version",			# Display the version number.
	"quiet",			# Don't print anything.
	"help",				# Give a usage message and exit.
);

#
# Flags for the options.  Variable/option mapping should obvious.
#
my $commandcount    = 0;

my $dispflag	    = 0;
my $dspubflag	    = 0;
my $dspuballflag    = 0;
my $groupflag	    = 0;
my $krollallflag    = 0;
my $logfileflag	    = 0;
my $loglevelflag    = 0;
my $logtzflag	    = 0;
my $logphasemsg	    = '';
my $mergerrfsflag   = 0;
my $nodispflag	    = 0;
my $rollallflag	    = 0;
my $rollkskflag	    = 0;
my $rollrecflag	    = 0;
my $rollzoneflag    = 0;
my $rollzskflag	    = 0;
my $runqueueflag    = 0;
my $queuelistflag   = 0;
my $queuestatusflag = 0;
my $shutdownflag    = 0;
my $signzoneflag    = 0;
my $signzonesflag   = 0;
my $skipallflag	    = 0;
my $skipzoneflag    = 0;
my $sleeptimeflag   = 0;
my $splitrrfflag    = 0;
my $statusflag	    = 0;
my $zonegroupflag   = undef;
my $zonelogflag	    = 0;
my $zonestatflag    = 0;
my $zrollallflag    = 0;
my $zsargsflag	    = 0;
my $pidfile	    = '';

my $quiet	    = 0;
my $version	    = 0;		# Display the version number.

#######################################################################


my $ret;				# Return code from main().

$ret = main();
exit($ret);

#-----------------------------------------------------------------------------
# Routine:	main()
#
# Purpose:	Yeah, yeah, a main() isn't necessary.  However, it offends my
#		sense of aesthetics to have great gobs of code on the same
#		level as a pile of globals.
#
#		But what about all those globals, you ask...
#
sub main()
{
	my $argc = @ARGV;		# Number of command line arguments.

	my $rcret = 0;			# Return code for rollctl.
	my $ret;			# Return code from rollerd.
	my $resp;			# Response message from rollerd.
	my $olderr;			# Saved error action.

	#
	# Use the packed config file if we're running as part of a packed
	# configuration.
	#
	if(runpacked())
	{
		setconffile("$ENV{'PAR_TEMP'}/inc/dnssec-tools.conf");
	}

	#
	# Check our options.  All the commands are alphabetized, except
	# for shutdown.  We'll save that for last.
	#
	doopts($argc);

	#
	# Run our configuration checks and make sure any error messages
	# will be printed.
	#
	$olderr = erraction(ERR_MSG);
	if(dt_confcheck(0) > 0)
	{
		print STDERR "rollctl:  configuration checks failed, can't send commands\n";
		exit(201);
	}
	erraction($olderr);

	#
	# If rollerd isn't running, we'll give an error message and exit.
	# Some rollmgr_running() implementations may not be fool-proof.
	#
	if(rollmgr_running() != 1)
	{
		print STDERR "rollerd is not running\n";
		exit(200);
	}

	#
	# Send commands for all the specified options.
	#
	if($dispflag)
	{
		if(! sendcmd(ROLLCMD_DISPLAY,1))
		{
			print STDERR "rollctl:  error sending command DISPLAY\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if(($ret == ROLLCMD_RC_OKAY) && ($ret ne ""))
		{
			print "rollerd display started\n";
		}
		else
		{
			print "rollerd display not started\n";
			$rcret++;
		}
	}
	elsif($dspubflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -dspub missing zone argument\n";
			exit(1);
		}

		foreach my $zone (@ARGV)
		{
			if(! sendcmd(ROLLCMD_DSPUB,$zone))
			{
				print STDERR "rollctl:  error sending command DSPUB($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "rollerd informed that parent has published DS record for zone $zone\n";
			}
			else
			{
				print "$resp\n";
				$rcret++;
			}
		}

	}
	elsif($dspuballflag)
	{
		if(! sendcmd(ROLLCMD_DSPUBALL,$dspuballflag))
		{
			print STDERR "rollctl:  error sending command DSPUBALL\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd informed that parents have published DS record for all zones in KSK rollover phase 6\n";
		}
		else
		{
			print "$resp\n";
			$rcret++;
		}
	}
	elsif($logfileflag)
	{
		if(! sendcmd(ROLLCMD_LOGFILE,$logfileflag))
		{
			print STDERR "rollctl:  error sending command LOGFILE\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd log file set to $logfileflag\n";
		}
		else
		{
			print "log-level set failed:  $resp\n";
			$rcret++;
		}
	}
	elsif($loglevelflag)
	{
		if(rolllog_validlevel($loglevelflag) == 0)
		{
			print STDERR "invalid rollerd log level: $loglevelflag\n";
			$rcret++;
		}
		else
		{
			if(! sendcmd(ROLLCMD_LOGLEVEL,$loglevelflag))
			{
				print STDERR "rollctl:  error sending command LOGLEVEL\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "rollerd log level set to $loglevelflag\n";
			}
			else
			{
				print "log-level set failed:  $resp\n";
				$rcret++;
			}
		}
	}
	elsif($logtzflag)
	{
		if(! sendcmd(ROLLCMD_LOGTZ,$logtzflag))
		{
			print STDERR "rollctl:  error sending command LOGTZ\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd log timezone set to $logtzflag\n";
		}
		else
		{
			print "log-tz set failed:  $resp\n";
			$rcret++;
		}
	}
	elsif($logphasemsg)
	{
		if(($logphasemsg !~ /long/i) && ($logphasemsg !~ /short/i))
		{
			print STDERR "invalid rollerd phase-message length: $logphasemsg\n";
			$rcret++;
		}
		else
		{
			if(! sendcmd(ROLLCMD_PHASEMSG,$logphasemsg))
			{
				print STDERR "rollctl:  error sending command PHASEMSG\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "rollerd phasemsg to $logphasemsg\n";
			}
			else
			{
				print "phasemsg set failed:  $resp\n";
				$rcret++;
			}
		}
	}
	elsif($mergerrfsflag)
	{
		my $rrfs = join(':', @ARGV);

		if(! sendcmd(ROLLCMD_MERGERRFS,$rrfs))
		{
			print STDERR "rollctl:  error sending command MERGERRFS\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd merged the rollrec files\n";
		}
		else
		{
			print "rollerd did not merge the rollrec files\n";
			$rcret++;
		}
	}
	elsif($nodispflag)
	{
		if(! sendcmd(ROLLCMD_DISPLAY,0))
		{
			print STDERR "rollctl:  error sending command DISPLAY\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd display stopped\n";
		}
		else
		{
			print "rollerd display not stopped\n";
			$rcret++;
		}
	}
	elsif($rollallflag)
	{
		if(! sendcmd(ROLLCMD_ROLLALL))
		{
			print STDERR "rollctl:  error sending command ROLLALL\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "all suspended zones now resumed:  $resp\n";
		}
		else
		{
			print "$resp";
			$rcret++;
		}
	}
	elsif($krollallflag)
	{
		if(! sendcmd(ROLLCMD_ROLLALLKSKS))
		{
			print STDERR "rollctl:  error sending command ROLLALLKSKS\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "all zones now in KSK rollover:  $resp\n";
		}
		else
		{
			print "$resp";
			$rcret++;
		}
	}
	elsif($zrollallflag)
	{
		if(! sendcmd(ROLLCMD_ROLLALLZSKS))
		{
			print STDERR "rollctl:  error sending command ROLLALLZSKS\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "all zones now in ZSK rollover:  $resp\n";
		}
		else
		{
			print "$resp";
			$rcret++;
		}
	}
	elsif($rollrecflag)
	{
		if(! sendcmd(ROLLCMD_ROLLREC,$rollrecflag))
		{
			print STDERR "rollctl:  error sending command ROLLREC\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd now using rollrec file $rollrecflag\n";
		}
		else
		{
			print "couldn't set rollrec file:  $resp\n";
			$rcret++;
		}
	}
	elsif($rollkskflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -rollksk missing zone argument\n";
			exit(2);
		}

		foreach my $zone (@ARGV)
		{
			if(! sendcmd(ROLLCMD_ROLLKSK,$zone))
			{
				print STDERR "rollctl:  error sending command ROLLKSK($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "$resp\n";
			}
			else
			{
				print "unable to force KSK rollover process for $zone:  $resp\n";
				$rcret++;
			}
		}
	}
	elsif($rollzoneflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -rollzone missing zone argument\n";
			exit(2);
		}

		foreach my $zone (@ARGV)
		{
			if(! sendcmd(ROLLCMD_ROLLZONE,$zone))
			{
				print STDERR "rollctl:  error sending command ROLLZONE($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "rollover restarted for zone $zone\n";
			}
			else
			{
				print "unable to restart rollover for zone $zone:  \"$resp\"\n";
				$rcret++;
			}
		}
	}
	elsif($rollzskflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -rollzsk missing zone argument\n";
			exit(2);
		}

		foreach my $zone (@ARGV)
		{
			if(! sendcmd(ROLLCMD_ROLLZSK,$zone))
			{
				print STDERR "rollctl:  error sending command ROLLZSK($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "$resp\n";
			}
			else
			{
				print "unable to force ZSK rollover process for $zone:  $resp\n";
				$rcret++;
			}
		}
	}
	elsif($runqueueflag)
	{
		if(! sendcmd(ROLLCMD_RUNQUEUE))
		{
			print STDERR "rollctl:  error sending command RUNQUEUE\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd checking rollrec queue\n";
		}
		else
		{
			#
			# Shouldn't ever get here...
			#
			print "couldn't force the rollrec queue:  $resp\n";
			$rcret++;
		}
	}
	elsif($queuelistflag)
	{
		if(! sendcmd(ROLLCMD_QUEUELIST))
		{
			print STDERR "rollctl:  error sending command QUEUELIST\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "$resp";
		}
		else
		{
			print "rollerd error response:  <$resp>\n";
			$rcret++;
		}
	}
	elsif($queuestatusflag)
	{
		if(! sendcmd(ROLLCMD_QUEUESTATUS))
		{
			print STDERR "rollctl:  error sending command QUEUESTATUS\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "$resp";
		}
		else
		{
			print "rollerd error response:  <$resp>\n";
			$rcret++;
		}
	}
	elsif($signzoneflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -signzone missing zone argument\n";
			exit(2);
		}

		foreach my $zone (@ARGV)
		{
			if(! sendcmd(ROLLCMD_SIGNZONE,$zone))
			{
				print STDERR "rollctl:  error sending command SIGNZONE($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "zone $zone signed\n";
			}
			else
			{
				print "unable to sign zone $zone:  \"$resp\"\n";
				$rcret++;
			}
		}
	}
	elsif($signzonesflag)
	{
		my $flag = shift @ARGV;

		if(($flag ne 'all') && ($flag ne 'active'))
		{
			print STDERR "rollctl:  -signzones must be given the \"all\" or \"active\" argument\n";
			exit(1);
		}

		if(! sendcmd(ROLLCMD_SIGNZONES,$flag))
		{
			print STDERR "rollctl:  error sending command SIGNZONES\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "all zones signed\n";
		}
		else
		{
			print "unable to sign all zones:  \"$resp\"\n";
			$rcret++;
		}
	}
	elsif($skipallflag)
	{
		if(! sendcmd(ROLLCMD_SKIPALL,$skipzoneflag))
		{
			print STDERR "rollctl:  error sending command SKIPALL\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollover stopped for all zones:  $resp\n";
		}
		else
		{
			print "$resp";
			$rcret++;
		}
	}
	elsif($skipzoneflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -skipzone missing zone argument\n";
			exit(2);
		}

		foreach my $zone (@ARGV)
		{
			if(! sendcmd(ROLLCMD_SKIPZONE,$zone))
			{
				print STDERR "rollctl:  error sending command SKIPZONE($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "rollover stopped for zone $zone\n";
			}
			else
			{
				print "unable to stop rollover for zone $zone:  \"$resp\"\n";
				$rcret++;
			}
		}
	}
	elsif($sleeptimeflag)
	{
		if(! sendcmd(ROLLCMD_SLEEPTIME,$sleeptimeflag))
		{
			print STDERR "rollctl:  error sending command SLEEPTIME\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd sleep time set to $sleeptimeflag\n";
		}
		else
		{
			print "sleep-time set failed:  \"$resp\"\n";
			$rcret++;
		}
	}
	elsif($splitrrfflag)
	{
		my $rrfs = join(':', @ARGV);

		if(! sendcmd(ROLLCMD_SPLITRRF,$rrfs))
		{
			print STDERR "rollctl:  error sending command SPLITRRF\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "rollerd split the rollrec file\n";
		}
		else
		{
			print "rollerd did not split the rollrec files\n";
			$rcret++;
		}
	}
	elsif($statusflag)
	{
		if(! sendcmd(ROLLCMD_STATUS))
		{
			print STDERR "rollctl:  error sending command ZONELOG\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "$resp";
		}
		else
		{
			print "status failed:  \"$resp\"\n";
			$rcret++;
		}
	}
	elsif($shutdownflag)
	{
		if($shutdownflag == 2)
		{
			my $pid = rollmgr_getid();
			if(kill("INT", $pid) < 1)
			{
				print STDERR "rollctl:  unable to send immediate SHUTDOWN\n";
				exit(1);
			}

			print "rollctl:  immediate SHUTDOWN notice sent to rollerd\n";
			exit(0);
		}

		if(! sendcmd(ROLLCMD_SHUTDOWN))
		{
			print STDERR "rollctl:  error sending command SHUTDOWN\n";
			exit(1);
		}
		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "$resp\n";
		}
		else
		{
			print "shutdown failed:  \"$resp\"\n";
			$rcret++;
		}
	}
	elsif(defined($zonegroupflag))
	{
		if(! sendcmd(ROLLCMD_ZONEGROUP,$zonegroupflag))
		{
			print STDERR "rollctl:  error sending command ZONEGROUP\n";
			exit(1);
		}
		($ret, $resp) = rollmgr_getresp($zonegroupflag);
		if($ret == ROLLCMD_RC_OKAY)
		{
			print "$resp\n";
		}
		else
		{
			print "$resp\n";
			$rcret++;
		}
	}
	elsif($zonelogflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "rollctl: -zonelog missing zone:loglevel argument\n";
			exit(2);
		}

		foreach my $zone (@ARGV)
		{
			if($zone !~ /.+\:.+/)
			{
				print STDERR "rollctl:  improperly formed zone:loglevel pair\n";
				next;
			}

			if(! sendcmd(ROLLCMD_ZONELOG,$zone))
			{
				print STDERR "rollctl:  error sending command ZONELOG($zone)\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "rollerd logging changed for $zone\n";
			}
			else
			{
				print "zonelog failed:  $resp\n";
				$rcret++;
			}
		}
	}
	elsif($zonestatflag)
	{
		if(! sendcmd(ROLLCMD_ZONESTATUS))
		{
			print STDERR "rollctl:  error sending command ZONESTATUS\n";
			exit(1);
		}

		($ret, $resp) = rollmgr_getresp();
		if($ret == ROLLCMD_RC_OKAY)
		{
			zonestatus("$resp");
		}
		else
		{
			print "zonestatus failed:  \"$resp\"\n";
			$rcret++;
		}
	}
	elsif($zsargsflag)
	{
		if(@ARGV == 0)
		{
			print STDERR "zoneargs failed:  arguments are required\n";
			exit(2);
		}
		else
		{
			my $zsargs;			# Zonesigner arguments.

			$zsargs = join ',', @ARGV;

			if(! sendcmd(ROLLCMD_ZSARGS,$zsargs))
			{
				print STDERR "rollctl:  error sending command ZSARGS\n";
				exit(1);
			}

			($ret, $resp) = rollmgr_getresp();
			if($ret == ROLLCMD_RC_OKAY)
			{
				print "$resp";
			}
			else
			{
				print "zsarg failed:  \"$resp\"\n";
				$rcret++;
			}
		}
	}

	return($rcret);
}

#-----------------------------------------------------------------------------
# Routine:	doopts()
#
# Purpose:	This routine shakes and bakes our command line options.
#		A bunch of option variables are set according to the specified
#		options.  Then a little massaging is done to make sure that
#		the proper actions are taken.  A few options imply others, so
#		the implied options are set if the implying options are given.
#
sub doopts
{
	my $argc = shift;			# Command line argument count.
	my $argcnt;				# Specified-argument count.

	#
	# Give a usage flag if there aren't any options.
	#
	usage() if($argc == 0);

	#
	# Parse the options.
	#
	GetOptions(\%options,@opts, verbose => 1) || usage();

	#
	# Give a usage flag if asked.
	#
	usage() if(defined($options{'help'}));

	#
	# Set our option variables based on the parsed options.
	#
	$quiet = $options{'quiet'} || 0;

	#
	# Command Options
	#

	if(exists($options{'display'}))
	{
		$dispflag = $options{'display'};
		$commandcount++;
	}
	if(exists($options{'dspub'}))
	{
		$dspubflag = $options{'dspub'};
		$commandcount++;
	}
	if(exists($options{'dspuball'}))
	{
		$dspuballflag = $options{'dspuball'};
		$commandcount++;
	}
	if(exists($options{'group'}))
	{
		$groupflag = $options{'group'};
	}
	if(exists($options{'logfile'}))
	{
		$logfileflag = $options{'logfile'};
		$commandcount++;
	}
	if(exists($options{'loglevel'}))
	{
		$loglevelflag = $options{'loglevel'};
		$commandcount++;
	}
	if(exists($options{'logtz'}))
	{
		$logtzflag = $options{'logtz'};
		$commandcount++;
	}
	if(exists($options{'mergerrfs'}))
	{
		$mergerrfsflag = 1;
		$commandcount++;
	}
	if(exists($options{'nodisplay'}))
	{
		$nodispflag = $options{'nodisplay'};
		$commandcount++;
	}
	if(exists($options{'phasemsg'}))
	{
		$logphasemsg = $options{'phasemsg'};
		$commandcount++;
	}
	if(exists($options{'pidfile'}))
	{
		$pidfile = $options{'pidfile'};
		rollmgr_set_idfile($pidfile) if($pidfile ne '');
	}
	if(exists($options{'queuelist'}))
	{
		$queuelistflag = $options{'queuelist'};
		$commandcount++;
	}
	if(exists($options{'queuestatus'}))
	{
		$queuestatusflag = $options{'queuestatus'};
		$commandcount++;
	}
	if(exists($options{'rollall'}))
	{
		$rollallflag = $options{'rollall'};
		$commandcount++;
	}
	if(exists($options{'rollallksks'}))
	{
		$krollallflag = $options{'rollallksks'};
		$commandcount++;
	}
	if(exists($options{'rollallzsks'}))
	{
		$zrollallflag = $options{'rollallzsks'};
		$commandcount++;
	}
	if(exists($options{'rollksk'}))
	{
		$rollkskflag = $options{'rollksk'};
		$commandcount++;
	}
	if(exists($options{'rollrec'}))
	{
		$rollrecflag = $options{'rollrec'};
		$commandcount++;
	}
	if(exists($options{'rollzone'}))
	{
		$rollzoneflag = $options{'rollzone'};
		$commandcount++;
	}
	if(exists($options{'rollzsk'}))
	{
		$rollzskflag = $options{'rollzsk'};
		$commandcount++;
	}
	if(exists($options{'runqueue'}))
	{
		$runqueueflag = $options{'runqueue'};
		$commandcount++;
	}
	if(exists($options{'shutdown'}) || exists($options{'halt'}))
	{
		$shutdownflag =	1;

		if(($options{'shutdown'} eq 'now') || ($options{'halt'} eq 'now'))
		{
			$shutdownflag = 2;
		}

		$commandcount++;
	}
	if(exists($options{'signzone'}))
	{
		$signzoneflag = $options{'signzone'};
		$commandcount++;
	}
	if(exists($options{'signzones'}))
	{
		$signzonesflag = $options{'signzones'};
		$commandcount++;
	}
	if(exists($options{'skipall'}))
	{
		$skipallflag = $options{'skipall'};
		$commandcount++;
	}
	if(exists($options{'skipzone'}))
	{
		$skipzoneflag = $options{'skipzone'};
		$commandcount++;
	}
	if(exists($options{'sleeptime'}))
	{
		$sleeptimeflag = $options{'sleeptime'};
		$commandcount++;
	}
	if(exists($options{'splitrrf'}))
	{
		$splitrrfflag = 1;
		$commandcount++;
	}
	if(exists($options{'status'}))
	{
		$statusflag = $options{'status'};
		$commandcount++;
	}
	if(exists($options{'zonegroup'}))
	{
		$zonegroupflag = $options{'zonegroup'};
		$commandcount++;
	}
	if(exists($options{'zonelog'}))
	{
		$zonelogflag = $options{'zonelog'};
		$commandcount++;
	}
	if(exists($options{'zonestatus'}))
	{
		$zonestatflag = $options{'zonestatus'};
		$commandcount++;
	}
	if(exists($options{'zsargs'}))
	{
		$zsargsflag = $options{'zsargs'};
		$commandcount++;
	}
	if(exists($options{'Version'}))
	{
		$version = $options{'Version'};
		$commandcount++;
	}

	#
	# Ensure that only one command argument was given.
	# We'll get rid of the non-command options before checking.
	#

	if($commandcount > 1)
	{
		print STDERR "only one command argument may be specified per execution\n";
		exit(3);
	}
	elsif($commandcount < 1)
	{
		print STDERR "a command argument must be specified\n";
		exit(3);
	}

	#
	# Close our output descriptors if the -quiet option was given.
	#
	if($quiet)
	{
		close(STDOUT);
		close(STDERR);
	}

	#
	# Show the version number if requested.
	#
	version() if($version);

	#
	# Show the logging levels if one wasn't specified.
	#
	if(defined($options{'loglevel'}) && ($options{'loglevel'} eq ''))
	{
		showloglevels();
	}

	#
	# Ensure that conflicting options weren't given.
	#
	if($dispflag && $nodispflag)
	{
		print STDERR "-display and -nodisplay are mutually exclusive\n";
		exit(1);
	}
}

#----------------------------------------------------------------------
# Routine:	zonestatus()
#
# Purpose:	Print the version number(s) and exit.
#
sub zonestatus
{
	my $resp = shift;			# Full response from rollerd.

	my @lines;				# Line-split responses.
	my @rnames = ();			# Rollrec names.
	my @znames = ();			# Zone names.
	my @states = ();			# Roll states.
	my @phases = ();			# Roll phases.

	my $rml = -1;				# Max. length of rollrec names.
	my $zml = -1;				# Max. length of zone names.

	#
	# Divide the pieces of the each response line into the data arrays.
	#
	@lines = split /\n/, $resp;
	foreach my $line (@lines)
	{
		my $len;
		my @slices = split /;/, $line;

		#
		# Save the atoms.
		#
		push @rnames, $slices[0];
		push @znames, $slices[1];
		push @states, $slices[2];
		push @phases, $slices[3];

		#
		# Save the length of the longest rollrec name.
		#
		$len = length($slices[0]);
		$rml = $len if($len > $rml);

		#
		# Save the length of the longest zone name.
		#
		$len = length($slices[1]);
		$zml = $len if($len > $zml);
	}

	#
	# Pretty-print the zone-status data from rollerd.
	#
	for(my $ind=0; $ind < @rnames; $ind++)
	{
		printf "%-$rml.*s    %-$zml.*s    $states[$ind]  $phases[$ind]\n",
			$rml, $rnames[$ind],
			$zml, $znames[$ind],
	}
}

#----------------------------------------------------------------------
# Routine:	sendcmd()
#
# Purpose:	Send the command to rollerd.  We'll also prepend the
#		group-command indicator if -group was given.
#
sub sendcmd
{
	my $cmd = shift;			# Command to send rollerd.
	my $arg = shift;			# Command's optional argument.
	my $ret;				# Return code.

	$cmd = ROLLMGR_GROUP . $cmd if($groupflag);

	$ret = rollmgr_sendcmd(CHANNEL_WAIT,$cmd,$arg);
	return($ret);
}


#----------------------------------------------------------------------
# Routine:	showloglevels()
#
# Purpose:	Print the logging levels and exit.
#
sub showloglevels
{
	my @levels = rolllog_levels();			# Valid logging levels.

	print "valid rollerd logging levels:\n";

	foreach my $level (@levels)
	{
		my $lnum;				# Numeric logging level.

		$lnum = rolllog_num($level);
		print "\t$level\t\t($lnum)\n";
	}

	exit(0);
}

#----------------------------------------------------------------------
# Routine:	version()
#
# Purpose:	Print the version number(s) and exit.
#
sub version
{
	print STDERR "$VERS\n";
	print STDERR "$DTVERS\n";

	exit(0);
}

#-----------------------------------------------------------------------------
# Routine:	usage()
#
sub usage
{
	print STDERR "usage:  rollctl [options] \n";
	print STDERR "\t-halt [now]		  shutdown rollerd\n";
	print STDERR "\t-display		  start graphical display\n";
	print STDERR "\t-dspub <zone>		  parent has published DS record for zone\n";
	print STDERR "\t-dspuball		  parents have published DS records for zones\n";
	print STDERR "\t-group			  apply command to zone group\n";
	print STDERR "\t-logfile <logfile>	  set log file\n";
	print STDERR "\t-loglevel <loglevel>	  set logging level\n";
	print STDERR "\t-logtz <log-timezone>	  set logging timezone\n";
	print STDERR "\t-phasemsg <length>	  set phase-message length\n";
	print STDERR "\t-pidfile <pidfile>	  set rollerd's process-id file\n";
	print STDERR "\t-nodisplay		  stop graphical display\n";
	print STDERR "\t-rollall		  restart all suspended zones\n";
	print STDERR "\t-rollallzsks		  roll all zones\n";
	print STDERR "\t-rollksk <zone>		  roll specified zone's KSK\n";
	print STDERR "\t-rollzone <zone>	  restart named suspended zone\n";
	print STDERR "\t-rollzsk <zone>		  roll named zone\n";
	print STDERR "\t-rollrec <rollrec>	  set rollrec file\n";
	print STDERR "\t-runqueue		  run queue\n";
	print STDERR "\t-shutdown [now]		  shutdown rollerd\n";
	print STDERR "\t-signzone <zone>	  sign named zone (no key rollover)\n";
	print STDERR "\t-signzones [all | active] sign zones (no key rollover)\n";
	print STDERR "\t-skipall		  skip all zones\n";
	print STDERR "\t-skipzone <zone>	  skip named zone\n";
	print STDERR "\t-splitrrf <rrf entries>	  split the current rollrec file\n";
	print STDERR "\t-sleeptime <seconds>	  set sleep time (in seconds)\n";
	print STDERR "\t-status			  get rollerd's status\n";
	print STDERR "\t-zonegroup [zonegroup]	  show zone groups\n";
	print STDERR "\t-zonelog		  set a zone's log level\n";
	print STDERR "\t-zonestatus		  get status of zones\n";
	print STDERR "\t-zsargs	<args> <zone>	  set zonesigner arguments for zones\n";
	print STDERR "\t-Version		  display version number\n";
	print STDERR "\t-quiet			  don't give any output\n";
	print STDERR "\t-help			  help message \n";
	exit(0);
}

1;

##############################################################################
#

=pod

=head1 NAME

rollctl - Send commands to the DNSSEC-Tools rollover daemon

=head1 SYNOPSIS

  rollctl [options]

=head1 DESCRIPTION

The B<rollctl> command sends commands to the DNSSEC-Tools rollover daemon,
B<rollerd>.  Only one option may be specified on a command line.

In most cases, B<rollerd> will send a response to B<rollctl>.  B<rollctl> will
print a success or failure message, as appropriate.

If B<rollctl> is run as a PAR-packed command, it will use its own local copy
of the B<dnssec-tools.conf> file.  This file will be found in the package
directory.

=head1 OPTIONS

The following options are handled by B<rollctl>.

=over 4

=item B<-display>

Starts the rollover status GUI.

=item B<-dspub zone>

Indicates that I<zone>'s parent has published a new DS record for I<zone>.

Multiple zones can be specified on the command line.
For instance, this command will send the I<dspub> command to B<rollerd>
for three zones.

    $ rollctl -dspub example1.com example2.com example3.com

=item B<-dspuball>

Indicates that DS records have been published for all zones in phase 6 of
KSK rollover.

=item B<-group>

Indicates that the specified command should apply to a zone group instead of
a zone.  Consequently, the specified zone must actually be a zone group.
This option must be used in conjunction with another command.

This option only applies to the following commands: B<-dspub>, B<-rollksk>, 
B<-rollzone>, B<-rollzsk>, and B<-skipzone>.  This command will have no
effect if it is given to other other commands.

=item B<-halt> [now]

Cleanly halts B<rollerd> execution.  If the optional I<now> parameter is
given, then B<rollerd> will be halted immediately, rather than allowing it to
complete its currently queued operations.

=item B<-logfile logfile>

Sets the B<rollerd> log file to I<logfile>.
This must be a valid logging file, meaning that if I<logfile> already
exists, it must be a regular file.  The only exceptions to this are if
I<logfile> is B</dev/stdout> or B</dev/tty>.

=item B<-loglevel loglevel>

Sets the B<rollerd> logging level to I<loglevel>.
This must be one of the valid logging levels defined in B<rollmgr.pm(3)>.

If a logging level is not specified, then the list of valid levels will be
printed and B<rollctl> will exit.  The list is given in both text and numeric
forms.

=item B<-logtz logtz>

Sets the B<rollerd> logging timezone to I<loglevel>.  This must be either
I<gmt> (for Greenwich Mean Time or I<local> (for the host's local time.)

=item B<-mergerrfs rollrec0 ... rollrecN>

Tells B<rollerd> to merge the specified I<rollrec> files with its active
I<rollrec> file.  The names of the I<rollrec> files must not contain colons.

=item B<-nodisplay>

Stops the rollover status GUI.

=item B<-phasemsg length>

B<length> is the default length of phase-related log messages used by
B<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".

=item B<-rollall>

Resumes rollover for all zones in the current I<rollrec> file that have been
suspended.  ("skip" zones are suspended.)

=item B<-rollallksks>

Initiates KSK rollover for all the zones defined in the current I<rollrec>
file that aren't currently in rollover.

=item B<-rollallzsks>

Initiates ZSK rollover for all the zones defined in the current I<rollrec>
file that aren't currently in rollover.

=item B<-rollksk zone>

Initiates KSK rollover for the zone named by I<zone>.

Multiple zones can be specified on the command line.
For instance, this command will send the I<rollksk> command to B<rollerd>
for three zones.

    $ rollctl -rollksk example1.com example2.com example3.com

=item B<-rollrec rollrec_file>

Sets the I<rollrec> file to be processed by B<rollerd> to I<rollrec_file>.

=item B<-rollzone zone>

Resumes rollover for the suspended zone named by I<zone>.

Multiple zones can be specified on the command line.
For instance, this command will send the I<rollzone> command to B<rollerd>
for three zones.

    $ rollctl -rollzone example1.com example2.com example3.com

=item B<-rollzsk zone>

Initiates rollover for the zone named by I<zone>.

Multiple zones can be specified on the command line.
For instance, this command will send the I<rollzsk> command to B<rollerd>
for three zones.

    $ rollctl -rollzsk example1.com example2.com example3.com

=item B<-runqueue>

Wakes up B<rollerd> and has it run its queue of I<rollrec> entries.

=item B<-shutdown>

Synonym for B<-halt>.

=item B<-signzone zone>

Signs I<zone>'s zonefile without performing any rollover actions.  The zone
is signed with the keys most recently used to sign the zone.  No new keys
will be generated.

=item B<-signzones [all | active]>

Signs the zonefiles of zones managed by B<rollerd>, without performing any
rollover actions.  If the B<all> option is given, then all of B<rollerd>'s
zones will be signed.  If the B<active> option is given, then only those zones
which aren't in the I<skip> stage will be signed.  The zones are signed with
the keys most recently used to sign each zone.  No new keys will be generated.

=item B<-skipall>

Suspends rollover for all zones in the current I<rollrec> file.

=item B<-skipzone zone>

Suspends rollover for the zone named by I<zone>.

Multiple zones can be specified on the command line.
For instance, this command will send the I<skipzone> command to B<rollerd>
for three zones.

    $ rollctl -skipzone example1.com example2.com example3.com

=item B<-sleeptime seconds>

Sets B<rollerd>'s sleep time to I<seconds> seconds.  I<sleeptime> must be an
integer at least as large as the B<$MIN_SLEEP> value in B<rollerd>.

=item B<-splitrrf new-rrf zone0 ... zoneN>

Tells B<rollerd> to move a set of I<rollrec> entries from the current
I<rollrec> file into a new file.  The new file is named in the I<new-rrf>
parameter.  The I<rollrec> entries whose names correspond to the I<zone0> to
I<zoneN> list are moved to the new file.  The name of the new I<rollrec> file
and the zone names must not contain colons.

=item B<-status>

Has B<rollerd> write several of its operational parameters to its log file.
The parameters are also reported to B<rollctl>, which prints them to the
screen.

=item B<-zonegroup> I<[zone-group]>

Requests information about zone groups from B<rollerd>.  If the optional
I<zone-group> argument is not given, then B<rollerd> will return a list of
the defined zone groups and the number of zones in each.  If a I<zone-group>
is specified, then B<rollerd> will return a list of the zones in that group.

(While this is using the term "zone", it is actually referring to the name
of the I<rollrec> entries.  For a particular I<rollrec> entry, the I<rollrec>
name is usually the same as the zone name, but this is not a requirement.)

=item B<-zonelog>

Set the logging level for the specified zone.  The new logging level is only
for the current execution of B<rollerd> and is not saved to the active
I<rollrec> file.

The arguments for this command must be in the format "zone:loglevel".
For example, this command will send the I<zonelog> command to B<rollerd>
for three zones.

    $ rollctl -zonelog example1.com:info example2.com:6 example3.com:err

=item B<-zonestatus>

Has B<rollerd> write the status of zones in the current I<rollrec> file to the
B<rollerd> log file.  The status is also reported to B<rollctl>, which prints
it to the screen.  B<rollctl> prints it in columnar fashion to enhance
readability.  The columns, in order, are:  rollrec name, zone name, roll/skip
state, and rollover phase.

Example:
    anothersub                      anothersub.example.com  skip  KSK 1
    example.com                     example.com             roll  KSK 1
    site1.in.subzone.example.com    subzone.example.com     roll  KSK 3
    site1.subzone.example.com       subzone.example.com     roll  KSK 3

=item B<-zsargs arglist zones>

Provides additional B<zonesigner> arguments for a given set of zones.  These
arguments will override the arguments in the DNSSEC-Tools defaults file, the
DNSSEC-Tools configuration file, and the zones' I<keyrec> files.

The B<zonesigner> argument list is given in I<arglist>.  Given the B<rollctl>
argument processing, the new arguments for B<zonesigner> cannot be specified
as expected.  Instead, the arguments should be given in the following manner.
The leading dash should be replaced with an equals sign.  If the option takes
an argument, the space that would separate the option from the option's
argument should also be replaced by an equals sign.  B<rollerd> translates
these arguments to the appropriate format for B<zonesigner>.  These examples
should clarify the modifications:

    normal zonesigner option		-zsargs options
    ------------------------		---------------
	-nokrfile			   =nokrfile
	-zskcount 5			   =zskcount=5

The I<zones> list is a space-separated list of zones.  B<All> the new
B<zonesigner> arguments will be applied to B<all> the listed zones.

The "=clear" argument is special.  B<rollerd> translates it to "-clear",
which is not a normal B<zonesigner> option.  Instead, B<rollerd> recognizes
"-clear" as an indicator that it should remove the I<zsargs> field from the
I<rollrec> records for the specified zones.

The following are valid uses of B<-zsargs>:

    # rollctl -zsargs =ksklength=2048 example.com
    # rollctl -zsargs =ksklen=2048 =zsklen=2048 example.com test.com

=item B<-Version>

Displays the version information for B<rollctl> and the DNSSEC-Tools package.

=item B<-quiet>

Prevents output from being given.  Both error and non-error output is
stopped.

=item B<-help>

Displays a usage message.

=back

=head1 EXIT CODES

B<rollctl> may give the following exit codes:

=over 4

=item 0 - Successful execution

=item 1 - Error sending the command to B<rollerd>.

=item 2 - Missing argument.

=item 3 - Too many commands specified.

=item 200 - Rollerd is not running.

=item 201 - Configuration file checks failed.

=back

=head1 FUTURE

The following modifications may be made in the future:

=over 4

=item command execution order

The commands will be executed in the order given on the command line rather
than in alphabetical order.

=back

=head1 COPYRIGHT

Copyright 2006-2012 SPARTA, Inc.  All rights reserved.
See the COPYING file included with the DNSSEC-Tools package for details.

=head1 AUTHOR

Wayne Morrison, tewok@tislabs.com

=head1 SEE ALSO

B<Net::DNS::SEC::Tools::rollmgr.pm(3)>,
B<Net::DNS::SEC::Tools::rollrec.pm(3)>

B<rollerd(8)>

=cut