Project

General

Profile

Actions

Bug #6566

closed

Cloudflare DnyDNS Update with subdomains

Added by Euan Kerr about 9 years ago. Updated about 6 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Dynamic DNS
Target version:
-
Start date:
06/30/2016
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
All
Affected Architecture:
All

Description

If a host such as ip.example.co.uk is used for the cloudflare dynamic dns update the zone_id will fail to be returned.

I believe this is due to the following code from src/etc/inc/dyndns.class:

$dnsHost = str_replace(' ', '', $this->_dnsHost);
$host_names = explode(".", $dnsHost);
$bottom_host_name = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];

as $bottom_host_name would end up as "co.uk".

Something like this:

$dnsHost = str_replace(' ', '', $this->_dnsHost);
$host_names = explode(".", $dnsHost);
if (count($host_names) > 3) {
$bottom_host_name = $host_names[count($host_names)-3] . "." . $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
} else {
$bottom_host_name = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
}

would check if the hostname contains more than three parts and would correctly retrieve the zone_id from cloudflare - I've tested it with ip.example.co.uk but my php isn't great so someone might want to improve it.

Actions #1

Updated by Euan Kerr about 9 years ago

Looking at this again - I don't think this would work for a subdomain such as ip.test.example.com.

It might be possible to use something like https://publicsuffix.org/list/ to get a list of subdomains for TLDs and do a lookup and if it's a TLD with a public subdomain then use the >3 code.

Actions #2

Updated by Jim Pingle about 6 years ago

  • Status changed from New to Duplicate

Duplicate of #6778 which was fixed years ago in 2446fffa5932e8debcaf165bfaf5492cea429c60

Actions

Also available in: Atom PDF