DDNS: add new Provider key-sytems.net (domaindiscount24)

Message ID 81dc1ed3-1179-42c6-784a-15f64a79508c@gmx.at
State Dropped
Headers show
Series DDNS: add new Provider key-sytems.net (domaindiscount24) | expand

Commit Message

Christof Weniger Nov. 28, 2019, 10:45 a.m. UTC
Hi,

I hope this is the correct way to submit this patch.

https://www.domaindiscount24.com/ has its own ddns service runnning,
which (for me) gets rid of the necessity of having to use an extra
service for that.

I tested the following patch on my system at home, and attached it to
this mail.

I started my quest at the community forum:
https://community.ipfire.org/t/adding-new-ddns-provider/428/2

Christof

Comments

Michael Tremer Nov. 28, 2019, 11:20 a.m. UTC | #1
Hello Christof,

> On 28 Nov 2019, at 10:45, Christof Weniger <ChristofWeniger@gmx.at> wrote:
> 
> Hi,
> 
> I hope this is the correct way to submit this patch.

Yes, you found the right place.

It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.

> https://www.domaindiscount24.com/ has its own ddns service runnning,
> which (for me) gets rid of the necessity of having to use an extra
> service for that.
> 
> I tested the following patch on my system at home, and attached it to
> this mail.
> 
> I started my quest at the community forum:
> https://community.ipfire.org/t/adding-new-ddns-provider/428/2
> 
> Christof
> 
> 
> 
> 
> 
> <add_key_systems_ddns.patch>

I will make an exception here now and still give you my thoughts :)

It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.

Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.

Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.

In the end I think this provider could look like “myonlineportal”: https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274

Best,
-Michael
Christof Weniger Nov. 28, 2019, 1:03 p.m. UTC | #2
Hello Michael,

after change to DynDNS class I got the following "DDNSUpdateError"
Nov 28 13:42:17 minusrouter ddns[23192]: Dynamic DNS update for
ovpn.XXXXX.YYY (dynamicdns.key-systems.net) failed:
Nov 28 13:42:17 minusrouter ddns[23192]:   DDNSUpdateError: The update
could not be performed
Nov 28 13:42:17 minusrouter ddns[23192]:   Server response: [RESPONSE]
code = 200 description = Command completed successfully queuetime = 0
runtime = 0.058 EOF

The DynDNS2 code (generating the ERROR):

class DDNSProviderKEYSYSTEMS(DDNSProtocolDynDNS2, DDNSProvider):
         handle    = "dynamicdns.key-systems.net"
         name      = "dynamicdns.key-systems.net"
         website   = "https://domaindiscount24.com/"
         #protocols = ("ipv4",)

         # There are only information provided by the domaindiscount24 how to
         # perform an update with HTTP APIs
         # https://www.domaindiscount24.com/faq/dynamic-dns
         # examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
         #           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x

         url = "https://dynamicdns.key-systems.net/update.php"

         def prepare_request_data(self, proto):
                 address = self.get_address(proto)
                 data = {
                         "hostname"      : self.hostname,
                         "password"      : self.password,
                         "ip"            : address,
                         "mx"            : address,
                 }

                 return data


The server response to a simple wget request was:
[RESPONSE]
code = 200
description = Command completed successfully
queuetime = 0
runtime = 0.053
EOF


The working code:

class DDNSProviderKEYSYSTEMS(DDNSProvider):
         handle    = "dynamicdns.key-systems.net"
         name      = "dynamicdns.key-systems.net"
         website   = "https://domaindiscount24.com/"
         protocols = ("ipv4",)

         # There are only information provided by the domaindiscount24 how to
         # perform an update with HTTP APIs
         # https://www.domaindiscount24.com/faq/dynamic-dns
         # examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
         #           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x

         url = "https://dynamicdns.key-systems.net/update.php"
         can_remove_records = False

         #def prepare_request_data(self, proto):
         def update_protocol(self, proto):
                 address = self.get_address(proto)
                 data = {
                         "hostname"      : self.hostname,
                         "password"      : self.password,
                         "ip"            : address,
                         "mx"            : address,
                 }

                 # Send update to the server.
                 response = self.send_request(self.url, data=data)

                 # Handle success messages.
                 if response.code == 200:
                         return

                 # If we got here, some other update error happened.
                 raise DDNSUpdateError

                 #return data


> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
I couldn't find any more pointers on the providers page either, and for that testing I would have to dig in too deep (into the code and the protocols) for me to handle at the moment. (maybe next week/month).

best
Christof

