928
928
cerr<<" Usage: \n pdnssec [options] <command> [params ..]\n\n " ;
929
929
cerr<<" Commands:\n " ;
930
930
cerr<<" activate-zone-key ZONE KEY-ID Activate the key with key id KEY-ID in ZONE\n " ;
931
- cerr<<" add-zone-key ZONE zsk|ksk [bits]\n " ;
931
+ cerr<<" add-zone-key ZONE zsk|ksk [bits] [active|passive] \n " ;
932
932
cerr<<" [rsasha1|rsasha256|rsasha512|gost|ecdsa256|ecdsa384]\n " ;
933
933
cerr<<" Add a ZSK or KSK to zone and specify algo&bits\n " ;
934
934
cerr<<" check-zone ZONE Check a zone for correctness\n " ;
943
943
cerr<<" hash-zone-record ZONE RNAME Calculate the NSEC3 hash for RNAME in ZONE\n " ;
944
944
cerr<<" increase-serial ZONE Increases the SOA-serial by 1. Uses SOA-EDIT\n " ;
945
945
cerr<<" import-zone-key ZONE FILE Import from a file a private key, ZSK or KSK\n " ;
946
- cerr<<" [ ksk|zsk] Defaults to KSK\n " ;
946
+ cerr<<" [active|passive][ ksk|zsk] Defaults to KSK and active \n " ;
947
947
cerr<<" rectify-zone ZONE [ZONE ..] Fix up DNSSEC fields (order, auth)\n " ;
948
948
cerr<<" rectify-all-zones Rectify all zones.\n " ;
949
949
cerr<<" remove-zone-key ZONE KEY-ID Remove key with KEY-ID from ZONE\n " ;
@@ -1131,24 +1131,29 @@ try
1131
1131
int tmp_algo=0 ;
1132
1132
int bits=0 ;
1133
1133
int algorithm=8 ;
1134
+ bool active=false ;
1134
1135
for (unsigned int n=2 ; n < cmds.size (); ++n) {
1135
1136
if (pdns_iequals (cmds[n], " zsk" ))
1136
1137
keyOrZone = false ;
1137
1138
else if (pdns_iequals (cmds[n], " ksk" ))
1138
1139
keyOrZone = true ;
1139
1140
else if ((tmp_algo = shorthand2algorithm (cmds[n]))>0 ) {
1140
1141
algorithm = tmp_algo;
1141
- } else if (atoi (cmds[n].c_str ()))
1142
+ } else if (pdns_iequals (cmds[n], " active" )) {
1143
+ active=true ;
1144
+ } else if (pdns_iequals (cmds[n], " inactive" ) || pdns_iequals (cmds[n], " passive" )) {
1145
+ active=false ;
1146
+ } else if (atoi (cmds[n].c_str ())) {
1142
1147
bits = atoi (cmds[n].c_str ());
1143
- else {
1148
+ } else {
1144
1149
cerr<<" Unknown algorithm, key flag or size '" <<cmds[n]<<" '" <<endl;
1145
1150
return 0 ;
1146
1151
}
1147
1152
}
1148
- cerr<<" Adding a " << (keyOrZone ? " KSK" : " ZSK" )<<" with algorithm = " <<algorithm<<endl;
1153
+ cerr<<" Adding a " << (keyOrZone ? " KSK" : " ZSK" )<<" with algorithm = " <<algorithm<<" , active= " <<active<< endl;
1149
1154
if (bits)
1150
1155
cerr<<" Requesting specific key size of " <<bits<<" bits" <<endl;
1151
- dk.addKey (zone, keyOrZone, algorithm, bits, false );
1156
+ dk.addKey (zone, keyOrZone, algorithm, bits, active );
1152
1157
}
1153
1158
else if (cmds[0 ] == " remove-zone-key" ) {
1154
1159
if (cmds.size () < 3 ) {
@@ -1272,7 +1277,7 @@ try
1272
1277
}
1273
1278
else if (cmds[0 ]==" import-zone-key-pem" ) {
1274
1279
if (cmds.size () < 4 ) {
1275
- cerr<<" Syntax: pdnssec import-zone-key ZONE FILE algorithm [ksk|zsk]" <<endl;
1280
+ cerr<<" Syntax: pdnssec import-zone-key-pem ZONE FILE algorithm [ksk|zsk]" <<endl;
1276
1281
exit (1 );
1277
1282
}
1278
1283
string zone=cmds[1 ];
@@ -1317,7 +1322,7 @@ try
1317
1322
}
1318
1323
else if (cmds[0 ]==" import-zone-key" ) {
1319
1324
if (cmds.size () < 3 ) {
1320
- cerr<<" Syntax: pdnssec import-zone-key ZONE FILE [ksk|zsk]" <<endl;
1325
+ cerr<<" Syntax: pdnssec import-zone-key ZONE FILE [ksk|zsk] [active|passive] " <<endl;
1321
1326
exit (1 );
1322
1327
}
1323
1328
string zone=cmds[1 ];
@@ -1330,23 +1335,25 @@ try
1330
1335
1331
1336
if (dpk.d_algorithm == 7 )
1332
1337
dpk.d_algorithm = 5 ;
1333
-
1334
- cerr<<(int )dpk.d_algorithm <<endl;
1335
1338
1336
- if (cmds.size () > 3 ) {
1337
- if (pdns_iequals (cmds[3 ], " ZSK" ))
1338
- dpk.d_flags = 256 ;
1339
- else if (pdns_iequals (cmds[3 ], " KSK" ))
1340
- dpk.d_flags = 257 ;
1341
- else {
1342
- cerr<<" Unknown key flag '" <<cmds[3 ]<<" '\n " ;
1343
- exit (1 );
1344
- }
1339
+ dpk.d_flags = 257 ;
1340
+ bool active=false ;
1341
+
1342
+ for (unsigned int n = 3 ; n < cmds.size (); ++n) {
1343
+ if (pdns_iequals (cmds[n], " ZSK" ))
1344
+ dpk.d_flags = 256 ;
1345
+ else if (pdns_iequals (cmds[n], " KSK" ))
1346
+ dpk.d_flags = 257 ;
1347
+ else if (pdns_iequals (cmds[n], " active" ))
1348
+ active = 1 ;
1349
+ else if (pdns_iequals (cmds[n], " passive" ) || pdns_iequals (cmds[n], " inactive" ))
1350
+ active = 0 ;
1351
+ else {
1352
+ cerr<<" Unknown key flag '" <<cmds[n]<<" '\n " ;
1353
+ exit (1 );
1354
+ }
1345
1355
}
1346
- else
1347
- dpk.d_flags = 257 ;
1348
-
1349
- dk.addKey (zone, dpk);
1356
+ dk.addKey (zone, dpk, active);
1350
1357
}
1351
1358
else if (cmds[0 ]==" export-zone-dnskey" ) {
1352
1359
if (cmds.size () < 3 ) {
0 commit comments