Ubuntu: How can I get ddclient to work with freedns?



Question:

I use the dynamic DNS service at freedns.afraid.org for my 12.04 server. I had assumed that the protocols would be standardised and that ddclient would just work, but apparently not. I get this message in /var/log/syslog:

ERROR: Invalid update URL (2): unexpected status ()  

I tried to use the updated version of ddclient from the alternative PPA described in this answer, but then I hit this error:

FATAL:    Error loading the Perl module Digest::SHA1 needed for freedns update.  FATAL:     On Debian, the package libdigest-sha1-perl must be installed.  

And when I try to install that package, I get this:

E: Unable to locate package libdigest-sha1-perl  

Which leads me to this bug report, which apparently has no solution. How to proceed?


Solution:1

Until ddclient is fixed, you can manually install the old module it wants:

sudo apt-get install cpanminus  cpanm --sudo Digest::SHA1  

Free DNS's clients page and ddclient --help provide sample ddclient configurations. Restart ddclient for changes to take effect:

sudo service ddclient restart  


Solution:2

I was able to get FreeDNS to work by simply editing these two lines in /usr/sbin/ddclient:

From:

my $sha1_loaded = eval {require Digest::SHA1};  

To:

my $sha1_loaded = eval {require Digest::SHA};  

From:

import  Digest::SHA1 (qw/sha1_hex/);  

To:

import Digest::SHA (qw/sha1_hex/);  


Solution:3

A comment in the bug report suggests that it is "easy to change programs to use Digest::SHA instead of Digest::SHA1".

So the full steps are, first, because add-apt-repository is not installed by default:

sudo apt-get install python-software-properties  

Then, as described by izx:

sudo apt-add-repository ppa:nathan-renniewaldock/ppa  

Now, this repository contains many packages, but we only want ddclient. So make a preferences file such as `/etc/apt/preferences.d/nathan-prefs and edit it to look like this:

Package: *  Pin: release o=LP-PPA-nathan-renniewaldock  Pin-Priority: 400    Package: ddclient  Pin: release o=LP-PPA-nathan-renniewaldock  Pin-Priority: 500  

Now install ddclient:

sudo apt-get update && sudo apt-get install ddclient  

Now, become root and edit /usr/sbin/ddclient. Look for require Digest::SHA1 and replace it with require Digest::SHA. Then look for import Digest::SHA1 a few lines later and replace it with import Digest::SHA.

Finally, open up /etc/ddclient.conf and make it look something like this (note the protocol):

daemon=3600  protocol=freedns  use=if, if=eth0  ssl=yes  use=web, web=myip.dnsomatic.com  server=freedns.afraid.org  login=username  password='password'  mydomain.example.com  

The main thing I'm not happy about is hacking a file and breaking Ubuntu's package management. A better solution would be to get the PPA fixed.


Solution:4

You can get it from: libdigest-sha1-perl

You may need to also install libio-socket-ssl-perl. Check your syslog


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »