]>
git.ipfire.org Git - people/ms/ddns.git/blob - src/ddns/providers.py
3927808b19cb494b279623e9022ad973295323ac
2 ###############################################################################
4 # ddns - A dynamic DNS client for IPFire #
5 # Copyright (C) 2012 IPFire development team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 import xml
.dom
.minidom
29 # Import all possible exception types.
32 logger
= logging
.getLogger("ddns.providers")
39 Returns a dict with all automatically registered providers.
41 return _providers
.copy()
43 class DDNSProvider(object):
44 # A short string that uniquely identifies
48 # The full name of the provider.
51 # A weburl to the homepage of the provider.
52 # (Where to register a new account?)
55 # A list of supported protocols.
56 protocols
= ("ipv6", "ipv4")
60 # Automatically register all providers.
61 class __metaclass__(type):
62 def __init__(provider
, name
, bases
, dict):
63 type.__init
__(provider
, name
, bases
, dict)
65 # The main class from which is inherited is not registered
67 if name
== "DDNSProvider":
70 if not all((provider
.handle
, provider
.name
, provider
.website
)):
71 raise DDNSError(_("Provider is not properly configured"))
73 assert not _providers
.has_key(provider
.handle
), \
74 "Provider '%s' has already been registered" % provider
.handle
76 _providers
[provider
.handle
] = provider
78 def __init__(self
, core
, **settings
):
81 # Copy a set of default settings and
82 # update them by those from the configuration file.
83 self
.settings
= self
.DEFAULT_SETTINGS
.copy()
84 self
.settings
.update(settings
)
87 return "<DDNS Provider %s (%s)>" % (self
.name
, self
.handle
)
89 def __cmp__(self
, other
):
90 return cmp(self
.hostname
, other
.hostname
)
92 def get(self
, key
, default
=None):
94 Get a setting from the settings dictionary.
96 return self
.settings
.get(key
, default
)
101 Fast access to the hostname.
103 return self
.get("hostname")
108 Fast access to the username.
110 return self
.get("username")
115 Fast access to the password.
117 return self
.get("password")
122 Fast access to the token.
124 return self
.get("token")
126 def __call__(self
, force
=False):
128 logger
.debug(_("Updating %s forced") % self
.hostname
)
130 # Check if we actually need to update this host.
131 elif self
.is_uptodate(self
.protocols
):
132 logger
.debug(_("%s is already up to date") % self
.hostname
)
135 # Execute the update.
139 raise NotImplementedError
141 def is_uptodate(self
, protos
):
143 Returns True if this host is already up to date
144 and does not need to change the IP address on the
148 addresses
= self
.core
.system
.resolve(self
.hostname
, proto
)
150 current_address
= self
.get_address(proto
)
152 # If no addresses for the given protocol exist, we
154 if current_address
is None and not addresses
:
157 if not current_address
in addresses
:
162 def send_request(self
, *args
, **kwargs
):
164 Proxy connection to the send request
167 return self
.core
.system
.send_request(*args
, **kwargs
)
169 def get_address(self
, proto
, default
=None):
171 Proxy method to get the current IP address.
173 return self
.core
.system
.get_address(proto
) or default
176 class DDNSProtocolDynDNS2(object):
178 This is an abstract class that implements the DynDNS updater
179 protocol version 2. As this is a popular way to update dynamic
180 DNS records, this class is supposed make the provider classes
184 # Information about the format of the request is to be found
185 # http://dyn.com/support/developers/api/perform-update/
186 # http://dyn.com/support/developers/api/return-codes/
188 def _prepare_request_data(self
):
190 "hostname" : self
.hostname
,
191 "myip" : self
.get_address("ipv4"),
197 data
= self
._prepare
_request
_data
()
199 # Send update to the server.
200 response
= self
.send_request(self
.url
, data
=data
,
201 username
=self
.username
, password
=self
.password
)
203 # Get the full response message.
204 output
= response
.read()
206 # Handle success messages.
207 if output
.startswith("good") or output
.startswith("nochg"):
210 # Handle error codes.
211 if output
== "badauth":
212 raise DDNSAuthenticationError
213 elif output
== "aduse":
215 elif output
== "notfqdn":
216 raise DDNSRequestError(_("No valid FQDN was given."))
217 elif output
== "nohost":
218 raise DDNSRequestError(_("Specified host does not exist."))
219 elif output
== "911":
220 raise DDNSInternalServerError
221 elif output
== "dnserr":
222 raise DDNSInternalServerError(_("DNS error encountered."))
224 # If we got here, some other update error happened.
225 raise DDNSUpdateError(_("Server response: %s") % output
)
228 class DDNSResponseParserXML(object):
230 This class provides a parser for XML responses which
231 will be sent by various providers. This class uses the python
232 shipped XML minidom module to walk through the XML tree and return
236 def get_xml_tag_value(self
, document
, content
):
237 # Send input to the parser.
238 xmldoc
= xml
.dom
.minidom
.parseString(document
)
240 # Get XML elements by the given content.
241 element
= xmldoc
.getElementsByTagName(content
)
243 # If no element has been found, we directly can return None.
247 # Only get the first child from an element, even there are more than one.
248 firstchild
= element
[0].firstChild
250 # Get the value of the child.
251 value
= firstchild
.nodeValue
257 class DDNSProviderAllInkl(DDNSProvider
):
258 handle
= "all-inkl.com"
259 name
= "All-inkl.com"
260 website
= "http://all-inkl.com/"
261 protocols
= ("ipv4",)
263 # There are only information provided by the vendor how to
264 # perform an update on a FRITZ Box. Grab requried informations
266 # http://all-inkl.goetze.it/v01/ddns-mit-einfachen-mitteln/
268 url
= "http://dyndns.kasserver.com"
271 # There is no additional data required so we directly can
273 response
= self
.send_request(self
.url
, username
=self
.username
, password
=self
.password
)
275 # Get the full response message.
276 output
= response
.read()
278 # Handle success messages.
279 if output
.startswith("good") or output
.startswith("nochg"):
282 # If we got here, some other update error happened.
283 raise DDNSUpdateError
286 class DDNSProviderBindNsupdate(DDNSProvider
):
288 name
= "BIND nsupdate utility"
289 website
= "http://en.wikipedia.org/wiki/Nsupdate"
294 scriptlet
= self
.__make
_scriptlet
()
296 # -v enables TCP hence we transfer keys and other data that may
297 # exceed the size of one packet.
298 # -t sets the timeout
299 command
= ["nsupdate", "-v", "-t", "60"]
301 p
= subprocess
.Popen(command
, shell
=True,
302 stdin
=subprocess
.PIPE
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
,
304 stdout
, stderr
= p
.communicate(scriptlet
)
306 if p
.returncode
== 0:
309 raise DDNSError("nsupdate terminated with error code: %s\n %s" % (p
.returncode
, stderr
))
311 def __make_scriptlet(self
):
314 # Set a different server the update is sent to.
315 server
= self
.get("server", None)
317 scriptlet
.append("server %s" % server
)
319 key
= self
.get("key", None)
321 secret
= self
.get("secret")
323 scriptlet
.append("key %s %s" % (key
, secret
))
325 ttl
= self
.get("ttl", self
.DEFAULT_TTL
)
327 # Perform an update for each supported protocol.
328 for rrtype
, proto
in (("AAAA", "ipv6"), ("A", "ipv4")):
329 address
= self
.get_address(proto
)
333 scriptlet
.append("update delete %s. %s" % (self
.hostname
, rrtype
))
334 scriptlet
.append("update add %s. %s %s %s" % \
335 (self
.hostname
, ttl
, rrtype
, address
))
337 # Send the actions to the server.
338 scriptlet
.append("send")
339 scriptlet
.append("quit")
341 logger
.debug(_("Scriptlet:"))
342 for line
in scriptlet
:
343 # Masquerade the line with the secret key.
344 if line
.startswith("key"):
345 line
= "key **** ****"
347 logger
.debug(" %s" % line
)
349 return "\n".join(scriptlet
)
352 class DDNSProviderDHS(DDNSProvider
):
354 name
= "DHS International"
355 website
= "http://dhs.org/"
356 protocols
= ("ipv4",)
358 # No information about the used update api provided on webpage,
359 # grabed from source code of ez-ipudate.
361 url
= "http://members.dhs.org/nic/hosts"
365 "domain" : self
.hostname
,
366 "ip" : self
.get_address("ipv4"),
368 "hostcmdstage" : "2",
372 # Send update to the server.
373 response
= self
.send_request(self
.url
, username
=self
.username
, password
=self
.password
,
376 # Handle success messages.
377 if response
.code
== 200:
380 # If we got here, some other update error happened.
381 raise DDNSUpdateError
384 class DDNSProviderDNSpark(DDNSProvider
):
385 handle
= "dnspark.com"
387 website
= "http://dnspark.com/"
388 protocols
= ("ipv4",)
390 # Informations to the used api can be found here:
391 # https://dnspark.zendesk.com/entries/31229348-Dynamic-DNS-API-Documentation
393 url
= "https://control.dnspark.com/api/dynamic/update.php"
397 "domain" : self
.hostname
,
398 "ip" : self
.get_address("ipv4"),
401 # Send update to the server.
402 response
= self
.send_request(self
.url
, username
=self
.username
, password
=self
.password
,
405 # Get the full response message.
406 output
= response
.read()
408 # Handle success messages.
409 if output
.startswith("ok") or output
.startswith("nochange"):
412 # Handle error codes.
413 if output
== "unauth":
414 raise DDNSAuthenticationError
415 elif output
== "abuse":
417 elif output
== "blocked":
418 raise DDNSBlockedError
419 elif output
== "nofqdn":
420 raise DDNSRequestError(_("No valid FQDN was given."))
421 elif output
== "nohost":
422 raise DDNSRequestError(_("Invalid hostname specified."))
423 elif output
== "notdyn":
424 raise DDNSRequestError(_("Hostname not marked as a dynamic host."))
425 elif output
== "invalid":
426 raise DDNSRequestError(_("Invalid IP address has been sent."))
428 # If we got here, some other update error happened.
429 raise DDNSUpdateError
432 class DDNSProviderDtDNS(DDNSProvider
):
435 website
= "http://dtdns.com/"
436 protocols
= ("ipv4",)
438 # Information about the format of the HTTPS request is to be found
439 # http://www.dtdns.com/dtsite/updatespec
441 url
= "https://www.dtdns.com/api/autodns.cfm"
445 "ip" : self
.get_address("ipv4"),
446 "id" : self
.hostname
,
450 # Send update to the server.
451 response
= self
.send_request(self
.url
, data
=data
)
453 # Get the full response message.
454 output
= response
.read()
456 # Remove all leading and trailing whitespace.
457 output
= output
.strip()
459 # Handle success messages.
460 if "now points to" in output
:
463 # Handle error codes.
464 if output
== "No hostname to update was supplied.":
465 raise DDNSRequestError(_("No hostname specified."))
467 elif output
== "The hostname you supplied is not valid.":
468 raise DDNSRequestError(_("Invalid hostname specified."))
470 elif output
== "The password you supplied is not valid.":
471 raise DDNSAuthenticationError
473 elif output
== "Administration has disabled this account.":
474 raise DDNSRequestError(_("Account has been disabled."))
476 elif output
== "Illegal character in IP.":
477 raise DDNSRequestError(_("Invalid IP address has been sent."))
479 elif output
== "Too many failed requests.":
480 raise DDNSRequestError(_("Too many failed requests."))
482 # If we got here, some other update error happened.
483 raise DDNSUpdateError
486 class DDNSProviderDynDNS(DDNSProtocolDynDNS2
, DDNSProvider
):
487 handle
= "dyndns.org"
489 website
= "http://dyn.com/dns/"
490 protocols
= ("ipv4",)
492 # Information about the format of the request is to be found
493 # http://http://dyn.com/support/developers/api/perform-update/
494 # http://dyn.com/support/developers/api/return-codes/
496 url
= "https://members.dyndns.org/nic/update"
499 class DDNSProviderDynU(DDNSProtocolDynDNS2
, DDNSProvider
):
502 website
= "http://dynu.com/"
503 protocols
= ("ipv6", "ipv4",)
505 # Detailed information about the request and response codes
506 # are available on the providers webpage.
507 # http://dynu.com/Default.aspx?page=dnsapi
509 url
= "https://api.dynu.com/nic/update"
511 def _prepare_request_data(self
):
512 data
= DDNSProviderDynDNS
._prepare
_request
_data
(self
)
514 # This one supports IPv6
516 "myipv6" : self
.get_address("ipv6"),
522 class DDNSProviderEasyDNS(DDNSProtocolDynDNS2
, DDNSProvider
):
523 handle
= "easydns.com"
525 website
= "http://www.easydns.com/"
526 protocols
= ("ipv4",)
528 # There is only some basic documentation provided by the vendor,
529 # also searching the web gain very poor results.
530 # http://mediawiki.easydns.com/index.php/Dynamic_DNS
532 url
= "http://api.cp.easydns.com/dyn/tomato.php"
535 class DDNSProviderEnomCom(DDNSResponseParserXML
, DDNSProvider
):
538 website
= "http://www.enom.com/"
540 # There are very detailed information about how to send an update request and
542 # http://www.enom.com/APICommandCatalog/
544 url
= "https://dynamic.name-services.com/interface.asp"
548 "command" : "setdnshost",
549 "responsetype" : "xml",
550 "address" : self
.get_address("ipv4"),
551 "domainpassword" : self
.password
,
552 "zone" : self
.hostname
555 # Send update to the server.
556 response
= self
.send_request(self
.url
, data
=data
)
558 # Get the full response message.
559 output
= response
.read()
561 # Handle success messages.
562 if self
.get_xml_tag_value(output
, "ErrCount") == "0":
565 # Handle error codes.
566 errorcode
= self
.get_xml_tag_value(output
, "ResponseNumber")
568 if errorcode
== "304155":
569 raise DDNSAuthenticationError
570 elif errorcode
== "304153":
571 raise DDNSRequestError(_("Domain not found."))
573 # If we got here, some other update error happened.
574 raise DDNSUpdateError
577 class DDNSProviderFreeDNSAfraidOrg(DDNSProvider
):
578 handle
= "freedns.afraid.org"
579 name
= "freedns.afraid.org"
580 website
= "http://freedns.afraid.org/"
582 # No information about the request or response could be found on the vendor
583 # page. All used values have been collected by testing.
584 url
= "https://freedns.afraid.org/dynamic/update.php"
588 return self
.get("proto")
591 address
= self
.get_address(self
.proto
)
597 # Add auth token to the update url.
598 url
= "%s?%s" % (self
.url
, self
.token
)
600 # Send update to the server.
601 response
= self
.send_request(url
, data
=data
)
603 # Get the full response message.
604 output
= response
.read()
606 # Handle success messages.
607 if output
.startswith("Updated") or "has not changed" in output
:
610 # Handle error codes.
611 if output
== "ERROR: Unable to locate this record":
612 raise DDNSAuthenticationError
613 elif "is an invalid IP address" in output
:
614 raise DDNSRequestError(_("Invalid IP address has been sent."))
616 # If we got here, some other update error happened.
617 raise DDNSUpdateError
620 class DDNSProviderLightningWireLabs(DDNSProvider
):
621 handle
= "dns.lightningwirelabs.com"
622 name
= "Lightning Wire Labs DNS Service"
623 website
= "http://dns.lightningwirelabs.com/"
625 # Information about the format of the HTTPS request is to be found
626 # https://dns.lightningwirelabs.com/knowledge-base/api/ddns
628 url
= "https://dns.lightningwirelabs.com/update"
632 "hostname" : self
.hostname
,
633 "address6" : self
.get_address("ipv6", "-"),
634 "address4" : self
.get_address("ipv4", "-"),
637 # Check if a token has been set.
639 data
["token"] = self
.token
641 # Check for username and password.
642 elif self
.username
and self
.password
:
644 "username" : self
.username
,
645 "password" : self
.password
,
648 # Raise an error if no auth details are given.
650 raise DDNSConfigurationError
652 # Send update to the server.
653 response
= self
.send_request(self
.url
, data
=data
)
655 # Handle success messages.
656 if response
.code
== 200:
659 # If we got here, some other update error happened.
660 raise DDNSUpdateError
663 class DDNSProviderNamecheap(DDNSResponseParserXML
, DDNSProvider
):
664 handle
= "namecheap.com"
666 website
= "http://namecheap.com"
667 protocols
= ("ipv4",)
669 # Information about the format of the HTTP request is to be found
670 # https://www.namecheap.com/support/knowledgebase/article.aspx/9249/0/nc-dynamic-dns-to-dyndns-adapter
671 # https://community.namecheap.com/forums/viewtopic.php?f=6&t=6772
673 url
= "https://dynamicdns.park-your-domain.com/update"
676 # Namecheap requires the hostname splitted into a host and domain part.
677 host
, domain
= self
.hostname
.split(".", 1)
680 "ip" : self
.get_address("ipv4"),
681 "password" : self
.password
,
686 # Send update to the server.
687 response
= self
.send_request(self
.url
, data
=data
)
689 # Get the full response message.
690 output
= response
.read()
692 # Handle success messages.
693 if self
.get_xml_tag_value(output
, "IP") == self
.get_address("ipv4"):
696 # Handle error codes.
697 errorcode
= self
.get_xml_tag_value(output
, "ResponseNumber")
699 if errorcode
== "304156":
700 raise DDNSAuthenticationError
701 elif errorcode
== "316153":
702 raise DDNSRequestError(_("Domain not found."))
703 elif errorcode
== "316154":
704 raise DDNSRequestError(_("Domain not active."))
705 elif errorcode
in ("380098", "380099"):
706 raise DDNSInternalServerError
708 # If we got here, some other update error happened.
709 raise DDNSUpdateError
712 class DDNSProviderNOIP(DDNSProtocolDynDNS2
, DDNSProvider
):
715 website
= "http://www.no-ip.com/"
716 protocols
= ("ipv4",)
718 # Information about the format of the HTTP request is to be found
719 # here: http://www.no-ip.com/integrate/request and
720 # here: http://www.no-ip.com/integrate/response
722 url
= "http://dynupdate.no-ip.com/nic/update"
724 def _prepare_request_data(self
):
726 "hostname" : self
.hostname
,
727 "address" : self
.get_address("ipv4"),
733 class DDNSProviderNsupdateINFO(DDNSProtocolDynDNS2
, DDNSProvider
):
734 handle
= "nsupdate.info"
735 name
= "nsupdate.info"
736 website
= "http://www.nsupdate.info/"
737 protocols
= ("ipv6", "ipv4",)
739 # Information about the format of the HTTP request can be found
740 # after login on the provider user intrface and here:
741 # http://nsupdateinfo.readthedocs.org/en/latest/user.html
743 # Nsupdate.info uses the hostname as user part for the HTTP basic auth,
744 # and for the password a so called secret.
747 return self
.get("hostname")
751 return self
.get("secret")
755 return self
.get("proto")
759 # The update URL is different by the used protocol.
760 if self
.proto
== "ipv4":
761 return "https://ipv4.nsupdate.info/nic/update"
762 elif self
.proto
== "ipv6":
763 return "https://ipv6.nsupdate.info/nic/update"
765 raise DDNSUpdateError(_("Invalid protocol has been given"))
767 def _prepare_request_data(self
):
769 "myip" : self
.get_address(self
.proto
),
775 class DDNSProviderOpenDNS(DDNSProtocolDynDNS2
, DDNSProvider
):
776 handle
= "opendns.com"
778 website
= "http://www.opendns.com"
780 # Detailed information about the update request and possible
781 # response codes can be obtained from here:
782 # https://support.opendns.com/entries/23891440
784 url
= "https://updates.opendns.com/nic/update"
788 return self
.get("proto")
790 def _prepare_request_data(self
):
792 "hostname" : self
.hostname
,
793 "myip" : self
.get_address(self
.proto
)
799 class DDNSProviderOVH(DDNSProtocolDynDNS2
, DDNSProvider
):
802 website
= "http://www.ovh.com/"
803 protocols
= ("ipv4",)
805 # OVH only provides very limited information about how to
806 # update a DynDNS host. They only provide the update url
807 # on the their german subpage.
809 # http://hilfe.ovh.de/DomainDynHost
811 url
= "https://www.ovh.com/nic/update"
813 def _prepare_request_data(self
):
814 data
= DDNSProtocolDynDNS2
._prepare_request_data(self
)
822 class DDNSProviderRegfish(DDNSProvider
):
823 handle
= "regfish.com"
824 name
= "Regfish GmbH"
825 website
= "http://www.regfish.com/"
827 # A full documentation to the providers api can be found here
828 # but is only available in german.
829 # https://www.regfish.de/domains/dyndns/dokumentation
831 url
= "https://dyndns.regfish.de/"
835 "fqdn" : self
.hostname
,
838 # Check if we update an IPv6 address.
839 address6
= self
.get_address("ipv6")
841 data
["ipv6"] = address6
843 # Check if we update an IPv4 address.
844 address4
= self
.get_address("ipv4")
846 data
["ipv4"] = address4
848 # Raise an error if none address is given.
849 if not data
.has_key("ipv6") and not data
.has_key("ipv4"):
850 raise DDNSConfigurationError
852 # Check if a token has been set.
854 data
["token"] = self
.token
856 # Raise an error if no token and no useranem and password
858 elif not self
.username
and not self
.password
:
859 raise DDNSConfigurationError(_("No Auth details specified."))
861 # HTTP Basic Auth is only allowed if no token is used.
863 # Send update to the server.
864 response
= self
.send_request(self
.url
, data
=data
)
866 # Send update to the server.
867 response
= self
.send_request(self
.url
, username
=self
.username
, password
=self
.password
,
870 # Get the full response message.
871 output
= response
.read()
873 # Handle success messages.
874 if "100" in output
or "101" in output
:
877 # Handle error codes.
878 if "401" or "402" in output
:
879 raise DDNSAuthenticationError
880 elif "408" in output
:
881 raise DDNSRequestError(_("Invalid IPv4 address has been sent."))
882 elif "409" in output
:
883 raise DDNSRequestError(_("Invalid IPv6 address has been sent."))
884 elif "412" in output
:
885 raise DDNSRequestError(_("No valid FQDN was given."))
886 elif "414" in output
:
887 raise DDNSInternalServerError
889 # If we got here, some other update error happened.
890 raise DDNSUpdateError
893 class DDNSProviderSelfhost(DDNSProtocolDynDNS2
, DDNSProvider
):
894 handle
= "selfhost.de"
896 website
= "http://www.selfhost.de/"
897 protocols
= ("ipv4",)
899 url
= "https://carol.selfhost.de/nic/update"
901 def _prepare_request_data(self
):
902 data
= DDNSProviderDynDNS
._prepare
_request
_data
(self
)
910 class DDNSProviderSPDNS(DDNSProtocolDynDNS2
, DDNSProvider
):
913 website
= "http://spdns.org/"
914 protocols
= ("ipv4",)
916 # Detailed information about request and response codes are provided
917 # by the vendor. They are using almost the same mechanism and status
918 # codes as dyndns.org so we can inherit all those stuff.
920 # http://wiki.securepoint.de/index.php/SPDNS_FAQ
921 # http://wiki.securepoint.de/index.php/SPDNS_Update-Tokens
923 url
= "https://update.spdns.de/nic/update"
926 class DDNSProviderStrato(DDNSProtocolDynDNS2
, DDNSProvider
):
927 handle
= "strato.com"
929 website
= "http:/www.strato.com/"
930 protocols
= ("ipv4",)
932 # Information about the request and response can be obtained here:
933 # http://www.strato-faq.de/article/671/So-einfach-richten-Sie-DynDNS-f%C3%BCr-Ihre-Domains-ein.html
935 url
= "https://dyndns.strato.com/nic/update"
938 class DDNSProviderTwoDNS(DDNSProtocolDynDNS2
, DDNSProvider
):
941 website
= "http://www.twodns.de"
942 protocols
= ("ipv4",)
944 # Detailed information about the request can be found here
945 # http://twodns.de/en/faqs
946 # http://twodns.de/en/api
948 url
= "https://update.twodns.de/update"
950 def _prepare_request_data(self
):
952 "ip" : self
.get_address("ipv4"),
953 "hostname" : self
.hostname
959 class DDNSProviderUdmedia(DDNSProtocolDynDNS2
, DDNSProvider
):
960 handle
= "udmedia.de"
961 name
= "Udmedia GmbH"
962 website
= "http://www.udmedia.de"
963 protocols
= ("ipv4",)
965 # Information about the request can be found here
966 # http://www.udmedia.de/faq/content/47/288/de/wie-lege-ich-einen-dyndns_eintrag-an.html
968 url
= "https://www.udmedia.de/nic/update"
971 class DDNSProviderVariomedia(DDNSProtocolDynDNS2
, DDNSProvider
):
972 handle
= "variomedia.de"
974 website
= "http://www.variomedia.de/"
975 protocols
= ("ipv6", "ipv4",)
977 # Detailed information about the request can be found here
978 # https://dyndns.variomedia.de/
980 url
= "https://dyndns.variomedia.de/nic/update"
984 return self
.get("proto")
986 def _prepare_request_data(self
):
988 "hostname" : self
.hostname
,
989 "myip" : self
.get_address(self
.proto
)
995 class DDNSProviderZoneedit(DDNSProtocolDynDNS2
, DDNSProvider
):
996 handle
= "zoneedit.com"
998 website
= "http://www.zoneedit.com"
999 protocols
= ("ipv4",)
1001 # Detailed information about the request and the response codes can be
1003 # http://www.zoneedit.com/doc/api/other.html
1004 # http://www.zoneedit.com/faq.html
1006 url
= "https://dynamic.zoneedit.com/auth/dynamic.html"
1010 return self
.get("proto")
1014 "dnsto" : self
.get_address(self
.proto
),
1015 "host" : self
.hostname
1018 # Send update to the server.
1019 response
= self
.send_request(self
.url
, username
=self
.username
, password
=self
.password
,
1022 # Get the full response message.
1023 output
= response
.read()
1025 # Handle success messages.
1026 if output
.startswith("<SUCCESS"):
1029 # Handle error codes.
1030 if output
.startswith("invalid login"):
1031 raise DDNSAuthenticationError
1032 elif output
.startswith("<ERROR CODE=\"704\""):
1033 raise DDNSRequestError(_("No valid FQDN was given."))
1034 elif output
.startswith("<ERROR CODE=\"702\""):
1035 raise DDNSInternalServerError
1037 # If we got here, some other update error happened.
1038 raise DDNSUpdateError