From e242fa6542b3eb66e00593921ba0fd69a6811fcb Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Sat, 19 Jun 2010 12:13:14 +0000 Subject: [PATCH] fix up algorithm 5 and 7 confusion, make sure that basis comparisons against BIND again give identical answers. git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1645 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/dnsseckeeper.cc | 29 +++++++++++++++-------------- pdns/dnsseckeeper.hh | 4 ++-- pdns/pdnssec.cc | 40 ++++++++++++++++++++-------------------- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/pdns/dnsseckeeper.cc b/pdns/dnsseckeeper.cc index 996767047..7bfe76b72 100644 --- a/pdns/dnsseckeeper.cc +++ b/pdns/dnsseckeeper.cc @@ -78,6 +78,14 @@ bool DNSSECKeeper::haveKSKFor(const std::string& zone, DNSSECPrivateKey* dpk) if(dpk) { getRSAKeyFromISC(&dpk->d_key.getContext(), dir_itr->path().file_string().c_str()); + + if(getNSEC3PARAM(zone)) { + dpk->d_algorithm = 7; + } + else { + dpk->d_algorithm = 5; + } + } return true; } @@ -86,7 +94,7 @@ bool DNSSECKeeper::haveKSKFor(const std::string& zone, DNSSECPrivateKey* dpk) return false; } -void DNSSECKeeper::addZSKFor(const std::string& name, bool next) +void DNSSECKeeper::addZSKFor(const std::string& name, int algorithm, bool next) { DNSSECPrivateKey dpk; dpk.d_key.create(1024); // for testing, 1024 @@ -94,7 +102,7 @@ void DNSSECKeeper::addZSKFor(const std::string& name, bool next) string isc = dpk.d_key.convertToISC(); DNSKEYRecordContent drc = dpk.getDNSKEY(); drc.d_flags = 256; // KSK - + drc.d_algorithm = algorithm; string iscName=d_dirname+"/"+name+"/zsks/"; time_t inception=getCurrentInception(); time_t end=inception+14*86400; @@ -125,7 +133,7 @@ void DNSSECKeeper::addZSKFor(const std::string& name, bool next) { ofstream dnskeyFile((iscName+".dnskey").c_str()); - dnskeyFile << name << " IN DNSKEY " << drc.getZoneRepresentation()<d_salt)<d_algorithm=1; - ns3p->d_iterations= 100; - ns3p->d_salt.assign("\xab\xcd", 2); - ns3p->d_saltlength=2; - ns3p->d_flags=0; - */ } return true; } @@ -252,7 +253,7 @@ DNSKEYRecordContent DNSSECPrivateKey::getDNSKEY() } -void DNSSECKeeper::addZone(const std::string& name) +void DNSSECKeeper::secureZone(const std::string& name, int algorithm) { mkdir((d_dirname+"/"+name).c_str(), 0700); mkdir((d_dirname+"/"+name+"/ksks").c_str(), 0700); @@ -265,7 +266,7 @@ void DNSSECKeeper::addZone(const std::string& name) string isc = dpk.d_key.convertToISC(); DNSKEYRecordContent drc = dpk.getDNSKEY(); drc.d_flags = 257; // ZSK - + drc.d_algorithm = algorithm; string iscName=d_dirname+"/"+name+"/ksks/"; time_t now=time(0); @@ -283,7 +284,7 @@ void DNSSECKeeper::addZone(const std::string& name) { ofstream dnskeyFile((iscName+".dnskey").c_str()); - dnskeyFile << name << " IN DNSKEY " << drc.getZoneRepresentation()< > zskset_t; zskset_t getZSKsFor(const std::string& zone, bool all=false); - void addZSKFor(const std::string& zname, bool next=false); + void addZSKFor(const std::string& zname, int algorithm, bool next=false); void deleteZSKFor(const std::string& zname, const std::string& fname); - void addZone(const std::string& fname); + void secureZone(const std::string& fname, int algorithm); bool getNSEC3PARAM(const std::string& zname, NSEC3PARAMRecordContent* n3p=0); void setNSEC3PARAM(const std::string& zname, const NSEC3PARAMRecordContent* n3p); diff --git a/pdns/pdnssec.cc b/pdns/pdnssec.cc index c71a8b902..a92fcece9 100644 --- a/pdns/pdnssec.cc +++ b/pdns/pdnssec.cc @@ -187,17 +187,17 @@ try if(!zskset.empty()) { - cerr<<"There were ZSKs already for zone '"<