On 28/11/2019 12:20, Michael Tremer wrote:
> Hello Christof,
>
>> On 28 Nov 2019, at 10:45, Christof Weniger <ChristofWeniger@gmx.at> wrote:
>>
>> Hi,
>>
>> I hope this is the correct way to submit this patch.
> Yes, you found the right place.
>
> It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.
>
>> https://www.domaindiscount24.com/ has its own ddns service runnning,
>> which (for me) gets rid of the necessity of having to use an extra
>> service for that.
>>
>> I tested the following patch on my system at home, and attached it to
>> this mail.
>>
>> I started my quest at the community forum:
>> https://community.ipfire.org/t/adding-new-ddns-provider/428/2
>>
>> Christof
>>
>>
>>
>>
>>
>> <add_key_systems_ddns.patch>
> I will make an exception here now and still give you my thoughts :)
>
> It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.
>
> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
>
> Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.
>
> In the end I think this provider could look like “myonlineportal”: https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274
>
> Best,
> -Michael
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hello Michael,<br>
      <br>
      after change to DynDNS class I got the following "DDNSUpdateError"<br>
      Nov 28 13:42:17 minusrouter ddns[23192]: Dynamic DNS update for
      ovpn.XXXXX.YYY (dynamicdns.key-systems.net) failed:<br>
      Nov 28 13:42:17 minusrouter ddns[23192]:   DDNSUpdateError: The
      update could not be performed<br>
      Nov 28 13:42:17 minusrouter ddns[23192]:   Server response:
      [RESPONSE] code = 200 description = Command completed successfully
      queuetime = 0 runtime = 0.058 EOF <br>
      <br>
      The DynDNS2 code (generating the ERROR):<br>
      <pre>class DDNSProviderKEYSYSTEMS(DDNSProtocolDynDNS2, DDNSProvider):
        handle    = "dynamicdns.key-systems.net"
        name      = "dynamicdns.key-systems.net"
        website   = <a class="moz-txt-link-rfc2396E" href="https://domaindiscount24.com/">"https://domaindiscount24.com/"</a>
        #protocols = ("ipv4",)

        # There are only information provided by the domaindiscount24 how to
        # perform an update with HTTP APIs
        # <a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/faq/dynamic-dns">https://www.domaindiscount24.com/faq/dynamic-dns</a>
        # examples: <a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto</a>
        #           <a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x</a>

        url = <a class="moz-txt-link-rfc2396E" href="https://dynamicdns.key-systems.net/update.php">"https://dynamicdns.key-systems.net/update.php"</a>

        def prepare_request_data(self, proto):
                address = self.get_address(proto)
                data = {
                        "hostname"      : self.hostname,
                        "password"      : self.password,
                        "ip"            : address,
                        "mx"            : address,
                }

                return data
</pre>
      <br>
      The server response to a simple wget request was:<br>
      [RESPONSE]<br>
      code = 200<br>
      description = Command completed successfully<br>
      queuetime = 0<br>
      runtime = 0.053<br>
      EOF<br>
      <br>
      <br>
      The working code:<br>
      <br>
      <pre>class DDNSProviderKEYSYSTEMS(DDNSProvider):
        handle    = "dynamicdns.key-systems.net"
        name      = "dynamicdns.key-systems.net"
        website   = <a class="moz-txt-link-rfc2396E" href="https://domaindiscount24.com/">"https://domaindiscount24.com/"</a>
        protocols = ("ipv4",)

        # There are only information provided by the domaindiscount24 how to
        # perform an update with HTTP APIs
        # <a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/faq/dynamic-dns">https://www.domaindiscount24.com/faq/dynamic-dns</a>
        # examples: <a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto</a>
        #           <a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x</a>

        url = <a class="moz-txt-link-rfc2396E" href="https://dynamicdns.key-systems.net/update.php">"https://dynamicdns.key-systems.net/update.php"</a>
        can_remove_records = False

        #def prepare_request_data(self, proto):
        def update_protocol(self, proto):
                address = self.get_address(proto)
                data = {
                        "hostname"      : self.hostname,
                        "password"      : self.password,
                        "ip"            : address,
                        "mx"            : address,
                }

                # Send update to the server.
                response = self.send_request(self.url, data=data)

                # Handle success messages.
                if response.code == 200:
                        return

                # If we got here, some other update error happened.
                raise DDNSUpdateError

                #return data
</pre>
      <br>
      <pre class="moz-quote-pre" wrap=""><blockquote type="cite"><pre class="moz-quote-pre" wrap="">Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.</pre></blockquote>I couldn't find any more pointers on the providers page either, and for that testing I would have to dig in too deep (into the code and the protocols) for me to handle at the moment. (maybe next week/month).

</pre>
      best<br>
      Christof<br>
      <br>
      On 28/11/2019 12:20, Michael Tremer wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:4143661B-9526-49CE-AECD-7FD2E03D0DF7@ipfire.org">
      <pre class="moz-quote-pre" wrap="">Hello Christof,

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">On 28 Nov 2019, at 10:45, Christof Weniger <a class="moz-txt-link-rfc2396E" href="mailto:ChristofWeniger@gmx.at">&lt;ChristofWeniger@gmx.at&gt;</a> wrote:

Hi,

I hope this is the correct way to submit this patch.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Yes, you found the right place.

It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap=""><a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/">https://www.domaindiscount24.com/</a> has its own ddns service runnning,
which (for me) gets rid of the necessity of having to use an extra
service for that.

I tested the following patch on my system at home, and attached it to
this mail.

I started my quest at the community forum:
<a class="moz-txt-link-freetext" href="https://community.ipfire.org/t/adding-new-ddns-provider/428/2">https://community.ipfire.org/t/adding-new-ddns-provider/428/2</a>

Christof





&lt;add_key_systems_ddns.patch&gt;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I will make an exception here now and still give you my thoughts :)

It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.

Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.

Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.

In the end I think this provider could look like “myonlineportal”: <a class="moz-txt-link-freetext" href="https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274">https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274</a>

Best,
-Michael</pre>
    </blockquote>
    <br>
  </body>
</html>
Michael Tremer Nov. 28, 2019, 1:35 p.m. UTC | #3
Hi,

Thanks for testing this. Looks like I was very wrong here.

