From: Jonas Wielicki Date: Thu, 16 Jun 2016 12:19:04 +0000 (+0200) Subject: Implement subcommand printing all KSK DS records in pdnsutil X-Git-Tag: dnsdist-1.1.0-beta2~26^2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84dc0cd2fa1fd2b8f6e001780a5e38bc159a38b9;p=thirdparty%2Fpdns.git Implement subcommand printing all KSK DS records in pdnsutil The subcommands prints all KSK DS records of the given zone to stdout. Diagnostics are exclusively printed to stderr, and if the zone is not secured this is fatal. --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 6b9a050ce0..6ab74bd8b4 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -1517,87 +1517,102 @@ int setZoneKind(const DNSName& zone, const DomainInfo::DomainKind kind) return EXIT_SUCCESS; } -bool showZone(DNSSECKeeper& dk, const DNSName& zone) +bool showZone(DNSSECKeeper& dk, const DNSName& zone, bool exportDS = false) { UeberBackend B("default"); DomainInfo di; - std::vector meta; if (!B.getDomainInfo(zone, di)){ cerr << "No such zone in the database" << endl; return false; } - cout<<"This is a "< 0) { - cout << "Zone has following allowed TSIG key(s): " << boost::join(meta, ",") << endl; - } - meta.clear(); - if (B.getDomainMetadata(zone, "AXFR-MASTER-TSIG", meta) && meta.size() > 0) { - cout << "Zone uses following TSIG key(s): " << boost::join(meta, ",") << endl; - } - - std::map > metamap; - if(B.getAllDomainMetadata(zone, metamap)) { - cout<<"Metadata items: "; - if(metamap.empty()) - cout<<"None"; - cout< meta; + + if (B.getDomainMetadata(zone, "TSIG-ALLOW-AXFR", meta) && meta.size() > 0) { + cout << "Zone has following allowed TSIG key(s): " << boost::join(meta, ",") << endl; + } + + meta.clear(); + if (B.getDomainMetadata(zone, "AXFR-MASTER-TSIG", meta) && meta.size() > 0) { + cout << "Zone uses following TSIG key(s): " << boost::join(meta, ",") << endl; + } + + std::map > metamap; + if(B.getAllDomainMetadata(zone, metamap)) { + cout<<"Metadata items: "; + if(metamap.empty()) + cout<<"None"; + cout< keys; DNSResourceRecord rr; @@ -1613,11 +1628,14 @@ bool showZone(DNSSECKeeper& dk, const DNSName& zone) return true; } - if(!haveNSEC3) - cout<<"Zone has NSEC semantics"<getBits(); } catch(std::exception& e) { - cout<<"Could not process key to extract metadata: "<getBits() < 1) { - cout<<" " <" <()); } if (!showZone(dk, DNSName(cmds[1]))) return 1; } + else if(cmds[0] == "export-zone-ds") { + if(cmds.size() != 2) { + cerr << "Syntax: pdnsutil export-zone-ds ZONE"<