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=f66b841d7ac9697c51d5553d84faf4fb45f49ab9;hb=80002fe433b0a983fbee13c1f4ad6760596531f9;hpb=035f1702efd0626ec0bb2c6e165600c0bb98ef0c diff --git a/src/scripts/setddns.pl b/src/scripts/setddns.pl index f66b841d7..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,6 +150,27 @@ if ($ip ne $ipcache) { } } + elsif ($settings{'SERVICE'} eq 'all-inkl') { + 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_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%) { + &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, check your credentials)"); + } + } + elsif ($settings{'SERVICE'} eq 'cjb') { # use proxy ? my %proxysettings; @@ -236,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;