Linux Make ddclient Work with Multiple Namecheap Domains

Wednesday, August 22, 2012

ddclient 3.8.1 or older will not be able to update multiple Namecheap domains.

For example, if you are trying to update domain names and and their particular hostnames, @, www, or mail, ddclient will only update the first hostname it encounters.

If your /etc/ddclient/ddclient.conf looks like the configuration below, during each update only,,, and will be updated.,, and will not be updated because those hostnames were already checked for the first domain name.

protocol=namecheap,                      \,  \                        \
password=faefjawpefoij30498320493r23     \
@, www, mail

protocol=namecheap,                      \,  \                         \
password=faefjawpefoij30498320493r23     \
@, www, mail, smtp

The following steps can be followed to fix this.

Be aware that this patch has only been tested on ddclient 3.8.1 running on RHEL 6. Your experience may vary with different versions and Linux distributions. This patch may be applied to future ddclient releases negating the need for the following steps.

Patch ddclient

Stop the ddclient service:

service ddclient stop

Copy your existing ddclient binary to another folder:

mkdir /root/ddclient-patch

cp /usr/sbin/ddclient /root/ddclient-patch/

Change to the directory:

cd /root/ddclient-patch/

Save the following patch to a text file named ddclient.patch:

--- ddclient    2012-08-22 18:49:15.643067531 -0500
+++ ddclient    2012-08-22 20:32:23.671069165 -0500
@@ -3375,8 +3375,11 @@

         my $url;
         $url   = "http://$config{$h}{'server'}/update";
-        $url  .= "?host=$h";
-        $url  .= "&domain=$config{$h}{'login'}";
+        my $domain = $config{$h}{'login'};
+        my $host = $h;
+        $host  =~ s/(.*)\.$domain(.*)/$1$2/;
+        $url  .= "?host=$host";
+        $url  .= "&domain=$domain";
         $url  .= "&password=$config{$h}{'password'}";
         $url  .= "&ip=";
         $url  .= $ip if $ip;

Apply the patch:

patch -b -p0 -i ddclient.patch

# Successful output
patching file ddclient

Copy the newly patched ddclient back:

cp /root/ddclient-patch/ddclient /usr/sbin/

Modify /etc/ddclient/ddclient.conf

Modify your /etc/ddclient/ddclient.conf file and add the domain name to each hostname:

protocol=namecheap,                      \,  \                        \
password=faefjawpefoij30498320493r23     \,,

protocol=namecheap,                      \,  \                         \
password=faefjawpefoij30498320493r23     \,,,

Start the ddclient Service Again

Remove the ddclient cache file:

rm /var/cache/ddclient/ddclient.cache

Start the service:

service ddclient start

Monitor /var/log/messages to verify everything is working.


ddclient namecheap multiple updates

Making DDClient work with multiple domains on namecheap

comments powered by Disqus