Changeset 2221
- Timestamp:
- 06/29/11 10:12:52 (2 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/pdnssec.cc (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdnssec.cc
r2216 r2221 349 349 BOOST_FOREACH(DNSSECKeeper::keyset_t::value_type value, keyset) { 350 350 dk.deactivateKey(zone, value.second.id); 351 dk.removeKey(zone, value.second.id); 351 352 } 352 353 } … … 464 465 cerr<<"Usage: \npdnssec [options] [show-zone] [secure-zone] [rectify-zone] [add-zone-key] [deactivate-zone-key] [remove-zone-key] [activate-zone-key]\n"; 465 466 cerr<<" [import-zone-key] [export-zone-key] [set-nsec3] [set-presigned] [unset-nsec3] [unset-presigned] [export-zone-dnskey]\n\n"; 466 cerr<<"activate-zone-key ZONE KEY-ID Activate the key with key id KEY-ID in ZONE\n";467 cerr<<"add-zone-key ZONE [zsk|ksk] Add a ZSK or KSK to a zone\n";468 cerr<<" [bits] [rsasha1|rsasha256] and specify algorithm & bits\n";469 cerr<<"check-zone ZONE Check a zone for correctness\n";470 cerr<<"deactivate-zone-key Dectivate the key with key id KEY-ID in ZONE\n";471 cerr<<"disable-dnssec ZONE Deactivate all keys and unset PRESIGNED\n";472 cerr<<"export-zone-dnskey ZONE KEY-ID Export to stdout the public DNSKEY described\n";473 cerr<<"export-zone-key ZONE KEY-ID Export to stdout the private key described\n";474 cerr<<"hash-zone-record ZONE RNAME Calculate the NSEC3 hash for RNAME in ZONE\n";475 cerr<<"import-zone-key ZONE FILE Import from a file a private key, ZSK or KSK\n";476 cerr<<" [ksk|zsk] Defaults to KSK\n";477 cerr<<"rectify-zone ZONE Fix up DNSSEC fields (order, auth)\n";478 cerr<<"remove-zone-key ZONE KEY-ID Remove key with KEY-ID from ZONE\n";479 cerr<<"secure-zone ZONE Add KSK and two ZSKs\n";480 cerr<<"set-nsec3 ZONE 'params' [narrow] Enable NSEC3 with PARAMs. Optionally narrow\n";481 cerr<<"set-presigned ZONE Use presigned RRSIGs from storage\n";482 cerr<<"show-zone ZONE Show DNSSEC (public) key details about a zone\n";483 cerr<<"unset-nsec3 ZONE Switch back to NSEC\n";484 cerr<<"unset-presigned ZONE No longer use presigned RRSIGs\n\n";467 cerr<<"activate-zone-key ZONE KEY-ID Activate the key with key id KEY-ID in ZONE\n"; 468 cerr<<"add-zone-key ZONE [zsk|ksk] Add a ZSK or KSK to a zone\n"; 469 cerr<<" [bits] [rsasha1|rsasha256] and specify algorithm & bits\n"; 470 cerr<<"check-zone ZONE Check a zone for correctness\n"; 471 cerr<<"deactivate-zone-key ZONE KEY-ID Deactivate the key with key id KEY-ID in ZONE\n"; 472 cerr<<"disable-dnssec ZONE Deactivate all keys and unset PRESIGNED in ZONE\n"; 473 cerr<<"export-zone-dnskey ZONE KEY-ID Export to stdout the public DNSKEY described\n"; 474 cerr<<"export-zone-key ZONE KEY-ID Export to stdout the private key described\n"; 475 cerr<<"hash-zone-record ZONE RNAME Calculate the NSEC3 hash for RNAME in ZONE\n"; 476 cerr<<"import-zone-key ZONE FILE Import from a file a private key, ZSK or KSK\n"; 477 cerr<<" [ksk|zsk] Defaults to KSK\n"; 478 cerr<<"rectify-zone ZONE Fix up DNSSEC fields (order, auth)\n"; 479 cerr<<"remove-zone-key ZONE KEY-ID Remove key with KEY-ID from ZONE\n"; 480 cerr<<"secure-zone ZONE Add KSK and two ZSKs\n"; 481 cerr<<"set-nsec3 ZONE 'params' [narrow] Enable NSEC3 with PARAMs. Optionally narrow\n"; 482 cerr<<"set-presigned ZONE Use presigned RRSIGs from storage\n"; 483 cerr<<"show-zone ZONE Show DNSSEC (public) key details about a zone\n"; 484 cerr<<"unset-nsec3 ZONE Switch back to NSEC\n"; 485 cerr<<"unset-presigned ZONE No longer use presigned RRSIGs\n\n"; 485 486 cerr<<"Options:"<<endl; 486 487 cerr<<desc<<endl; … … 497 498 DNSSECKeeper dk; 498 499 499 if(cmds[0] == "rectify-zone" || cmds[0] == "order-zone") {500 if(cmds[0] == "rectify-zone") { 500 501 if(cmds.size() != 2) { 501 cerr << " Error: "<<cmds[0]<<" takes exactly 1 parameter"<<endl;502 cerr << "Syntax: pdnssec rectify-zone ZONE"<<endl; 502 503 return 0; 503 504 } … … 506 507 else if(cmds[0] == "check-zone") { 507 508 if(cmds.size() != 2) { 508 cerr << " Error: "<<cmds[0]<<" takes exactly 1 parameter"<<endl;509 cerr << "Syntax: pdnssec check-zone ZONE"<<endl; 509 510 return 0; 510 511 } … … 522 523 #endif 523 524 else if(cmds[0] == "test-speed") { 524 if(cmds.size() < 3) {525 cerr << " Error: "<<cmds[0]<<" takes 2 or 3 parameters, zonenumcores [signing-server]"<<endl;525 if(cmds.size() < 2) { 526 cerr << "Syntax: pdnssec test-speed numcores [signing-server]"<<endl; 526 527 return 0; 527 528 } … … 530 531 else if(cmds[0] == "verify-crypto") { 531 532 if(cmds.size() != 2) { 532 cerr << " Error: "<<cmds[0]<<" takes exactly 1 parameter"<<endl;533 cerr << "Syntax: pdnssec verify-crypto FILE"<<endl; 533 534 return 0; 534 535 } … … 538 539 else if(cmds[0] == "show-zone") { 539 540 if(cmds.size() != 2) { 540 cerr << " Error: "<<cmds[0]<<" takes exactly 1 parameter"<<endl;541 cerr << "Syntax: pdnssec show-zone ZONE"<<endl; 541 542 return 0; 542 543 } … … 546 547 else if(cmds[0] == "disable-dnssec") { 547 548 if(cmds.size() != 2) { 548 cerr << " Error: "<<cmds[0]<<" takes exactly 1 parameter"<<endl;549 cerr << "Syntax: pdnssec disable-dnssec ZONE"<<endl; 549 550 return 0; 550 551 } … … 553 554 } 554 555 else if(cmds[0] == "activate-zone-key") { 556 if(cmds.size() != 3) { 557 cerr << "Syntax: pdnssec activate-zone-key ZONE KEY-ID"<<endl; 558 return 0; 559 } 555 560 const string& zone=cmds[1]; 556 561 unsigned int id=atoi(cmds[2].c_str()); … … 558 563 } 559 564 else if(cmds[0] == "deactivate-zone-key") { 565 if(cmds.size() != 3) { 566 cerr << "Syntax: pdnssec deactivate-zone-key ZONE KEY-ID"<<endl; 567 return 0; 568 } 560 569 const string& zone=cmds[1]; 561 570 unsigned int id=atoi(cmds[2].c_str()); … … 563 572 } 564 573 else if(cmds[0] == "add-zone-key") { 574 if(cmds.size() < 3 ) { 575 cerr << "Syntax: pdnssec add-zone-key ZONE [zsk|ksk] [bits] [rsasha1|rsasha256]"<<endl; 576 return 0; 577 } 565 578 const string& zone=cmds[1]; 566 579 // need to get algorithm, bits & ksk or zsk from commandline … … 595 608 if(bits) 596 609 cerr<<"Requesting specific key size of "<<bits<<" bits"<<endl; 597 dk.addKey(zone, keyOrZone, algorithm, bits );610 dk.addKey(zone, keyOrZone, algorithm, bits, false); 598 611 } 599 612 else if(cmds[0] == "remove-zone-key") { 600 613 if(cmds.size() < 3) { 601 cerr<<"Syntax: pdnssec remove-zone-key ZONE KEY-ID \n";614 cerr<<"Syntax: pdnssec remove-zone-key ZONE KEY-ID"; 602 615 return 0; 603 616 } … … 609 622 else if(cmds[0] == "secure-zone") { 610 623 if(cmds.size() < 2) { 611 cerr << " Error: "<<cmds[0]<<" takes at least 1 parameter"<<endl;624 cerr << "Syntax: pdnssec secure-zone ZONE"<<endl; 612 625 return 0; 613 626 } … … 626 639 } 627 640 else if(cmds[0]=="set-nsec3") { 641 if(cmds.size() < 2) { 642 cerr<<"Syntax: pdnssec set-nsec3 ZONE 'params' [narrow]"<<endl; 643 return 0; 644 } 628 645 string nsec3params = cmds.size() > 2 ? cmds[2] : "1 1 1 ab"; 629 646 bool narrow = cmds.size() > 3 && cmds[3]=="narrow"; … … 638 655 else if(cmds[0]=="set-presigned") { 639 656 if(cmds.size() < 2) { 640 cerr<<"Wrong number of arguments, syntax: set-presigned DOMAIN"<<endl; 657 cerr<<"Syntax: pdnssec set-presigned ZONE"<<endl; 658 return 0; 641 659 } 642 660 dk.setPresigned(cmds[1]); 643 661 } 644 662 else if(cmds[0]=="unset-presigned") { 645 if(cmds.size() < 2) { 646 cerr<<"Wrong number of arguments, syntax: unset-presigned DOMAIN"<<endl; 647 } 663 if(cmds.size() < 2) { 664 cerr<<"Syntax: pdnssec unset-presigned ZONE"<<endl; 665 return 0; 666 } 648 667 dk.unsetPresigned(cmds[1]); 649 668 } 650 669 else if(cmds[0]=="hash-zone-record") { 651 670 if(cmds.size() < 3) { 652 cerr<<" Wrong number of arguments, syntax: hash-zone-record ZONE RECORD"<<endl;671 cerr<<"Syntax: pdnssec hash-zone-record ZONE RNAME"<<endl; 653 672 return 0; 654 673 } … … 668 687 } 669 688 else if(cmds[0]=="unset-nsec3") { 689 if(cmds.size() < 2) { 690 cerr<<"Syntax: pdnssec unset-nsec3 ZONE"<<endl; 691 exit(1); 692 } 670 693 dk.unsetNSEC3PARAM(cmds[1]); 671 694 } 672 695 else if(cmds[0]=="export-zone-key") { 673 696 if(cmds.size() < 3) { 674 cerr<<"Syntax: pdnssec export-zone-key zone-name id"<<endl; 675 cerr<<cmds.size()<<endl; 697 cerr<<"Syntax: pdnssec export-zone-key ZONE KEY-ID"<<endl; 676 698 exit(1); 677 699 } … … 684 706 else if(cmds[0]=="import-zone-key-pem") { 685 707 if(cmds.size() < 4) { 686 cerr<<"Syntax: pdnssec import-zone-key zone-name filename.pemalgorithm [zsk|ksk]"<<endl;708 cerr<<"Syntax: pdnssec import-zone-key ZONE FILE algorithm [zsk|ksk]"<<endl; 687 709 exit(1); 688 710 } … … 728 750 } 729 751 else if(cmds[0]=="import-zone-key") { 730 if(cmds.size() < 3) {731 cerr<<"Syntax: pdnssec import-zone-key zone-name filename[zsk|ksk]"<<endl;752 if(cmds.size() < 4) { 753 cerr<<"Syntax: pdnssec import-zone-key ZONE FILE [zsk|ksk]"<<endl; 732 754 exit(1); 733 755 } … … 762 784 else if(cmds[0]=="export-zone-dnskey") { 763 785 if(cmds.size() < 3) { 764 cerr<<"Syntax: pdnssec export-zone-dnskey zone-name id"<<endl;786 cerr<<"Syntax: pdnssec export-zone-dnskey ZONE KEY-ID"<<endl; 765 787 exit(1); 766 788 }