我正在使用 dnspython 尝试对 BIND9 服务器执行更新,但是我不断收到错误 key 响应(“tsig verify failure (BADKEY)”) - 当我使用 nsupdate 时, key 工作得很好。有没有人成功实现了 dnspython 对 BIND DNS 进行动态更新?
这是一个包含所有代码和错误的 GIST: https://gist.github.com/anonymous/0afc800ef0615aa7c1219ec25c032eef
最佳答案
我必须在 update.Update 函数中使用 keyalgorithm 参数,并从 dns.tsig 模块导入特定算法
from dns import query, update, tsigkeyring
from dns.tsig import HMAC_SHA256
key='EQSVvuA/KMAa/0ugdBBLqjxgP+o5rI7y8JoJbOICpJM='
bindhost='192.168.56.10'
ip='192.168.56.10'
keyring = tsigkeyring.from_text({
'test.local' : key
})
update = update.Update('test.local.', keyring=keyring, keyalgorithm=HMAC_SHA256)
update.replace('abc', 300, 'A', ip)
response = query.tcp(update, bindhost, timeout=10)
关于python - dnspython动态更新PeerBadKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43010018/