Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implementation of NSEC3PARAM (closes #2)

  • Loading branch information...
commit e2072b4d725fb753b9f636649cd194c4af59d9d8 1 parent a89f308
Stephane Bortzmeyer authored
Showing with 42 additions and 3 deletions.
  1. +28 −3 DNSLG/Formatter.py
  2. +6 −0 JSON.txt
  3. +8 −0 tests.sh
View
31 DNSLG/Formatter.py
@@ -126,11 +126,9 @@ def format(self, answer, qtype, flags, querier):
# key_id appeared only in dnspython 1.9. Not
# always available on 2012-05-17
pass
- self.output += "algorithm %i, flags %i\n" % (rdata.algorithm, rdata.flags)
+ self.output += "algorithm %i, length %i bits, flags %i\n" % (rdata.algorithm, keylength(rdata.algorithm, rdata.key), rdata.flags)
elif rdata.rdtype == dns.rdatatype.NSEC3PARAM:
self.output += "NSEC3PARAM: algorithm %i, iterations %i\n" % (rdata.algorithm, rdata.iterations) # TODO format salt (tagged as string but actually binaty)
- self.output += "algorithm %i, length %i bits, flags %i\n" % \
- (rdata.algorithm, keylength(rdata.algorithm, rdata.key), rdata.flags)
elif rdata.rdtype == dns.rdatatype.SSHFP:
self.output += "SSH fingerprint: algorithm %i, digest type %i, fingerprint %s\n" % \
(rdata.algorithm, rdata.fp_type, to_hexstring(rdata.fingerprint))
@@ -215,6 +213,8 @@ def format(self, answer, qtype, flags, querier):
# key_id appeared only in dnspython 1.9. Not
# always available on 2012-05-17
self.output += "\n"
+ elif rdata.rdtype == dns.rdatatype.NSEC3PARAM:
+ self.output += "NSEC3PARAM\t%s\n" % rdata.to_text()
elif rdata.rdtype == dns.rdatatype.DS:
self.output += "DS\t%s\n" % rdata.to_text()
elif rdata.rdtype == dns.rdatatype.DLV:
@@ -310,6 +310,8 @@ def format(self, answer, qtype, flags, querier):
# always available on 2012-05-17
pass
self.object['AnswerSection'].append(returned_object)
+ elif rdata.rdtype == dns.rdatatype.NSEC3PARAM:
+ self.object['AnswerSection'].append({'Type': 'NSEC3PARAM', 'Algorithm': rdata.algorithm, 'Iterations': rdata.iterations, 'Flags': rdata.flags}) # TODO format salt (tagged as string but actually binaty)
elif rdata.rdtype == dns.rdatatype.DS:
self.object['AnswerSection'].append({'Type': 'DS', 'DelegationKey': rdata.key_tag,
'DigestType': rdata.digest_type})
@@ -410,6 +412,10 @@ def result(self, querier):
ptr_xml_template = """
<PTR tal:attributes="ptrdname name"/>
"""
+# TODO: NSEC3PARAM not in draft-daley-dns-schema-00
+nsec3param_xml_template = """
+<NSEC3PARAM tal:attributes="algorithm algorithm; flags flags; iterations iterations"/>
+"""
ds_xml_template = """
<DS tal:attributes="keytag keytag; algorithm algorithm; digesttype digesttype; digest digest"/>
"""
@@ -451,6 +457,7 @@ def format(self, answer, qtype, flags, querier):
self.ptr_template = simpleTAL.compileXMLTemplate (ptr_xml_template)
self.soa_template = simpleTAL.compileXMLTemplate (soa_xml_template)
self.ds_template = simpleTAL.compileXMLTemplate (ds_xml_template)
+ self.nsec3param_template = simpleTAL.compileXMLTemplate (nsec3param_xml_template)
self.dlv_template = simpleTAL.compileXMLTemplate (dlv_xml_template)
self.dnskey_template = simpleTAL.compileXMLTemplate (dnskey_xml_template)
self.sshfp_template = simpleTAL.compileXMLTemplate (sshfp_xml_template)
@@ -525,6 +532,13 @@ def format(self, answer, qtype, flags, querier):
self.mx_template.expand (icontext, iresult,
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
+ elif rdata.rdtype == dns.rdatatype.NSEC3PARAM:
+ icontext.addGlobal ("algorithm", rdata.algorithm)
+ icontext.addGlobal ("flags", rdata.flags)
+ icontext.addGlobal ("iterations", rdata.iterations)
+ self.nsec3param_template.expand (icontext, iresult,
+ suppressXMLDeclaration=True,
+ outputEncoding=querier.encoding)
elif rdata.rdtype == dns.rdatatype.DS:
icontext.addGlobal ("keytag", rdata.key_tag)
icontext.addGlobal ("digesttype", rdata.digest_type)
@@ -710,6 +724,9 @@ def result(self, querier):
spf_html_template = """
<span tal:content="text"/>
"""
+nsec3param_html_template = """
+<span>NSEC3 parameters, hash type <span tal:replace="algorithm"/>, <span tal:replace="iterations"/> iterations, flags <span tal:replace="flags"/></span>
+"""
ds_html_template = """
<span>Key <span tal:replace="keytag"/> (hash type <span tal:replace="digesttype"/>)</span>
"""
@@ -811,6 +828,7 @@ def format(self, answer, qtype, flags, querier):
self.txt_template = simpleTAL.compileXMLTemplate (txt_html_template)
self.spf_template = simpleTAL.compileXMLTemplate (spf_html_template)
self.loc_template = simpleTAL.compileXMLTemplate (loc_html_template)
+ self.nsec3param_template = simpleTAL.compileXMLTemplate (nsec3param_html_template)
self.ds_template = simpleTAL.compileXMLTemplate (ds_html_template)
self.dlv_template = simpleTAL.compileXMLTemplate (dlv_html_template)
self.dnskey_template = simpleTAL.compileXMLTemplate (dnskey_html_template)
@@ -929,6 +947,13 @@ def format(self, answer, qtype, flags, querier):
self.loc_template.expand (icontext, iresult,
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
+ elif rdata.rdtype == dns.rdatatype.NSEC3PARAM:
+ icontext.addGlobal ("algorithm", rdata.algorithm)
+ icontext.addGlobal ("iterations", rdata.iterations)
+ icontext.addGlobal ("flags", rdata.flags)
+ self.nsec3param_template.expand (icontext, iresult,
+ suppressXMLDeclaration=True,
+ outputEncoding=querier.encoding)
elif rdata.rdtype == dns.rdatatype.DS:
icontext.addGlobal ("algorithm", rdata.algorithm)
icontext.addGlobal ("digesttype", rdata.digest_type)
View
6 JSON.txt
@@ -76,6 +76,12 @@ DLV:
* DelegationKey
* DigestType
+NSEC3PARAM:
+ * Algorihm
+ * Flags
+ * Salt
+ * Iterations
+
SSHFP:
* Algorithm
* DigestType
View
8 tests.sh
@@ -92,6 +92,14 @@ for type in DS; do
delay
done
done
+for type in NSEC3PARAM; do
+ for domain in fr gov com; do
+ for format in text zone xml html json; do
+ ${WEB} ${URL}/${domain}/${type}?format=${format}
+ done
+ delay
+ done
+done
for type in NAPTR; do
for domain in http.uri.arpa education.lu mailclub.tel; do
for format in text zone xml html json; do
Please sign in to comment.
Something went wrong with that request. Please try again.