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 32 33 34 35 36 37 38
|
"""
ddupdate plugin updating data on dy.fi.
See: ddupdate(8)
See: https://www.dy.fi/page/specification
"""
from ddupdate.ddplugin import ServicePlugin, ServiceError
from ddupdate.ddplugin import http_basic_auth_setup, get_response
class DyFiPlugin(ServicePlugin):
"""
Update a dns entry on dy.fi.
Does not support setting arbitrary ip address. The ip-disabled plugin
should be used, and the address set is as seen from dy.fi.
netrc: Use a line like
machine www.dy.fi login <username> password <password>
Options:
none
"""
_name = 'dy.fi'
_oneliner = 'Updates on https://www.dy.fi/'
_url = 'https://www.dy.fi/nic/update?hostname={0}'
_ip_cache_ttl = 7200 # 5 days
def register(self, log, hostname, ip, options):
"""Implement ServicePlugin.register."""
url = self._url.format(hostname)
http_basic_auth_setup(url)
html = get_response(log, url)
if html.split()[0] not in ['nochg', 'good']:
raise ServiceError("Bad update reply: " + html)
|