OPNsense Forum

Archive => 22.1 Legacy Series => Topic started by: pesensie on July 28, 2022, 04:17:29 PM

Title: os-ddclient Added support for domaindiscount24.com
Post by: pesensie on July 28, 2022, 04:17:29 PM
Hello,

Is it possible to add domaindiscont24.com DynDns to os-ddclient WEB-UI?
Attached is my working ddclient and ddclient.conf file

ddclient
add row: 385-388
    'keysystems-common-defaults' => {
        'server'              => setv(T_FQDNP, 1, 0, 1, 'dynamicdns.key-systems.net', undef),
        'login'               => setv(T_LOGIN, 0, 0, 0, 'unused',      undef),
    },


add row:696 - 704
'keysystems' => {
    'updateable' => undef,
    'update' => \&nic_keysystems_update,
    'examples'  => \&nic_keysystems_examples,
    'variables' => merge(
            $variables{'keysystems-common-defaults'},
            $variables{'service-common-defaults'},
            ),
    },


add row: 5167 - 5227
######################################################################
## nic_keysystems_examples
######################################################################
sub nic_keysystems_examples {
    return <<EoEXAMPLE;
o 'keysystems'
The 'keysystems' protocol is used by the non-free
dynamic DNS service offered by www.domaindiscount24.com and www.rrpproxy.net.
Check https://www.domaindiscount24.com/faq/en/dynamic-dns for API
Configuration variables applicable to the 'keysystems' protocol are:
protocol=keysystems
server=dynamicdns.key-systems.net
password=service-password          ## password (token) registered with the service
subdomain.example.com              ## the host registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=keysystems,             \\\\
password=service-password        \\\\
example.com
EoEXAMPLE
}

######################################################################
## nic_keysystems_update
## response contains "code 200" on succesfull completion
######################################################################
sub nic_keysystems_update {
debug("\nnic_keysystems_update -------------------");

## update each configured host
## should improve to update in one pass
foreach my $h (@_) {
   my $ip = delete $config{$h}{'wantip'};
   info("KEYSYSTEMS setting IP address to %s for %s", $ip, $h);

   my $url = "http://$config{$h}{'server'}/update.php?hostname=$h&password=$config{$h}{'password'}&ip=$ip";

   # Try to get URL
   my $reply = geturl(opt('proxy'), $url);

   # No response, declare as failed
   if (!defined($reply) || !$reply) {
     failed("KEYSYSTEMS updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
     last;
   }
   last if !header_ok($h, $reply);

   if ($reply =~ /code = 200/)
   {
       $config{$h}{'ip'}   = $ip;
       $config{$h}{'mtime'} = $now;
       $config{$h}{'status'} = 'good';
       success("updating %s: good: IP address set to %s", $h, $ip);
    }
    else
    {
       $config{$h}{'status'} = 'failed';
       failed("updating %s: Server said: '$reply'", $h);
    }
  }
}


ddclient.conf
Configuration variables applicable to the 'keysystems' protocol are:
protocol=keysystems
server=dynamicdns.key-systems.net
password=service-password          ## password (token) registered with the service
subdomain.example.com              ## the host registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=keysystems,             \\\\
password=service-password        \\\\
example.com


best regards pesensie