OPNsense Forum

Archive => 17.7 Legacy Series => Topic started by: magnust on November 15, 2017, 12:52:05 pm

Title: [SOLVED] Dyndns for provider Loopia broken
Post by: magnust on November 15, 2017, 12:52:05 pm
Hi all!

I'm a long time user of pfsense now switching over to opnsense.

The service "loopia" in dyndns is not handling wildcards properly which makes the call to update the ip instead ending up erasing the CNAME in loopias end rendering our web site unreachable.



Here's the code AFAIK in /usr/local/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc

case 'loopia':
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
   curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP);
   break;


As you can see it doesn't even check the wildcard setting.

An important note: This functionality is broken in pfsense since many years back but due to a different problem in that code. More info here https://forum.pfsense.org/index.php?topic=138826

What is the best way to get this into a todo fix list?




PS: I can't find any way to edit files from the web GUI, am I blind or is there no such option?
Title: Re: BUG: Dyndns for provider Loopia broken
Post by: franco on November 15, 2017, 01:26:50 pm
Hi Magnust,

There is no file editor on the GUI, only able to change files from the console or SSH.

Typically, broken or new dyndns, I ask for a test account access to fix the issue(s) or others provide patches themselves via GitHub, whatever works best. In one instance we did this for 2 Chinese providers. It was fun to get those working without being able to understand any of their documentation. :)

In any case, very willing to look at it. For account details, just message me via PM.


Cheers,
Franco
Title: Re: BUG: Dyndns for provider Loopia broken
Post by: magnust on November 16, 2017, 02:58:45 pm
Hey, great if it could be added/changed to this. This code is tested and works fine with Loopia and wildcard on or off:

case 'loopia':
    if (isset($this->_dnsWildcard) && $this->_dnsWildcard == TRUE) $this->_dnsWildcard = "ON"; else $this->_dnsWildcard = "OFF";            
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
    curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP . '&wildcard='.$this->_dnsWildcard);
    break;



Note! This commonly used line below should not be used, it's been tested and does NOT work:
if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";

This line is tested and DOES work:
if (isset($this->_dnsWildcard) && $this->_dnsWildcard == TRUE) $this->_dnsWildcard = "ON"; else $this->_dnsWildcard = "OFF";

More on this issue if interested found here: https://forum.pfsense.org/index.php?topic=138826


Thanks!!!




PS:
Here's how Loopia REALLY wants us to update their DynDNS:
https://support.loopia.se/wp-content/uploads/2017/02/dyndns_loopia.py_.txt
Title: Re: BUG: Dyndns for provider Loopia broken
Post by: franco on November 20, 2017, 06:32:24 am
Can you try this patch? https://github.com/opnsense/plugins/commit/8b663af

Apply from the console with:

# opnsense-patch -c plugins 8b663af


Cheers,
Franco
Title: Re: BUG: Dyndns for provider Loopia broken
Post by: magnust on November 21, 2017, 05:45:36 pm
 ;D

Works like a charm. Tried with both wildcard on and off and everything updates as it should. Beatiful!

Thank you!!!
Title: Re: BUG: Dyndns for provider Loopia broken
Post by: franco on November 22, 2017, 06:06:13 am
Hi magnust,

The update is not in 17.7.8 today, but will follow in 17.7.9, so you may need to apply the patch manually again.

Thank you for the report and testing!


Cheers,
Franco
Title: Re: [SOLVED] Dyndns for provider Loopia broken
Post by: magnust on November 22, 2017, 08:15:06 am
Thanks for the heads up on 17.7.8 and 9
Title: Re: [SOLVED] Dyndns for provider Loopia broken
Post by: franco on November 22, 2017, 01:32:42 pm
FWIW, your modifications will not be overwritten by the 17.7.8 upgrade. I tested this to make sure. :)


Cheers,
Franco
Title: Re: [SOLVED] Dyndns for provider Loopia broken
Post by: magnust on November 22, 2017, 02:06:02 pm
Ah! Making my life easy are you   ;D




EDIT: Can confirm, the edit wasn't removed by 17.7.8