]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
DDNS: Add support for spdns.de.
authorBernhard Bitsch <bbitsch@ipfire.org>
Mon, 12 May 2014 17:50:50 +0000 (19:50 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Mon, 12 May 2014 17:53:51 +0000 (19:53 +0200)
This commit adds support for the dynamic dns service provider spdns.de.

Fixes #10533.

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

index dc4649b4a5d0bde56ef9398af6128d74486c6865..4b4bc63d7fbea9b346fe7dbeadfdc3a265e29a41 100644 (file)
@@ -253,6 +253,7 @@ $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'} = '';
@@ -351,6 +352,7 @@ 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 -->
index d5f7e088891270fa4caa330021d6f8faf1aa51bc..ef11768562083a8d8490d156e8c6680c75634420 100644 (file)
@@ -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( 'www.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;