Skip to content

Commit

Permalink
dig lookup: fix DNSKEY's algorithm handling (#5914)
Browse files Browse the repository at this point in the history
Fix DNSKEY's algorithm handling.
  • Loading branch information
felixfontein authored Jan 29, 2023
1 parent 6c6de8f commit 3da24d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/5914-dig-dnskey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "dig lookup plugin - correctly handle DNSKEY record type's ``algorithm`` field (https://github.com/ansible-collections/community.general/pull/5914)."
4 changes: 3 additions & 1 deletion plugins/lookup/dig.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def make_rdata_dict(rdata):
NSEC3PARAM: ['algorithm', 'flags', 'iterations', 'salt'],
PTR: ['target'],
RP: ['mbox', 'txt'],
# RRSIG: ['algorithm', 'labels', 'original_ttl', 'expiration', 'inception', 'signature'],
# RRSIG: ['type_covered', 'algorithm', 'labels', 'original_ttl', 'expiration', 'inception', 'key_tag', 'signer', 'signature'],
SOA: ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire', 'minimum'],
SPF: ['strings'],
SRV: ['priority', 'weight', 'port', 'target'],
Expand All @@ -251,6 +251,8 @@ def make_rdata_dict(rdata):

if rdata.rdtype == DS and f == 'digest':
val = dns.rdata._hexify(rdata.digest).replace(' ', '')
if rdata.rdtype == DNSKEY and f == 'algorithm':
val = int(val)
if rdata.rdtype == DNSKEY and f == 'key':
val = dns.rdata._base64ify(rdata.key).replace(' ', '')
if rdata.rdtype == NSEC3PARAM and f == 'salt':
Expand Down

0 comments on commit 3da24d5

Please sign in to comment.