Python Forum

Full Version: dnspython update dns record issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.


I'm trying to use dnspython to do a TSIG based dynamic DNS update.
I've followed the example code :

 #!/usr/bin/env python
 import sys
 import dns.update
 import dns.query
 import dns.tsigkeyring

 keyring = dns.tsigkeyring.from_text({
     'keyname.' : 'VarFF=2Xts7T5Vb/xd&8ir=='
 })
 update = dns.update.Update('domain_name', keyring=keyring)
 update.replace('myserver', 30, 'a', '88.88.88.88')
 response = dns.query.tcp(update, 'dns_ip',timeout=10)

and here is what I got:

   response = dns.query.tcp(update, 'dns_ip',timeout=10)
  File "/root/bck/dnspython/dns/query.py", line 475, in tcp
    q.keyring, q.mac)
  File "/root/bck/dnspython/dns/query.py", line 412, in receive_tcp
    one_rr_per_rrset=one_rr_per_rrset)
  File "/root/bck/dnspython/dns/message.py", line 821, in from_wire
    reader.read()
  File "/root/bck/dnspython/dns/message.py", line 749, in read
    self._get_section(self.message.additional, adcount)
  File "/root/bck/dnspython/dns/message.py", line 701, in _get_section
    self.message.first)
  File "/root/bck/dnspython/dns/tsig.py", line 198, in validate
    raise BadSignature
dns.tsig.BadSignature: The TSIG signature fails to verify.
http://www.dnspython.org/examples.html Wrote:
import dns.query
import dns.tsigkeyring
import dns.update
import sys

keyring = dns.tsigkeyring.from_text({
    'host-example.' : 'XXXXXXXXXXXXXXXXXXXXXX=='
})

update = dns.update.Update('dyn.test.example', keyring=keyring)
update.replace('host', 300, 'a', sys.argv[1])

response = dns.query.tcp(update, '10.0.0.1')

Why is your key ring's value "keyname", instead of "host-example." like in the example? I'm not sure what the lib is supposed to do, so I don't know if those values are valid or not...