> On 28 Nov 2019, at 13:03, Christof Weniger <ChristofWeniger@gmx.at> wrote:
> 
> Hello Michael,
> 
> after change to DynDNS class I got the following "DDNSUpdateError"
> Nov 28 13:42:17 minusrouter ddns[23192]: Dynamic DNS update for ovpn.XXXXX.YYY (dynamicdns.key-systems.net) failed:
> Nov 28 13:42:17 minusrouter ddns[23192]:   DDNSUpdateError: The update could not be performed
> Nov 28 13:42:17 minusrouter ddns[23192]:   Server response: [RESPONSE] code = 200 description = Command completed successfully queuetime = 0 runtime = 0.058 EOF 
> 
> The DynDNS2 code (generating the ERROR):
> class DDNSProviderKEYSYSTEMS(DDNSProtocolDynDNS2, DDNSProvider):
>         handle    = "dynamicdns.key-systems.net"
>         name      = "dynamicdns.key-systems.net"
>         website   = 
> "https://domaindiscount24.com/"
> 
>         #protocols = ("ipv4",)
> 
>         # There are only information provided by the domaindiscount24 how to
>         # perform an update with HTTP APIs
>         # 
> https://www.domaindiscount24.com/faq/dynamic-dns
> 
>         # examples: 
> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
> 
>         #           
> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
> 
> 
>         url = 
> "https://dynamicdns.key-systems.net/update.php"
> 
> 
>         def prepare_request_data(self, proto):
>                 address = self.get_address(proto)
>                 data = {
>                         "hostname"      : self.hostname,
>                         "password"      : self.password,
>                         "ip"            : address,
>                         "mx"            : address,

I wouldn’t set the MX record here. First of all it should not contain an IP address and so it can be statically configured. I consider this being outside of the scope of ddns.

>                 }
> 
>                 return data
> 
> 
> The server response to a simple wget request was:
> [RESPONSE]
> code = 200
> description = Command completed successfully
> queuetime = 0
> runtime = 0.053
> EOF
> 
> 
> The working code:
> 
> class DDNSProviderKEYSYSTEMS(DDNSProvider):
>         handle    = "dynamicdns.key-systems.net"
>         name      = "dynamicdns.key-systems.net"
>         website   = 
> "https://domaindiscount24.com/"
> 
>         protocols = ("ipv4",)
> 
>         # There are only information provided by the domaindiscount24 how to
>         # perform an update with HTTP APIs
>         # 
> https://www.domaindiscount24.com/faq/dynamic-dns
> 
>         # examples: 
> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
> 
>         #           
> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
> 
> 
>         url = 
> "https://dynamicdns.key-systems.net/update.php"
> 
>         can_remove_records = False
> 
>         #def prepare_request_data(self, proto):
>         def update_protocol(self, proto):
>                 address = self.get_address(proto)
>                 data = {
>                         "hostname"      : self.hostname,
>                         "password"      : self.password,
>                         "ip"            : address,
>                         "mx"            : address,

See above.

>                 }
> 
>                 # Send update to the server.
>                 response = self.send_request(self.url, data=data)
> 
>                 # Handle success messages.
>                 if response.code == 200:
>                         return

This is just very vage.

> 
>                 # If we got here, some other update error happened.
>                 raise DDNSUpdateError

There must be other responses - one might hope.

Did you check sending an incorrect password and do you get 401 or 403 at least?

> 
>                 #return data
> 
> 
>> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
> I couldn't find any more pointers on the providers page either, and for that testing I would have to dig in too deep (into the code and the protocols) for me to handle at the moment. (maybe next week/month).

Yes, so great to not have any documentation… 

-Michael

> 
> 
> best
> Christof
> 
> On 28/11/2019 12:20, Michael Tremer wrote:
>> Hello Christof,
>> 
>> 
>>> On 28 Nov 2019, at 10:45, Christof Weniger <ChristofWeniger@gmx.at>
>>>  wrote:
>>> 
>>> Hi,
>>> 
>>> I hope this is the correct way to submit this patch.
>>> 
>> Yes, you found the right place.
>> 
>> It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.
>> 
>> 
>>> https://www.domaindiscount24.com/
>>>  has its own ddns service runnning,
>>> which (for me) gets rid of the necessity of having to use an extra
>>> service for that.
>>> 
>>> I tested the following patch on my system at home, and attached it to
>>> this mail.
>>> 
>>> I started my quest at the community forum:
>>> 
>>> https://community.ipfire.org/t/adding-new-ddns-provider/428/2
>>> 
>>> 
>>> Christof
>>> 
>>> 
>>> 
>>> 
>>> 
>>> <add_key_systems_ddns.patch>
>>> 
>> I will make an exception here now and still give you my thoughts :)
>> 
>> It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.
>> 
>> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
>> 
>> Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.
>> 
>> In the end I think this provider could look like “myonlineportal”: 
>> https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274
>> 
>> 
>> Best,
>> -Michael
>> 
>
Christof Weniger Nov. 28, 2019, 2:58 p.m. UTC | #4
Hi,

OK I removed the mx entry (I was not aware, that there can be a FQDN
instead of an IP)

I did some more tests and it seems the server always responds with HTTP 200

In error cases (wrong Password, wrong url) I got the following responses:

  * wrong url:

Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed

  * wrong password:

Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed; invalid password

  * after too many tries:

Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed; abuse prevention triggered; please wait 1763 seconds to resubmit


the new patch:

diff --git a/README b/README
index c75c448..b6decb3 100644
--- a/README
+++ b/README
@@ -72,6 +72,7 @@ SUPPORTED PROVIDERS:
  	inwx.com|de|at|ch|es
  	itsdns.de
  	joker.com
+	key-systems.net
  	loopia.se
  	myonlineportal.net
  	namecheap.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 661fbcc..f70f49a 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1204,6 +1204,52 @@ class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
  		url = "https://svc.joker.com/nic/update"


+class DDNSProviderKEYSYSTEMS(DDNSProvider):
+	handle    = "key-systems.net"
+	name      = "dynamicdns.key-systems.net"
+	website   = "https://domaindiscount24.com/"
+	protocols = ("ipv4",)
+
+	# There are only information provided by the domaindiscount24 how to
+	# perform an update with HTTP APIs
+	# https://www.domaindiscount24.com/faq/dynamic-dns
+	# examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
+	#           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
+
+	url = "https://dynamicdns.key-systems.net/update.php"
+	can_remove_records = False
+
+	def update_protocol(self, proto):
+		address = self.get_address(proto)
+		data = {
+			"hostname"      : self.hostname,
+			"password"      : self.password,
+			"ip"            : address,
+		}
+
+		# Send update to the server.
+		response = self.send_request(self.url, data=data)
+
+		# Get the full response message.
+		output = response.read()
+
+		# Handle success messages.
+		if "code = 200" in output:
+			return
+
+		# Handle error messages.
+		if "abuse prevention triggered" in output:
+			raise DDNSRequestError(_("Too many failed requests"))
+		if "invalid password" in output:
+			raise DDNSAuthenticationError
+		elif "Authorization failed" in output:
+			raise DDNSRequestError(_("Invalid hostname specified"))
+
+		# If we got here, some other update error happened.
+		raise DDNSUpdateError
+
+
+
  class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
          handle    = "domains.google.com"
          name      = "Google Domains"

