]> granicus.if.org Git - pdns/commitdiff
pdnssec: warn for insecure wildcards in opt-out zones
authorKees Monshouwer <mind04@monshouwer.org>
Fri, 27 Mar 2015 19:19:36 +0000 (20:19 +0100)
committermind04 <mind04@monshouwer.org>
Sun, 29 Mar 2015 09:51:28 +0000 (11:51 +0200)
pdns/pdnssec.cc

index bac88672e32467f566a62a9c264c0ad13c63cb24..12015f9d9d470b54336601c8605b4df32b0d52eb 100644 (file)
@@ -408,7 +408,15 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
     cout<<"Checked 0 records of '"<<zone<<"', 1 errors, 0 warnings."<<endl;
     return 1;
   }
+
+  NSEC3PARAMRecordContent ns3pr;
+  bool narrow = false;
+  bool haveNSEC3 = dk.getNSEC3PARAM(zone, &ns3pr, &narrow);
+  bool isOptOut=(haveNSEC3 && ns3pr.d_flags);
+
+  bool isSecure=dk.isSecuredZone(zone);
   bool presigned=dk.isPresigned(zone);
+
   sd.db->list(zone, sd.domain_id, true);
   DNSResourceRecord rr;
   uint64_t numrecords=0, numerrors=0, numwarnings=0;
@@ -494,6 +502,12 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
       continue;
     }
 
+    if (isSecure && isOptOut && (rr.qname.size() && rr.qname[0] == '*') && (rr.qname.size() < 2 || rr.qname[1] == '.' )) {
+      cout<<"[Warning] wildcard record '"<<rr.qname<<" IN " <<rr.qtype.getName()<<" "<<rr.content<<"' is insecure"<<endl;
+      cout<<"[Info] Wildcard records in opt-out zones are insecure. Disable the opt-out flag for this zone to avoid this warning. Command: pdnssec set-nsec3 "<<zone<<endl;
+      numwarnings++;
+    }
+
     if(pdns_iequals(rr.qname, zone)) {
       if (rr.qtype.getCode() == QType::NS) {
         hasNsAtApex=true;