]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Merge remote-tracking branch 'stevee/ddns-providers' into next
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 17 May 2014 13:27:53 +0000 (15:27 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 17 May 2014 13:27:53 +0000 (15:27 +0200)
html/cgi-bin/ddns.cgi
src/scripts/setddns.pl

index 4e51ab6fd27ea8fb20e38e88ba4e74fe0fd51624..4b4bc63d7fbea9b346fe7dbeadfdc3a265e29a41 100644 (file)
@@ -253,8 +253,11 @@ $checked{'SERVICE'}{'nsupdate'} = '';
 $checked{'SERVICE'}{'ovh.com'} = '';
 $checked{'SERVICE'}{'regfish.com'} = '';
 $checked{'SERVICE'}{'selfhost.de'} = '';
+$checked{'SERVICE'}{'spdns.org'} = '';
 $checked{'SERVICE'}{'strato.com'} = '';
+$checked{'SERVICE'}{'twodns.de'} = '';
 $checked{'SERVICE'}{'tzo.com'} = '';
+$checked{'SERVICE'}{'variomedia.de'} = '';
 $checked{'SERVICE'}{'zoneedit.com'} = '';
 $checked{'SERVICE'}{$settings{'SERVICE'}} = "selected='selected'";
 
@@ -349,8 +352,11 @@ print <<END
     <option $checked{'SERVICE'}{'ovh.com'}>ovh.com</option>
     <option $checked{'SERVICE'}{'regfish.com'}>regfish.com</option>
     <option $checked{'SERVICE'}{'selfhost.de'}>selfhost.de</option>
+    <option $checked{'SERVICE'}{'spdns.org'}>spdns.org</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'}{'variomedia.de'}>variomedia.de</option>
     <option $checked{'SERVICE'}{'zoneedit.com'}>zoneedit.com</option>
     </select></td>
     <td width='20%' class='base'>$Lang::tr{'hostname'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
index f97e75074b48e5bf9d6f6412b800ce7d5084a03e..e26c524bcd1a93dc01283282872ac96013c5dcb9 100644 (file)
@@ -51,7 +51,7 @@ if ($ip eq "unavailable") {
        exit(0);
 }
 
-&General::log("Dynamic DNS public router IP is: $ip");
+#&General::log("Dynamic DNS public router IP is: $ip");
 
 if ($ARGV[0] eq '-f') {
        unlink ($cachefile);    # next regular calls will try again if this force update fails.
@@ -400,6 +400,41 @@ if ($ip ne $ipcache) {
                                &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure (could not connect to server)");
                            }
                        }
+                        elsif ($settings{'SERVICE'} eq 'spdns.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.spdns.de', 443,
+                                                                            "/nic/update?&hostname=$settings{'HOSTDOMAIN'}&myip=$ip",
+                                                                            Net::SSLeay::make_headers('User-Agent' => 'IPFire' ,
+                                                                                                      'Authorization' => 'Basic ' . encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}"))
+                                                                         );
+                            
+                            #Valid responses from service are:
+                            # good xxx.xxx.xxx.xxx
+                            # nochg  xxx.xxx.xxx.xxx
+                            if ($response =~ m%HTTP/1\.. 200 OK%) {
+                                if ($out !~ m/good |nochg /ig) {
+                                    &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)");
+                            }
+                        }
                        elsif ($settings{'SERVICE'} eq 'strato') {
                                # use proxy ?
                                my %proxysettings;
@@ -650,6 +685,73 @@ 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--)");
+                            }
+                        }
+                       elsif ($settings{'SERVICE'} eq 'variomedia') { 
+                           # 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( 'dyndns.variomedia.de',
+                                                                           443,
+                                                                           "/nic/update?hostname=$settings{'HOSTDOMAIN'}&myip=$ip",
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire',
+                                                                                                     'Authorization' => 'Basic ' . encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}")) );
+                           # Valid response is 'good $ip'
+                           if ($response =~ m%HTTP/1\.. 200 OK%) {
+                               if ( $out !~ m/^good $ip/ ) {
+                                   &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} ($ip) : failure ($out)");
+                               } else {
+                                   &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} ($ip) : 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';