From: git@ipfire.org
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. b2f8244ae28ce553f5e51a161f6c13a1188f8a4e
Date: Wed, 12 Jun 2013 22:02:24 +0200 [thread overview]
Message-ID: <20130612200224.7FE7E20853@argus.ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 7699 bytes --]
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, next has been updated
via b2f8244ae28ce553f5e51a161f6c13a1188f8a4e (commit)
via 5a2935b1b335077e7df76ae3dbd75331056bd198 (commit)
from 7dddd54d47736419c6c1eb2fbfbbf5dffa62f47a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b2f8244ae28ce553f5e51a161f6c13a1188f8a4e
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Wed Jun 12 15:22:48 2013 +0200
DDNS: Send proper user agent.
commit 5a2935b1b335077e7df76ae3dbd75331056bd198
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Wed Jun 12 14:36:51 2013 +0200
Add DDNS client for dns.lightningwirelabs.com.
-----------------------------------------------------------------------
Summary of changes:
config/cfgroot/general-functions.pl | 32 +++++++++++++++++++++---
config/rootfiles/core/70/filelists/files | 3 +++
html/cgi-bin/ddns.cgi | 2 ++
src/scripts/setddns.pl | 42 ++++++++++++++++++++++++++++++--
4 files changed, 74 insertions(+), 5 deletions(-)
Difference in files:
diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index a70f267..9c6d460 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -857,13 +857,14 @@ 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 $user_agent = &MakeUserAgent();
+ my ($out, $response) = Net::SSLeay::get_http( 'checkip.dns.lightningwirelabs.com',
80,
"/",
- Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
+ Net::SSLeay::make_headers('User-Agent' => $user_agent )
);
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 '';
@@ -980,4 +981,29 @@ sub GetIcmpDescription ($) {
'Experimental');
if ($index>41) {return 'unknown'} else {return @icmp_description[$index]};
}
+
+sub GetCoreUpdateVersion() {
+ my $core_update;
+
+ open(FILE, "/opt/pakfire/db/core/mine");
+ while (<FILE>) {
+ $core_update = $_;
+ last;
+ }
+ close(FILE);
+
+ return $core_update;
+}
+
+sub MakeUserAgent() {
+ my $user_agent = "IPFire/$General::version";
+
+ my $core_update = &GetCoreUpdateVersion();
+ if ($core_update ne "") {
+ $user_agent .= "/$core_update";
+ }
+
+ return $user_agent;
+}
+
1;
diff --git a/config/rootfiles/core/70/filelists/files b/config/rootfiles/core/70/filelists/files
index 71546ea..151f284 100644
--- a/config/rootfiles/core/70/filelists/files
+++ b/config/rootfiles/core/70/filelists/files
@@ -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
diff --git a/html/cgi-bin/ddns.cgi b/html/cgi-bin/ddns.cgi
index 4453542..d840d39 100644
--- a/html/cgi-bin/ddns.cgi
+++ b/html/cgi-bin/ddns.cgi
@@ -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>
diff --git a/src/scripts/setddns.pl b/src/scripts/setddns.pl
index f66b841..6c4c369 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;
@@ -236,6 +238,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;
hooks/post-receive
--
IPFire 2.x development tree
reply other threads:[~2013-06-12 20:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130612200224.7FE7E20853@argus.ipfire.org \
--to=git@ipfire.org \
--cc=ipfire-scm@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox