dnspython动态更新PeerBadKey

2024-05-23 19:53:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用dnspython尝试对BIND9服务器执行更新,但是我总是收到一个错误的密钥响应(“tsig verify failure(BADKEY)”)—当我使用nsupdate时,密钥工作正常。是否有人成功地实现了dnspython来对绑定DNS执行动态更新?在

以下是所有代码和错误的要点: https://gist.github.com/anonymous/0afc800ef0615aa7c1219ec25c032eef


Tags: 代码https服务器failuredns错误密钥动态
1条回答
网友
1楼 · 发布于 2024-05-23 19:53:33

我必须使用keyalgorithm参数更新。更新函数,以及从域名系统.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)

相关问题 更多 >