best
Christof

On 28/11/2019 14:35, Michael Tremer wrote:
> Hi,
>
> Thanks for testing this. Looks like I was very wrong here.
>
>> On 28 Nov 2019, at 13:03, Christof Weniger <ChristofWeniger@gmx.at> wrote:
>>
>> Hello Michael,
>>
>> after change to DynDNS class I got the following "DDNSUpdateError"
>> Nov 28 13:42:17 minusrouter ddns[23192]: Dynamic DNS update for ovpn.XXXXX.YYY (dynamicdns.key-systems.net) failed:
>> Nov 28 13:42:17 minusrouter ddns[23192]:   DDNSUpdateError: The update could not be performed
>> Nov 28 13:42:17 minusrouter ddns[23192]:   Server response: [RESPONSE] code = 200 description = Command completed successfully queuetime = 0 runtime = 0.058 EOF
>>
>> The DynDNS2 code (generating the ERROR):
>> class DDNSProviderKEYSYSTEMS(DDNSProtocolDynDNS2, DDNSProvider):
>>          handle    = "dynamicdns.key-systems.net"
>>          name      = "dynamicdns.key-systems.net"
>>          website   =
>> "https://domaindiscount24.com/"
>>
>>          #protocols = ("ipv4",)
>>
>>          # There are only information provided by the domaindiscount24 how to
>>          # perform an update with HTTP APIs
>>          #
>> https://www.domaindiscount24.com/faq/dynamic-dns
>>
>>          # examples:
>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
>>
>>          #
>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
>>
>>
>>          url =
>> "https://dynamicdns.key-systems.net/update.php"
>>
>>
>>          def prepare_request_data(self, proto):
>>                  address = self.get_address(proto)
>>                  data = {
>>                          "hostname"      : self.hostname,
>>                          "password"      : self.password,
>>                          "ip"            : address,
>>                          "mx"            : address,
> I wouldn’t set the MX record here. First of all it should not contain an IP address and so it can be statically configured. I consider this being outside of the scope of ddns.
>
>>                  }
>>
>>                  return data
>>
>>
>> The server response to a simple wget request was:
>> [RESPONSE]
>> code = 200
>> description = Command completed successfully
>> queuetime = 0
>> runtime = 0.053
>> EOF
>>
>>
>> The working code:
>>
>> class DDNSProviderKEYSYSTEMS(DDNSProvider):
>>          handle    = "dynamicdns.key-systems.net"
>>          name      = "dynamicdns.key-systems.net"
>>          website   =
>> "https://domaindiscount24.com/"
>>
>>          protocols = ("ipv4",)
>>
>>          # There are only information provided by the domaindiscount24 how to
>>          # perform an update with HTTP APIs
>>          #
>> https://www.domaindiscount24.com/faq/dynamic-dns
>>
>>          # examples:
>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
>>
>>          #
>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
>>
>>
>>          url =
>> "https://dynamicdns.key-systems.net/update.php"
>>
>>          can_remove_records = False
>>
>>          #def prepare_request_data(self, proto):
>>          def update_protocol(self, proto):
>>                  address = self.get_address(proto)
>>                  data = {
>>                          "hostname"      : self.hostname,
>>                          "password"      : self.password,
>>                          "ip"            : address,
>>                          "mx"            : address,
> See above.
>
>>                  }
>>
>>                  # Send update to the server.
>>                  response = self.send_request(self.url, data=data)
>>
>>                  # Handle success messages.
>>                  if response.code == 200:
>>                          return
> This is just very vage.
>
>>                  # If we got here, some other update error happened.
>>                  raise DDNSUpdateError
> There must be other responses - one might hope.
>
> Did you check sending an incorrect password and do you get 401 or 403 at least?
>
>>                  #return data
>>
>>
>>> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
>> I couldn't find any more pointers on the providers page either, and for that testing I would have to dig in too deep (into the code and the protocols) for me to handle at the moment. (maybe next week/month).
> Yes, so great to not have any documentation…
>
> -Michael
>
>>
>> best
>> Christof
>>
>> On 28/11/2019 12:20, Michael Tremer wrote:
>>> Hello Christof,
>>>
>>>
>>>> On 28 Nov 2019, at 10:45, Christof Weniger <ChristofWeniger@gmx.at>
>>>>   wrote:
>>>>
>>>> Hi,
>>>>
>>>> I hope this is the correct way to submit this patch.
>>>>
>>> Yes, you found the right place.
>>>
>>> It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.
>>>
>>>
>>>> https://www.domaindiscount24.com/
>>>>   has its own ddns service runnning,
>>>> which (for me) gets rid of the necessity of having to use an extra
>>>> service for that.
>>>>
>>>> I tested the following patch on my system at home, and attached it to
>>>> this mail.
>>>>
>>>> I started my quest at the community forum:
>>>>
>>>> https://community.ipfire.org/t/adding-new-ddns-provider/428/2
>>>>
>>>>
>>>> Christof
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> <add_key_systems_ddns.patch>
>>>>
>>> I will make an exception here now and still give you my thoughts :)
>>>
>>> It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.
>>>
>>> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
>>>
>>> Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.
>>>
>>> In the end I think this provider could look like “myonlineportal”:
>>> https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274
>>>
>>>
>>> Best,
>>> -Michael
>>>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      OK I removed the mx entry (I was not aware, that there can be a
      FQDN instead of an IP)<br>
      <br>
      I did some more tests and it seems the server always responds with
      HTTP 200<br>
      <br>
      In error cases (wrong Password, wrong url) I got the following
      responses:<br>
      <ul>
        <li>wrong url:</li>
      </ul>
      <pre>Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed
