*
* \param zone The zone to rectify
* \param error& A string where error messages are added
+ * \param info& A string where informational messages are added
* \param doTransaction Whether or not to wrap the rectify in a transaction
*/
-bool DNSSECKeeper::rectifyZone(const DNSName& zone, string& error, bool doTransaction) {
+bool DNSSECKeeper::rectifyZone(const DNSName& zone, string& error, string& info, bool doTransaction) {
if (isPresigned(zone)) {
error = "Rectify presigned zone '"+zone.toLogString()+"' is not allowed/necessary.";
return false;
sd.db->list(zone, sd.domain_id);
+ ostringstream infostream;
DNSResourceRecord rr;
set<DNSName> qnames, nsset, dsnames, insnonterm, delnonterm;
map<DNSName,bool> nonterm;
bool haveNSEC3 = getNSEC3PARAM(zone, &ns3pr, &narrow);
bool isOptOut = (haveNSEC3 && ns3pr.d_flags);
+ if(isSecuredZone(zone)) {
+ if(!haveNSEC3) {
+ infostream<<"Adding NSEC ordering information ";
+ }
+ else if(!narrow) {
+ if(!isOptOut) {
+ infostream<<"Adding NSEC3 hashed ordering information for '"<<zone<<"'";
+ }
+ else {
+ infostream<<"Adding NSEC3 opt-out hashed ordering information for '"<<zone<<"'";
+ }
+ } else {
+ infostream<<"Erasing NSEC3 ordering since we are narrow, only setting 'auth' fields";
+ }
+ }
+ else {
+ infostream<<"Adding empty non-terminals for non-DNSSEC zone";
+ }
+
set<DNSName> nsec3set;
if (haveNSEC3 && !narrow) {
for (auto &loopRR: rrs) {
else if (realrr) // NSEC
ordername=qname.makeRelative(zone);
- /*
- if(g_verbose)
- cerr<<"'"<<qname<<"' -> '"<< ordername <<"'"<<endl;
- */
sd.db->updateDNSSECOrderNameAndAuth(sd.domain_id, qname, ordername, auth);
if(realrr)
if (doTransaction)
sd.db->commitTransaction();
+ info = infostream.str();
return true;
}
void getFromMeta(const DNSName& zname, const std::string& key, std::string& value);
void getSoaEdit(const DNSName& zname, std::string& value);
- bool rectifyZone(const DNSName& zone, std::string& error, bool doTransaction);
+ bool rectifyZone(const DNSName& zone, std::string& error, std::string& info, bool doTransaction);
private:
bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone)
{
+ string output;
string error;
- bool ret = dk.rectifyZone(zone, error, true);
- if (!ret) {
+ bool ret = dk.rectifyZone(zone, error, output, true);
+ if (!output.empty()) {
+ cerr<<output<<endl;
+ }
+ if (!ret && !error.empty()) {
cerr<<error<<endl;
}
return ret;
string api_rectify;
di.backend->getDomainMetadataOne(zonename, "API-RECTIFY", api_rectify);
if (shouldRectify && dk.isSecuredZone(zonename) && !dk.isPresigned(zonename) && api_rectify == "1") {
+ string info;
string error_msg = "";
- if (!dk.rectifyZone(zonename, error_msg, true))
+ if (!dk.rectifyZone(zonename, error_msg, info, true))
throw ApiException("Failed to rectify '" + zonename.toString() + "' " + error_msg);
}
}
throw ApiException("Zone '" + zonename.toString() + "' is a slave zone, not rectifying.");
string error_msg = "";
- if (!dk.rectifyZone(zonename, error_msg, true))
+ string info;
+ if (!dk.rectifyZone(zonename, error_msg, info, true))
throw ApiException("Failed to rectify '" + zonename.toString() + "' " + error_msg);
resp->setSuccessResult("Rectified");
di.backend->getDomainMetadataOne(zonename, "API-RECTIFY", api_rectify);
if (dk.isSecuredZone(zonename) && !dk.isPresigned(zonename) && api_rectify == "1") {
string error_msg = "";
- if (!dk.rectifyZone(zonename, error_msg, false))
+ string info;
+ if (!dk.rectifyZone(zonename, error_msg, info, false))
throw ApiException("Failed to rectify '" + zonename.toString() + "' " + error_msg);
}