Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into monit

This commit is contained in:
Dirk Wagner
2015-01-27 13:33:01 +01:00
45 changed files with 529 additions and 38 deletions

View File

@@ -73,6 +73,9 @@ void usage(void)
printf(" -kn2n --kill-net-2-net\n");
printf(" kills all net2net connections\n");
printf(" you may pass a connection name to the switch to only start a specific one\n");
printf(" -drrd --delete-rrd\n");
printf(" Deletes the RRD data for a specific client\n");
printf(" you need to pass a connection name (RW) to the switch to delete the directory (case sensitive)\n");
printf(" -d --display\n");
printf(" displays OpenVPN status to syslog\n");
printf(" -fwr --firewall-rules\n");
@@ -565,6 +568,28 @@ int killNet2Net(char *name) {
return 0;
}
int deleterrd(char *name) {
connection *conn = getConnections();
char rrd_file[STRING_SIZE];
snprintf(rrd_file, STRING_SIZE - 1, "/var/log/rrd/collectd/localhost/openvpn-%s/if_octets.rrd", name);
char rrd_dir[STRING_SIZE];
snprintf(rrd_dir, STRING_SIZE - 1, "/var/log/rrd/collectd/localhost/openvpn-%s", name);
while(conn) {
/* Find only RW-Connections with the given name. */
if (((strcmp(conn->type, "host") == 0) && (strcmp(conn->name, name) == 0))) {
remove(rrd_file);
remove(rrd_dir);
return 0;
}
conn = conn->next;
}
return 1;
}
void startAllNet2Net() {
int exitcode = 0, _exitcode = 0;
@@ -634,6 +659,10 @@ int main(int argc, char *argv[]) {
else if( (strcmp(argv[1], "-kn2n") == 0) || (strcmp(argv[1], "--kill-net-2-net") == 0) ) {
killNet2Net(argv[2]);
return 0;
}
else if( (strcmp(argv[1], "-drrd") == 0) || (strcmp(argv[1], "--delete-rrd") == 0) ) {
deleterrd(argv[2]);
return 0;
} else {
usage();
return 1;

View File

@@ -0,0 +1,85 @@
commit 78046ffe2187d91c61d6c2f910249b8a5be71b08
Author: Stefan Schantl <stefan.schantl@ipfire.org>
Date: Wed Oct 22 21:39:09 2014 +0200
Add changeip.com as new provider.
Fixes #10639.
diff --git a/README b/README
index 5944102..6a06f4b 100644
--- a/README
+++ b/README
@@ -49,6 +49,7 @@ INSTALLATION:
SUPPORTED PROVIDERS:
all-inkl.com
+ changeip.com
dhs.org
dns.lightningwirelabs.com
dnspark.com
diff --git a/ddns.conf.sample b/ddns.conf.sample
index d3ac53f..0048a46 100644
--- a/ddns.conf.sample
+++ b/ddns.conf.sample
@@ -30,6 +30,11 @@
# secret = XYZ
# ttl = 60
+# [test.changeip.com]
+# provider = changeip.com
+# username = user
+# password = pass
+
# [test.dhs.org]
# provider = dhs.org
# username = user
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 1e88995..587d5ff 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -539,6 +539,44 @@ class DDNSProviderBindNsupdate(DDNSProvider):
return "\n".join(scriptlet)
+class DDNSProviderChangeIP(DDNSProvider):
+ handle = "changeip.com"
+ name = "ChangeIP.com"
+ website = "https://changeip.com"
+ protocols = ("ipv4",)
+
+ # Detailed information about the update api can be found here.
+ # http://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34
+
+ url = "https://nic.changeip.com/nic/update"
+ can_remove_records = False
+
+ def update_protocol(self, proto):
+ data = {
+ "hostname" : self.hostname,
+ "myip" : self.get_address(proto),
+ }
+
+ # Send update to the server.
+ try:
+ response = self.send_request(self.url, username=self.username, password=self.password,
+ data=data)
+
+ # Handle error codes.
+ except urllib2.HTTPError, e:
+ if e.code == 422:
+ raise DDNSRequestError(_("Domain not found."))
+
+ raise
+
+ # Handle success message.
+ if response.code == 200:
+ return
+
+ # If we got here, some other update error happened.
+ raise DDNSUpdateError(_("Server response: %s") % output)
+
+
class DDNSProviderDHS(DDNSProvider):
handle = "dhs.org"
name = "DHS International"

View File

@@ -0,0 +1,23 @@
commit 25f39b4e437627bd1a49393280271d59ad28b86e
Author: Stefan Schantl <stefan.schantl@ipfire.org>
Date: Mon Jan 5 21:37:55 2015 +0100
spdns.de: Fix authentication.
There was a simple copy and paste issue which prevents a
correct authentication with username and password against the
providers API.
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 587d5ff..bcfb088 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1271,7 +1271,7 @@ class DDNSProviderSPDNS(DDNSProtocolDynDNS2, DDNSProvider):
@property
def password(self):
- return self.get("username") or self.token
+ return self.get("password") or self.token
class DDNSProviderStrato(DDNSProtocolDynDNS2, DDNSProvider):