</pre>
      <ul>
        <li>wrong password:</li>
      </ul>
      <pre>Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed; invalid password
</pre>
      <ul>
        <li>after too many tries:<br>
        </li>
      </ul>
      <pre>Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed; abuse prevention triggered; please wait 1763 seconds to resubmit


</pre>
      the new patch:<br>
      <pre>diff --git a/README b/README
index c75c448..b6decb3 100644
--- a/README
+++ b/README
@@ -72,6 +72,7 @@ SUPPORTED PROVIDERS:
 	inwx.com|de|at|ch|es
 	itsdns.de
 	joker.com
+	key-systems.net
 	loopia.se
 	myonlineportal.net
 	namecheap.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 661fbcc..f70f49a 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1204,6 +1204,52 @@ class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
 		url = <a class="moz-txt-link-rfc2396E" href="https://svc.joker.com/nic/update">"https://svc.joker.com/nic/update"</a>


+class DDNSProviderKEYSYSTEMS(DDNSProvider):
+	handle    = "key-systems.net"
+	name      = "dynamicdns.key-systems.net"
+	website   = <a class="moz-txt-link-rfc2396E" href="https://domaindiscount24.com/">"https://domaindiscount24.com/"</a>
+	protocols = ("ipv4",)
+
+	# There are only information provided by the domaindiscount24 how to
+	# perform an update with HTTP APIs
+	# <a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/faq/dynamic-dns">https://www.domaindiscount24.com/faq/dynamic-dns</a>
+	# examples: <a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto</a>
+	#           <a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x</a>
+
+	url = <a class="moz-txt-link-rfc2396E" href="https://dynamicdns.key-systems.net/update.php">"https://dynamicdns.key-systems.net/update.php"</a>
+	can_remove_records = False
+
+	def update_protocol(self, proto):
+		address = self.get_address(proto)
+		data = {
+			"hostname"      : self.hostname,
+			"password"      : self.password,
+			"ip"            : address,
+		}
+
+		# Send update to the server.
+		response = self.send_request(self.url, data=data)
+
+		# Get the full response message.
+		output = response.read()
+
+		# Handle success messages.
+		if "code = 200" in output:
+			return
+
+		# Handle error messages.
+		if "abuse prevention triggered" in output:
+			raise DDNSRequestError(_("Too many failed requests"))
+		if "invalid password" in output:
+			raise DDNSAuthenticationError
+		elif "Authorization failed" in output:
+			raise DDNSRequestError(_("Invalid hostname specified"))
+
+		# If we got here, some other update error happened.
+		raise DDNSUpdateError
+
+
+
 class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
         handle    = "domains.google.com"
         name      = "Google Domains"
</pre>
      <pre>
</pre>
      best<br>
      Christof<br>
      <br>
      On 28/11/2019 14:35, Michael Tremer wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:A5EAE6C1-8701-45D8-B643-F83577552DC7@ipfire.org">
      <pre class="moz-quote-pre" wrap="">Hi,

Thanks for testing this. Looks like I was very wrong here.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">On 28 Nov 2019, at 13:03, Christof Weniger <a class="moz-txt-link-rfc2396E" href="mailto:ChristofWeniger@gmx.at">&lt;ChristofWeniger@gmx.at&gt;</a> wrote:

Hello Michael,

after change to DynDNS class I got the following "DDNSUpdateError"
Nov 28 13:42:17 minusrouter ddns[23192]: Dynamic DNS update for ovpn.XXXXX.YYY (dynamicdns.key-systems.net) failed:
Nov 28 13:42:17 minusrouter ddns[23192]:   DDNSUpdateError: The update could not be performed
Nov 28 13:42:17 minusrouter ddns[23192]:   Server response: [RESPONSE] code = 200 description = Command completed successfully queuetime = 0 runtime = 0.058 EOF

The DynDNS2 code (generating the ERROR):
class DDNSProviderKEYSYSTEMS(DDNSProtocolDynDNS2, DDNSProvider):
        handle    = "dynamicdns.key-systems.net"
        name      = "dynamicdns.key-systems.net"
        website   =
<a class="moz-txt-link-rfc2396E" href="https://domaindiscount24.com/">"https://domaindiscount24.com/"</a>

        #protocols = ("ipv4",)

        # There are only information provided by the domaindiscount24 how to
        # perform an update with HTTP APIs
        #
<a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/faq/dynamic-dns">https://www.domaindiscount24.com/faq/dynamic-dns</a>

        # examples:
<a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto</a>

        #
<a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x</a>


        url =
