aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2014-03-17 04:18:38 +0100
committerMarius Halden <marius.h@lden.org>2014-03-17 04:18:38 +0100
commite3647a7063c54e68898c0cdfc0373c4804f0bfc5 (patch)
tree1d92c956bf6f0a808dfd5a99a59400c8743d3e21
parent7c575aaa8e98a6aa7eda8d69e2b14d014ee91b09 (diff)
downloadDDNS.py-e3647a7063c54e68898c0cdfc0373c4804f0bfc5.tar.gz
DDNS.py-e3647a7063c54e68898c0cdfc0373c4804f0bfc5.tar.bz2
DDNS.py-e3647a7063c54e68898c0cdfc0373c4804f0bfc5.tar.xz
-
-rw-r--r--ddns.wsgi (renamed from main.wsgi)0
-rwxr-xr-xddns/main.py61
2 files changed, 0 insertions, 61 deletions
diff --git a/main.wsgi b/ddns.wsgi
index 9e5292c..9e5292c 100644
--- a/main.wsgi
+++ b/ddns.wsgi
diff --git a/ddns/main.py b/ddns/main.py
deleted file mode 100755
index 5ee6eaa..0000000
--- a/ddns/main.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-from flask import Flask, request, Response
-import ddns
-import cfg_parser
-import auth
-from IPy import IP
-
-cfg_file="/srv/http/lden.org/ddns/ddns/ddns.cfg"
-cfg = cfg_parser.read_config(cfg_file)
-
-auth.auth_cfg = cfg['users']
-ddns.zone_cfg = cfg['zones']
-ddns.gen_keyring(cfg['dnskeys'])
-
-app = Flask(__name__)
-
-@app.route("/nic/update")
-@auth.require_auth
-def dyndns():
- if request.method != 'GET':
- return "badagent"
-
- if not request.args.has_key('hostname'):
- return "nohost"
-
- if len(request.args.getlist('hostname')) > 1:
- return "numhost"
-
- if not request.args.has_key('myip'):
- return "nohost"
-
- hostname = request.args.get('hostname')
- if not '.' in hostname:
- return "notfqdn"
-
- zone_name = hostname[hostname.find('.')+1:]
- if zone_name[-1] != '.':
- zone_name += '.'
-
- hostname = hostname[0:hostname.find('.')]
-
- try:
- ip = IP(request.args.get('myip'))
- except ValueError:
- return "nohost"
-
- for zone in cfg['zones']:
- if zone_name == zone['name']:
- for domain in zone['domains']:
- if domain['domain'] == hostname:
- for user in domain['users']:
- if request.authorization.username == user['username']:
- ddns.update_dns(zone_name, hostname, ip)
- return "good"
- return auth.authenticate("!yours")
- return "nohost"
- return "nohost"
-
-if __name__ == "__main__":
- app.run(host="0.0.0.0", debug=True)