X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=src%2Fscripts%2Fsetddns.pl;h=0833b49c0d4989399e798d68cea0335a1e36dfc5;hp=73d91904571e5da32fd19252bba1cdc14c2f5888;hb=80002fe433b0a983fbee13c1f4ad6760596531f9;hpb=e9db0da3fb260e87465a1846004a4b94524fa590 diff --git a/src/scripts/setddns.pl b/src/scripts/setddns.pl index 73d919045..0833b49c0 100644 --- a/src/scripts/setddns.pl +++ b/src/scripts/setddns.pl @@ -115,8 +115,10 @@ if ($ip ne $ipcache) { next; # do not update, go to test next service } } - my @service = split(/\./, "$settings{'SERVICE'}"); - $settings{'SERVICE'} = "$service[0]"; + if ($settings{'SERVICE'} ne "dns.lightningwirelabs.com") { + my @service = split(/\./, "$settings{'SERVICE'}"); + $settings{'SERVICE'} = "$service[0]"; + } if ($settings{'SERVICE'} eq 'no-ip') { open(F, ">${General::swroot}/ddns/noipsettings"); flock F, 2; @@ -148,8 +150,7 @@ if ($ip ne $ipcache) { } } - elsif ($settings{'SERVICE'} eq 'cjb') { - # use proxy ? + elsif ($settings{'SERVICE'} eq 'all-inkl') { my %proxysettings; &General::readhash("${General::swroot}/proxy/settings", \%proxysettings); if ($_=$proxysettings{'UPSTREAM_PROXY'}) { @@ -157,24 +158,20 @@ if ($ip ne $ipcache) { Net::SSLeay::set_proxy($peer,$peerport,$proxysettings{'UPSTREAM_USER'},$proxysettings{'UPSTREAM_PASSWORD'} ); } - my ($out, $response) = Net::SSLeay::get_http( 'www.cjb.net', - 80, - "/cgi-bin/dynip.cgi?username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}&ip=$ip", - Net::SSLeay::make_headers('User-Agent' => 'IPFire' ) - ); + my ($out, $response) = Net::SSLeay::get_http("dyndns.kasserver.com", 80, "/", 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/has been updated to point to/ ) { - &General::log("Dynamic DNS ip-update for cjb.net ($settings{'LOGIN'}) : failure (bad password or login)"); - } else { - &General::log("Dynamic DNS ip-update for cjb.net ($settings{'LOGIN'}) : success"); - $success++; - } + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : success"); + $success++; } else { - &General::log("Dynamic DNS ip-update for cjb.net ($settings{'LOGIN'}) : failure (could not connect to server)"); + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure (could not connect to server, check your credentials)"); } } - elsif ($settings{'SERVICE'} eq 'mydyn') { + + elsif ($settings{'SERVICE'} eq 'cjb') { # use proxy ? my %proxysettings; &General::readhash("${General::swroot}/proxy/settings", \%proxysettings); @@ -183,23 +180,22 @@ if ($ip ne $ipcache) { Net::SSLeay::set_proxy($peer,$peerport,$proxysettings{'UPSTREAM_USER'},$proxysettings{'UPSTREAM_PASSWORD'} ); } - my ($out, $response) = Net::SSLeay::get_http( 'www.mydyn.de', + my ($out, $response) = Net::SSLeay::get_http( 'www.cjb.net', 80, - "/cgi-bin/update.pl?$settings{'LOGIN'}-$settings{'PASSWORD'}", - Net::SSLeay::make_headers('User-Agent' => 'IPFire' ) - ); + "/cgi-bin/dynip.cgi?username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}&ip=$ip", + Net::SSLeay::make_headers('User-Agent' => 'IPFire' ) + ); if ($response =~ m%HTTP/1\.. 200 OK%) { - if ( $out !~ m/The IP address of the subdomain/ ) { - &General::log("Dynamic DNS ip-update for mydyn.de ($settings{'LOGIN'}) : failure (bad password or login)"); + if ( $out !~ m/has been updated to point to/ ) { + &General::log("Dynamic DNS ip-update for cjb.net ($settings{'LOGIN'}) : failure (bad password or login)"); } else { - &General::log("Dynamic DNS ip-update for mydyn.de ($settings{'LOGIN'}) : success"); + &General::log("Dynamic DNS ip-update for cjb.net ($settings{'LOGIN'}) : success"); $success++; } } else { - &General::log("Dynamic DNS ip-update for mydyn.de ($settings{'LOGIN'}) : failure (could not connect to server)"); + &General::log("Dynamic DNS ip-update for cjb.net ($settings{'LOGIN'}) : failure (could not connect to server)"); } - } elsif ($settings{'SERVICE'} eq 'selfhost') { # use proxy ? @@ -263,6 +259,42 @@ if ($ip ne $ipcache) { &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server, check your credentials)"); } } + elsif ($settings{'SERVICE'} eq 'dns.lightningwirelabs.com') { + # 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 $authstring; + if ($settings{'LOGIN'} eq "token") { + $authstring = "token=$settings{'PASSWORD'}"; + } else { + $authstring = "username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}"; + } + + my $user_agent = &General::MakeUserAgent(); + my ($out, $response) = Net::SSLeay::get_https("dns.lightningwirelabs.com", 443, + "/update?hostname=$settings{'HOSTDOMAIN'}&address4=$ip&$authstring", + Net::SSLeay::make_headers('User-Agent' => $user_agent) + ); + + # Valid response are 'ok' 'nochange' + if ($response =~ m%HTTP/1\.. 200 OK%) { + &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)"); + } + } elsif ($settings{'SERVICE'} eq 'enom') { # use proxy ? my %proxysettings; @@ -390,6 +422,43 @@ 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 'strato') { + # 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.strato.com', + 443, + "/nic/update?hostname=$settings{'HOSTDOMAIN'}&myip=$ip", + Net::SSLeay::make_headers('User-Agent' => 'IPFire', + 'Authorization' => 'Basic ' . encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}") ) + ); + + if ($response =~ m%HTTP/1\.. 200 OK%) { + #Valid responses from update => ErrCount=0 + if ( $out =~ m/good |nochg /ig) { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : success"); + $success++; + } else { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure1 ($out)"); + $success++; + } + } elsif ( $out =~ m/(.*)<\/title>/ig ) { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure2 ($1)"); + } else { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure3 ($response)"); + } + } elsif ($settings{'SERVICE'} eq 'regfish') { # use proxy ? my %proxysettings; @@ -398,13 +467,11 @@ if ($ip ne $ipcache) { 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'} ); } - - - my ($out, $response) = Net::SSLeay::get_https( 'www.regfish.com', - 443, - "/dyndns/2/?fqdn=$settings{'DOMAIN'}&ipv4=$ip&forcehost=1&authtype=secure&token=$settings{'LOGIN'}", - Net::SSLeay::make_headers('User-Agent' => 'IPFire' ) - ); + my ($out, $response) = Net::SSLeay::get_https( 'dyndns.regfish.de', + 443, + "/?fqdn=$settings{'DOMAIN'}&ipv4=$ip&forcehost=1&authtype=secure&token=$settings{'LOGIN'}", + Net::SSLeay::make_headers('User-Agent' => 'Ipfire' ) + ); #Valid responses from service are: #success|100|update succeeded! #success|101|no update needed at this time.. @@ -507,6 +574,36 @@ if ($ip ne $ipcache) { &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server)"); } } + #namecheap test + elsif ($settings{'SERVICE'} eq 'namecheap') { + # 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'} ); + } + + my ($out, $response) = Net::SSLeay::get_https( 'dynamicdns.park-your-domain.com', + 443, + "/update?host=$settings{'HOSTNAME'}&domain=$settings{'DOMAIN'}&password=$settings{'PASSWORD'}&ip=$ip", + Net::SSLeay::make_headers('User-Agent' => 'IPFire' ) + ); + #Valid responses from service are: + # wait confirmation!! + if ($response =~ m%HTTP/1\.. 200 OK%) { + if ( $out !~ m/<ErrCount>0<\/ErrCount>/ ) { + $out =~ m/<Err1>(.*)<\/Err1>/; + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure ($1)"); + } else { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : success"); + $success++; + } + } else { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure (could not connect to server)"); + } + } + #end namecheap test elsif ($settings{'SERVICE'} eq 'dynu') { # use proxy ? my %proxysettings;