<a class="moz-txt-link-rfc2396E" href="https://dynamicdns.key-systems.net/update.php">"https://dynamicdns.key-systems.net/update.php"</a>


        def prepare_request_data(self, proto):
                address = self.get_address(proto)
                data = {
                        "hostname"      : self.hostname,
                        "password"      : self.password,
                        "ip"            : address,
                        "mx"            : address,
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I wouldn’t set the MX record here. First of all it should not contain an IP address and so it can be statically configured. I consider this being outside of the scope of ddns.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">                }

                return data


The server response to a simple wget request was:
[RESPONSE]
code = 200
description = Command completed successfully
queuetime = 0
runtime = 0.053
EOF


The working code:

class DDNSProviderKEYSYSTEMS(DDNSProvider):
        handle    = "dynamicdns.key-systems.net"
        name      = "dynamicdns.key-systems.net"
        website   =
<a class="moz-txt-link-rfc2396E" href="https://domaindiscount24.com/">"https://domaindiscount24.com/"</a>

        protocols = ("ipv4",)

        # There are only information provided by the domaindiscount24 how to
        # perform an update with HTTP APIs
        #
<a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/faq/dynamic-dns">https://www.domaindiscount24.com/faq/dynamic-dns</a>

        # examples:
<a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=auto</a>

        #
<a class="moz-txt-link-freetext" href="https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x">https://dynamicdns.key-systems.net/update.php?hostname=hostname&amp;password=password&amp;ip=213.x.x.x&amp;mx=213.x.x.x</a>


        url =
<a class="moz-txt-link-rfc2396E" href="https://dynamicdns.key-systems.net/update.php">"https://dynamicdns.key-systems.net/update.php"</a>

        can_remove_records = False

        #def prepare_request_data(self, proto):
        def update_protocol(self, proto):
                address = self.get_address(proto)
                data = {
                        "hostname"      : self.hostname,
                        "password"      : self.password,
                        "ip"            : address,
                        "mx"            : address,
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
See above.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">                }

                # Send update to the server.
                response = self.send_request(self.url, data=data)

                # Handle success messages.
                if response.code == 200:
                        return
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
This is just very vage.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
                # If we got here, some other update error happened.
                raise DDNSUpdateError
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
There must be other responses - one might hope.

Did you check sending an incorrect password and do you get 401 or 403 at least?

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
                #return data


</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">I couldn't find any more pointers on the providers page either, and for that testing I would have to dig in too deep (into the code and the protocols) for me to handle at the moment. (maybe next week/month).
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Yes, so great to not have any documentation…

-Michael

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">

best
Christof

On 28/11/2019 12:20, Michael Tremer wrote:
</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">Hello Christof,


</pre>
          <blockquote type="cite">
            <pre class="moz-quote-pre" wrap="">On 28 Nov 2019, at 10:45, Christof Weniger <a class="moz-txt-link-rfc2396E" href="mailto:ChristofWeniger@gmx.at">&lt;ChristofWeniger@gmx.at&gt;</a>
 wrote:

Hi,

I hope this is the correct way to submit this patch.

</pre>
          </blockquote>
          <pre class="moz-quote-pre" wrap="">Yes, you found the right place.

It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.


</pre>
          <blockquote type="cite">
            <pre class="moz-quote-pre" wrap=""><a class="moz-txt-link-freetext" href="https://www.domaindiscount24.com/">https://www.domaindiscount24.com/</a>
 has its own ddns service runnning,
which (for me) gets rid of the necessity of having to use an extra
service for that.

I tested the following patch on my system at home, and attached it to
this mail.

I started my quest at the community forum:

<a class="moz-txt-link-freetext" href="https://community.ipfire.org/t/adding-new-ddns-provider/428/2">https://community.ipfire.org/t/adding-new-ddns-provider/428/2</a>


Christof





&lt;add_key_systems_ddns.patch&gt;

</pre>
          </blockquote>
          <pre class="moz-quote-pre" wrap="">I will make an exception here now and still give you my thoughts :)

It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.

Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.

Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.

In the end I think this provider could look like “myonlineportal”:
<a class="moz-txt-link-freetext" href="https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274">https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274</a>


Best,
-Michael

</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>
diff --git a/README b/README
index c75c448..b6decb3 100644
--- a/README
+++ b/README
@@ -72,6 +72,7 @@ SUPPORTED PROVIDERS:
 	inwx.com|de|at|ch|es
 	itsdns.de
 	joker.com
+	key-systems.net
 	loopia.se
 	myonlineportal.net
 	namecheap.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 661fbcc..f70f49a 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1204,6 +1204,52 @@ class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
 		url = "https://svc.joker.com/nic/update"


+class DDNSProviderKEYSYSTEMS(DDNSProvider):
+	handle    = "key-systems.net"
+	name      = "dynamicdns.key-systems.net"
+	website   = "https://domaindiscount24.com/"
+	protocols = ("ipv4",)
+
+	# There are only information provided by the domaindiscount24 how to
+	# perform an update with HTTP APIs
+	# https://www.domaindiscount24.com/faq/dynamic-dns
+	# examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
+	#           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
+
+	url = "https://dynamicdns.key-systems.net/update.php"
+	can_remove_records = False
+
+	def update_protocol(self, proto):
+		address = self.get_address(proto)
+		data = {
+			"hostname"      : self.hostname,
+			"password"      : self.password,
+			"ip"            : address,
+		}
+
+		# Send update to the server.
+		response = self.send_request(self.url, data=data)
+
+		# Get the full response message.
+		output = response.read()
+
+		# Handle success messages.
+		if "code = 200" in output:
+			return
+
+		# Handle error messages.
+		if "abuse prevention triggered" in output:
+			raise DDNSRequestError(_("Too many failed requests"))
+		if "invalid password" in output:
+			raise DDNSAuthenticationError
+		elif "Authorization failed" in output:
+			raise DDNSRequestError(_("Invalid hostname specified"))
+
+		# If we got here, some other update error happened.
+		raise DDNSUpdateError
+
+
+
 class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
         handle    = "domains.google.com"
         name      = "Google Domains"
Michael Tremer Nov. 28, 2019, 3:17 p.m. UTC | #5
Hi,

> On 28 Nov 2019, at 14:58, Christof Weniger <ChristofWeniger@gmx.at> wrote:
> 
> Hi,
> 
> OK I removed the mx entry (I was not aware, that there can be a FQDN instead of an IP)
> 
> I did some more tests and it seems the server always responds with HTTP 200

That is horrible :)

