mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-18 23:12:59 +02:00
Add DDNS client for dns.lightningwirelabs.com.
This commit is contained in:
@@ -857,13 +857,13 @@ sub FetchPublicIp {
|
||||
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( 'checkip.dyndns.org',
|
||||
my ($out, $response) = Net::SSLeay::get_http( 'checkip.dns.lightningwirelabs.com',
|
||||
80,
|
||||
"/",
|
||||
Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
|
||||
);
|
||||
if ($response =~ m%HTTP/1\.. 200 OK%) {
|
||||
$out =~ /Current IP Address: (\d+.\d+.\d+.\d+)/;
|
||||
$out =~ /Your IP address is: (\d+.\d+.\d+.\d+)/;
|
||||
return $1;
|
||||
}
|
||||
return '';
|
||||
|
||||
@@ -3,6 +3,7 @@ etc/issue
|
||||
etc/rc.d/init.d/squid
|
||||
usr/local/bin/openvpnctrl
|
||||
etc/init.d/firewall
|
||||
srv/web/ipfire/cgi-bin/ddns.cgi
|
||||
usr/lib/squid/errors/tr/ERR_ACCESS_DENIED
|
||||
usr/lib/squid/errors/tr/ERR_ACL_TIME_QUOTA_EXCEEDED
|
||||
usr/lib/squid/errors/tr/ERR_AGENT_CONFIGURE
|
||||
@@ -44,3 +45,5 @@ usr/lib/squid/errors/tr/ERR_URN_RESOLVE
|
||||
usr/lib/squid/errors/tr/ERR_WRITE_ERROR
|
||||
usr/lib/squid/errors/tr/ERR_ZERO_SIZE_OBJECT
|
||||
usr/lib/squid/errors/tr/error-details.txt
|
||||
usr/local/bin/setddns.pl
|
||||
var/ipfire/general-functions.pl
|
||||
|
||||
@@ -235,6 +235,7 @@ my %checked =(); # Checkbox manipulations
|
||||
$checked{'SERVICE'}{'cjb.net'} = '';
|
||||
$checked{'SERVICE'}{'dhs.org'} = '';
|
||||
$checked{'SERVICE'}{'dnspark.com'} = '';
|
||||
$checked{'SERVICE'}{'dns.lightningwirelabs.com'} = '';
|
||||
$checked{'SERVICE'}{'dtdns.com'} = '';
|
||||
$checked{'SERVICE'}{'dyndns.org'} = '';
|
||||
$checked{'SERVICE'}{'dyndns-custom'} = '';
|
||||
@@ -329,6 +330,7 @@ print <<END
|
||||
<option $checked{'SERVICE'}{'cjb.net'}>cjb.net</option>
|
||||
<option $checked{'SERVICE'}{'dhs.org'}>dhs.org</option>
|
||||
<option $checked{'SERVICE'}{'dnspark.com'}>dnspark.com</option>
|
||||
<option $checked{'SERVICE'}{'dns.lightningwirelabs.com'}>dns.lightningwirelabs.com</option>
|
||||
<option $checked{'SERVICE'}{'dtdns.com'}>dtdns.com</option>
|
||||
<option $checked{'SERVICE'}{'dyndns.org'}>dyndns.org</option>
|
||||
<option $checked{'SERVICE'}{'dyndns-custom'}>dyndns-custom</option>
|
||||
|
||||
@@ -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;
|
||||
@@ -236,6 +238,41 @@ 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 ($out, $response) = Net::SSLeay::get_https("dns.lightningwirelabs.com", 443,
|
||||
"/update?hostname=$settings{'HOSTDOMAIN'}&address4=$ip&$authstring",
|
||||
Net::SSLeay::make_headers('User-Agent' => 'IPFire')
|
||||
);
|
||||
|
||||
# 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;
|
||||
|
||||
Reference in New Issue
Block a user