pfSense dyndns for Namecheap doesn't work with hostnames containing "."
Namecheap happily supports hostnames like www.sub.domain.com. Their Windows dyndns client also supports hostnames that include ".".
However, it appears that pfSense incorrectly determines the hostname as www and domain name as sub.domain.com instead of the hostname as www.sub and domain name domain.com. Or at least this is what I'm assuming since the log on pfSense is returning an error of domain not found in this scenario.
Jan 25 16:34:17 php: /services_dyndns_edit.php: DynDns: DynDns _update() starting.
Jan 25 16:34:17 php: /services_dyndns_edit.php: Namecheap: DNS update() starting.
Jan 25 16:34:17 php: /services_dyndns_edit.php: DynDns: DynDns _checkStatus() starting.
Jan 25 16:34:17 php: /services_dyndns_edit.php: DynDns: Current Service: namecheap
Jan 25 16:34:17 php: /services_dyndns_edit.php: DynDns debug information: x.x.x.x extracted from local system.
Jan 25 16:34:17 php: /services_dyndns_edit.php: phpDynDNS: updating cache file /conf/dyndns_wannamecheap'host.sub.domain.com'.cache: x.x.x.x
Jan 25 16:34:17 php: /services_dyndns_edit.php: phpDynDNS: (Error) Domain name not found
#1 Updated by Jim Pingle over 4 years ago
- Category set to Dynamic DNS
- Target version set to 2.1
- Affected Architecture set to All
(Copying my reply from the forum post here)
Yeah we split on ., I didn't realize their client supported that syntax.
Though that makes things a little trickier, right now it's just this:
list($hostname, $domain) = explode(".", $this->_dnsHost, 2);
To do the other way, it would have to split by making an array there and taking the last two, but then that would break things like co.uk and org.uk
I suppose because namecheap doesn't use the username field we could use that as a prefix for the host, so it would be hostname=sub.domain.org, username=www, so the whole record would end up being: host=www.sub domain=domain.com - but that's sure not intuitive...
#2 Updated by Doug Dimick over 4 years ago
It's probable that other dyndns providers also accept hostnames including dots, since it's legal A record syntax. This could be more pervasive than just Namecheap. In that case, splitting host/domain into two fields on the page for all dyndns providers would be a good solution. Much easier to just implode for providers that don't separate hostname and domain in their update syntax.
#3 Updated by Jim Pingle over 4 years ago
Except that would break everyone's current settings unless we tried to be smart with some upgrade code (which could still guess wrong).
Another way (one I'll probably commit at least for now) since Namecheap only supports .co.uk / .org.uk / .me.uk is something like this:
$dparts = explode(".", $this->_dnsHost); $domain_part_count = ($dparts[count($dparts)-1] == "uk") ? 3 : 2; $domain_offset = count($dparts) - $domain_part_count; $hostname = implode(".", array_slice($dparts, 0, $domain_offset)); $domain = implode(".", array_slice($dparts, $domain_offset));
Other providers would not be affected because none of the other providers require separate hostname and domain parameters except for Namecheap, so it would still be redesigning the whole page to support one provider.
#8 Updated by Lance Cotton about 2 years ago
Pardon me for re-opening this old bug, but I've finally gotten tired of manually updating my "dynamic" DNS entry hosted by namecheap.com's service.
My "domain" with namecheap is a delegated sub-domain, within which I have several hosts.
For example, the domain is dyn.example.com
I have a host: host1
The complete FQDN is host1.dyn.example.com
The current script, as noted in this bugfix, extracts the domain portion by counting "." characters. But that doesn't work for me, as the domain is like the .uk example, but it's a .com.
I understand the hesitation to update the GUI for just this one provider who requires the domain and host entries separated. Could perhaps a non-allowed character be used as a sentinel for the break between host and domain, and the dyndns.class file will split on that? Then the only GUI update might be an added instruction sentence for namecheap users.
For example, I might enter in the pfSense GUI the hostname host1/dyn.example.com to indicate which part is which.