> In error cases (wrong Password, wrong url) I got the following responses:
> 	• wrong url:
> Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed
> 
> 	• wrong password:
> Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed; invalid password
> 
> 	• after too many tries:
> Error: Permanent error in command 'UpdateDynamicDNS': Authorization failed; abuse prevention triggered; please wait 1763 seconds to resubmit
> 
> 
> 
> the new patch:
> diff --git a/README b/README
> index c75c448..b6decb3 100644
> --- a/README
> +++ b/README
> @@ -72,6 +72,7 @@ SUPPORTED PROVIDERS:
>  	inwx.com|de|at|ch|es
>  	itsdns.de
>  	joker.com
> +	key-systems.net
>  	loopia.se
>  	myonlineportal.net
>  	namecheap.com
> diff --git a/src/ddns/providers.py b/src/ddns/providers.py
> index 661fbcc..f70f49a 100644
> --- a/src/ddns/providers.py
> +++ b/src/ddns/providers.py
> @@ -1204,6 +1204,52 @@ class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
>  		url = 
> "https://svc.joker.com/nic/update"
> 
> 
> 
> +class DDNSProviderKEYSYSTEMS(DDNSProvider):
> +	handle    = "key-systems.net"
> +	name      = "dynamicdns.key-systems.net"
> +	website   = 
> "https://domaindiscount24.com/"
> 
> +	protocols = ("ipv4",)
> +
> +	# There are only information provided by the domaindiscount24 how to
> +	# perform an update with HTTP APIs
> +	# 
> https://www.domaindiscount24.com/faq/dynamic-dns
> 
> +	# examples: 
> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
> 
> +	#           
> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
> 
> +
> +	url = 
> "https://dynamicdns.key-systems.net/update.php"
> 
> +	can_remove_records = False
> +
> +	def update_protocol(self, proto):
> +		address = self.get_address(proto)
> +		data = {
> +			"hostname"      : self.hostname,
> +			"password"      : self.password,
> +			"ip"            : address,
> +		}
> +
> +		# Send update to the server.
> +		response = self.send_request(self.url, data=data)
> +
> +		# Get the full response message.
> +		output = response.read()
> +
> +		# Handle success messages.
> +		if "code = 200" in output:
> +			return
> +
> +		# Handle error messages.
> +		if "abuse prevention triggered" in output:
> +			raise DDNSRequestError(_("Too many failed requests"))

We have DDNSAbuseError which should be raised here. There is no need for any extra messages here.

> +		if "invalid password" in output:
> +			raise DDNSAuthenticationError

This could be an elif as well.

> +		elif "Authorization failed" in output:
> +			raise DDNSRequestError(_("Invalid hostname specified"))

Also it is very great that they are telling an attacker what they have guessed correctly.

> +		# If we got here, some other update error happened.
> +		raise DDNSUpdateError

So this was an inline patch now. Good. It is very nice to be able to comment on individual sections and lines.

However, there should be more meta information (like who sent the patch and a commit message).

Did you ever use git send-email?

  https://wiki.ipfire.org/devel/submit-patches
  https://wiki.ipfire.org/devel/git/setup

Best,
-Michael

