python unbound client bug?

Paul Wouters paul at nohats.ca
Mon May 29 18:42:49 UTC 2023


See:

$ dig  _aiven-challenge.nohats.ca txt +short
"token=someveryrandomstring,expiry=never"

doing the same with unbound python:


import os
from unbound import ub_ctx,ub_strerror,RR_TYPE_TXT,RR_TYPE_A,RR_CLASS_IN

ctx = ub_ctx()
ctx.resolvconf("/etc/resolv.conf")
if os.path.isfile("/etc/unbound/dnssec-root.key"):
     ctx.add_ta_file("/etc/unbound/dnssec-root.key") #read public keys for DNSSEC verification
status, result = ctx.resolve(f"_aiven-challenge.nohats.ca.", RR_TYPE_TXT, RR_CLASS_IN)

if status == 0 and result.havedata:
     print(result.data.data)


$ python test.py 
[b"'token=someveryrandomstring,expiry=never"]


Note there is a single quote at the beginning of the string (and not at the end)

This is with python3-unbound-1.17.1-1.fc37.x86_64

Paul


More information about the Unbound-users mailing list