-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnb_dns_run.py
31 lines (25 loc) · 895 Bytes
/
nb_dns_run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# This is the configuration and startup for the webhook server.
# Edit to suit.
import dns.tsig, dns.tsigkeyring
from nb_dns_updater import DummyUpdater, DDNSUpdater, simple_server
SERVER = '127.0.0.1'
KEY_ID = 'my-key-name'
SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX='
KEYRING = dns.tsigkeyring.from_text({
KEY_ID: SECRET,
})
KEYALGORITHM = dns.tsig.HMAC_SHA256
WEBHOOK_SECRET = 'VERY RANDOM STRING'
ddns = DDNSUpdater(server=SERVER, keyring=KEYRING, keyalgorithm=KEYALGORITHM)
#ddns = DummyUpdater()
# List all the zones you wish to update, pointing at the relevant
# updater object. You can have different zones on different
# servers and/or with different keys
ZONES = {
"example.com": ddns,
"168.192.in-addr.arpa": ddns,
"8.b.d.0.1.0.0.2.ip6.arpa": ddns,
}
if __name__ == "__main__":
simple_server(ZONES, api_key=WEBHOOK_SECRET)