> +
> +
> +
>  class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
>          handle    = "domains.google.com"
>          name      = "Google Domains"
> 
> best
> Christof
> 
> On 28/11/2019 14:35, Michael Tremer wrote:
>> Hi,
>> 
>> Thanks for testing this. Looks like I was very wrong here.
>> 
>> 
>>> On 28 Nov 2019, at 13:03, Christof Weniger <ChristofWeniger@gmx.at>
>>>  wrote:
>>> 
>>> Hello Michael,
>>> 
>>> after change to DynDNS class I got the following "DDNSUpdateError"
>>> Nov 28 13:42:17 minusrouter ddns[23192]: Dynamic DNS update for ovpn.XXXXX.YYY (dynamicdns.key-systems.net) failed:
>>> Nov 28 13:42:17 minusrouter ddns[23192]:   DDNSUpdateError: The update could not be performed
>>> Nov 28 13:42:17 minusrouter ddns[23192]:   Server response: [RESPONSE] code = 200 description = Command completed successfully queuetime = 0 runtime = 0.058 EOF
>>> 
>>> The DynDNS2 code (generating the ERROR):
>>> class DDNSProviderKEYSYSTEMS(DDNSProtocolDynDNS2, DDNSProvider):
>>>         handle    = "dynamicdns.key-systems.net"
>>>         name      = "dynamicdns.key-systems.net"
>>>         website   =
>>> 
>>> "https://domaindiscount24.com/"
>>> 
>>> 
>>>         #protocols = ("ipv4",)
>>> 
>>>         # There are only information provided by the domaindiscount24 how to
>>>         # perform an update with HTTP APIs
>>>         #
>>> 
>>> https://www.domaindiscount24.com/faq/dynamic-dns
>>> 
>>> 
>>>         # examples:
>>> 
>>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
>>> 
>>> 
>>>         #
>>> 
>>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
>>> 
>>> 
>>> 
>>>         url =
>>> 
>>> "https://dynamicdns.key-systems.net/update.php"
>>> 
>>> 
>>> 
>>>         def prepare_request_data(self, proto):
>>>                 address = self.get_address(proto)
>>>                 data = {
>>>                         "hostname"      : self.hostname,
>>>                         "password"      : self.password,
>>>                         "ip"            : address,
>>>                         "mx"            : address,
>>> 
>> I wouldn’t set the MX record here. First of all it should not contain an IP address and so it can be statically configured. I consider this being outside of the scope of ddns.
>> 
>> 
>>>                 }
>>> 
>>>                 return data
>>> 
>>> 
>>> The server response to a simple wget request was:
>>> [RESPONSE]
>>> code = 200
>>> description = Command completed successfully
>>> queuetime = 0
>>> runtime = 0.053
>>> EOF
>>> 
>>> 
>>> The working code:
>>> 
>>> class DDNSProviderKEYSYSTEMS(DDNSProvider):
>>>         handle    = "dynamicdns.key-systems.net"
>>>         name      = "dynamicdns.key-systems.net"
>>>         website   =
>>> 
>>> "https://domaindiscount24.com/"
>>> 
>>> 
>>>         protocols = ("ipv4",)
>>> 
>>>         # There are only information provided by the domaindiscount24 how to
>>>         # perform an update with HTTP APIs
>>>         #
>>> 
>>> https://www.domaindiscount24.com/faq/dynamic-dns
>>> 
>>> 
>>>         # examples:
>>> 
>>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
>>> 
>>> 
>>>         #
>>> 
>>> https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
>>> 
>>> 
>>> 
>>>         url =
>>> 
>>> "https://dynamicdns.key-systems.net/update.php"
>>> 
>>> 
>>>         can_remove_records = False
>>> 
>>>         #def prepare_request_data(self, proto):
>>>         def update_protocol(self, proto):
>>>                 address = self.get_address(proto)
>>>                 data = {
>>>                         "hostname"      : self.hostname,
>>>                         "password"      : self.password,
>>>                         "ip"            : address,
>>>                         "mx"            : address,
>>> 
>> See above.
>> 
>> 
>>>                 }
>>> 
>>>                 # Send update to the server.
>>>                 response = self.send_request(self.url, data=data)
>>> 
>>>                 # Handle success messages.
>>>                 if response.code == 200:
>>>                         return
>>> 
>> This is just very vage.
>> 
>> 
>>>                 # If we got here, some other update error happened.
>>>                 raise DDNSUpdateError
>>> 
>> There must be other responses - one might hope.
>> 
>> Did you check sending an incorrect password and do you get 401 or 403 at least?
>> 
>> 
>>>                 #return data
>>> 
>>> 
>>> 
>>>> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
>>>> 
>>> I couldn't find any more pointers on the providers page either, and for that testing I would have to dig in too deep (into the code and the protocols) for me to handle at the moment. (maybe next week/month).
>>> 
>> Yes, so great to not have any documentation…
>> 
>> -Michael
>> 
>> 
>>> 
>>> best
>>> Christof
>>> 
>>> On 28/11/2019 12:20, Michael Tremer wrote:
>>> 
>>>> Hello Christof,
>>>> 
>>>> 
>>>> 
>>>>> On 28 Nov 2019, at 10:45, Christof Weniger <ChristofWeniger@gmx.at>
>>>>> 
>>>>>  wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I hope this is the correct way to submit this patch.
>>>>> 
>>>>> 
>>>> Yes, you found the right place.
>>>> 
>>>> It would have been better to post the patch inline (and not as an attachment), so that I could have commented on it.
>>>> 
>>>> 
>>>> 
>>>>> https://www.domaindiscount24.com/
>>>>> 
>>>>>  has its own ddns service runnning,
>>>>> which (for me) gets rid of the necessity of having to use an extra
>>>>> service for that.
>>>>> 
>>>>> I tested the following patch on my system at home, and attached it to
>>>>> this mail.
>>>>> 
>>>>> I started my quest at the community forum:
>>>>> 
>>>>> 
>>>>> https://community.ipfire.org/t/adding-new-ddns-provider/428/2
>>>>> 
>>>>> 
>>>>> 
>>>>> Christof
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> <add_key_systems_ddns.patch>
>>>>> 
>>>>> 
>>>> I will make an exception here now and still give you my thoughts :)
>>>> 
>>>> It looks like this is very close to the DynDNS protocol, so you can re-use that as some other providers do.
>>>> 
>>>> Unfortunately this provider has no list of any possible responses - or maybe I have overlooked it. That can however be tested to check if those are still compatible with DynDNS.
>>>> 
>>>> Finally, you are setting the IP addresses to “auto” which probably is not a good idea. I would prefer that it is explicitly being set. There is a function for it that finds out which one is the correct IP address.
>>>> 
>>>> In the end I think this provider could look like “myonlineportal”:
>>>> 
>>>> https://git.ipfire.org/?p=ddns.git;a=blob;f=src/ddns/providers.py;h=661fbcc57a5aecba0d958ec05c26296b3cef0d70;hb=HEAD#l1274
>>>> 
>>>> 
>>>> 
>>>> Best,
>>>> -Michael
>>>> 
>>>> 
> 
> <add_key_systems_ddns.patch>

Patch

diff --git a/README b/README
index c75c448..b6decb3 100644
--- a/README
+++ b/README
@@ -72,6 +72,7 @@  SUPPORTED PROVIDERS:
 	inwx.com|de|at|ch|es
 	itsdns.de
 	joker.com
+	key-systems.net
 	loopia.se
 	myonlineportal.net
 	namecheap.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 661fbcc..ccbf5e5 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1204,6 +1204,40 @@  class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
 		url = "https://svc.joker.com/nic/update"


+class DDNSProviderKEYSYSTEMS(DDNSProvider):
+        handle    = "dynamicdns.key-systems.net"
+        name      = "dynamicdns.key-systems.net"
+        website   = "https://domaindiscount24.com/"
+        protocols = ("ipv4",)
+
+        # There are only information provided by the domaindiscount24 how to
+        # perform an update with HTTP APIs
+        # https://www.domaindiscount24.com/faq/dynamic-dns
+        # examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
+        #           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
+
+        url = "https://dynamicdns.key-systems.net/update.php"
+        can_remove_records = False
+
+        def update_protocol(self, proto):
+                data = {
+                        "hostname"      : self.hostname,
+                        "password"      : self.password,
+                        "ip"            : "auto",
+                }
+
+                # Send update to the server.
+                response = self.send_request(self.url, data=data)
+
+                # Handle success messages.
+                if response.code == 200:
+                        return
+
+                # If we got here, some other update error happened.
+                raise DDNSUpdateError
+
+
+
 class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
         handle    = "domains.google.com"
         name      = "Google Domains"