]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
DDNS: Add support for twodns.de.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 29 Jan 2014 14:31:23 +0000 (15:31 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 11 May 2014 17:58:31 +0000 (19:58 +0200)
This commit adds support for the dynamic dns service provider twodns.de.

Fixes #10418.

html/cgi-bin/ddns.cgi
src/scripts/setddns.pl

index 4e51ab6fd27ea8fb20e38e88ba4e74fe0fd51624..ae981a42f5b07bd9aeff5eb75a5022c71b264cd7 100644 (file)
@@ -254,6 +254,7 @@ $checked{'SERVICE'}{'ovh.com'} = '';
 $checked{'SERVICE'}{'regfish.com'} = '';
 $checked{'SERVICE'}{'selfhost.de'} = '';
 $checked{'SERVICE'}{'strato.com'} = '';
+$checked{'SERVICE'}{'twodns.de'} = '';
 $checked{'SERVICE'}{'tzo.com'} = '';
 $checked{'SERVICE'}{'zoneedit.com'} = '';
 $checked{'SERVICE'}{$settings{'SERVICE'}} = "selected='selected'";
@@ -350,6 +351,7 @@ print <<END
     <option $checked{'SERVICE'}{'regfish.com'}>regfish.com</option>
     <option $checked{'SERVICE'}{'selfhost.de'}>selfhost.de</option>
     <option $checked{'SERVICE'}{'strato.com'}>strato.com</option>
+    <option $checked{'SERVICE'}{'twodns.de'}>twodns.de</option>
 <!--    <option $checked{'SERVICE'}{'tzo.com'}>tzo.com</option>        comment this service out until a working fix is developed -->
     <option $checked{'SERVICE'}{'zoneedit.com'}>zoneedit.com</option>
     </select></td>
index f97e75074b48e5bf9d6f6412b800ce7d5084a03e..939e9f2549643523b4046583bba6bac17bf452cd 100644 (file)
@@ -650,6 +650,40 @@ if ($ip ne $ipcache) {
                                &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server, check your credentials---$out-$response--)");
                            }
                        }
+                        elsif ($settings{'SERVICE'} eq 'twodns.de') {
+                            # use proxy ?
+                            my %proxysettings;
+                            &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
+                            if ($_=$proxysettings{'UPSTREAM_PROXY'}) {
+                                my ($peer, $peerport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
+                                Net::SSLeay::set_proxy($peer,$peerport,$proxysettings{'UPSTREAM_USER'},$proxysettings{'UPSTREAM_PASSWORD'} );
+                            }
+
+                            if ($settings{'HOSTNAME'} eq '') {
+                                $settings{'HOSTDOMAIN'} = $settings{'DOMAIN'};
+                            } else {
+                                $settings{'HOSTDOMAIN'} = "$settings{'HOSTNAME'}.$settings{'DOMAIN'}";
+                            }
+
+                            my ($out, $response) = Net::SSLeay::get_https( 'update.twodns.de',
+                                                                            443,
+                                                                           "/update?hostname=$settings{'HOSTDOMAIN'}&ip=$ip",
+                                                                            Net::SSLeay::make_headers('User-Agent' => 'IPFire',
+                                                                                                      'Authorization' => 'Basic ' . encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}")) );
+
+                            # Valid response are 'ok'   'nochange'
+                            if ($response =~ m%HTTP/1\.. 200 OK%) {
+                                if ( $out !~ m/^(good|nochg)/ ) {
+                                    $out =~ s/\n/ /g;
+                                    &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure ($out)");
+                                } else {
+                                    &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : success");
+                                    $success++;
+                                }
+                            } else {
+                                &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server, check your credentials---$out-$response--)");
+                            }
+                        }
                        else {
                                if ($settings{'WILDCARDS'} eq 'on') {
                                    $settings{'WILDCARDS'} = '-w';