89 Commits

Author SHA1 Message Date
Thomas Waldmann
b8e37e904d register api auth errors/success in the host record, display auth success/failure in host view, partially fixes #176 2014-11-16 00:04:27 +01:00
Thomas Waldmann
6ba6628f60 api views: reduce code duplication - _update and _delete were almost identical 2014-11-15 19:10:47 +01:00
Thomas Waldmann
8d50874e3a improve basic_auth tests so they work with same datatype as when practically running with a web server 2014-09-29 13:44:21 +02:00
Jonne Haß
5e637b14c9 Handle IPv4-mapped IPv6 addresses
Some reverse proxy configurations pass REMOTE_ADDR
as a IPv4-mapped IPv6 address when listening on a
IPv6 socket. This patch converts such a mapped
address into a IPv4 address at all usages of
REMOTE_ADDR. It handles both, the ::ffff:192.0.2.128
format as well as the deprecated ::192.0.2.128 format.
2014-09-29 06:21:24 +02:00
Thomas Waldmann
27fe20da18 make netmasks / prefix lengths configurable in host record 2014-09-25 23:40:52 +02:00
Thomas Waldmann
fa640706f5 add related hosts functionality, to update host records based on main host network address + interface id
this is esp. useful for v6 hosts, where your provider might give you a changing prefix (we assume /64), but your interface ids stay the same.

but same mechanism also principally works for v4 (we assume /29), except that you usually do not get a v4 network where the network address is changing.
and when it comes to dynamic addresses, many people only get 1 ipv4 address anyway. the related host could then be used for aliaseses with ifid == 0 for all aliases.
2014-09-23 00:48:54 +02:00
Thomas Waldmann
a084110d4b give more feedback to user via web ui in case of abuse, host unavailable, bad ip addresses, good updates 2014-09-03 17:49:13 +02:00
Thomas Waldmann
556194ca3f save latest client/server result to model 2014-09-03 16:26:04 +02:00
Thomas Waldmann
1802b91f68 rename methods dealing with client/server "fault" to more general "result" 2014-09-03 15:34:31 +02:00
Thomas Waldmann
cf2c46e612 use FQDN typed params in api, remove unused parse_name (which was problematic anyway) 2014-08-30 18:27:21 +02:00
Thomas Waldmann
dd3cd6139f sync code between _update and _delete 2014-08-27 17:35:10 +02:00
Thomas Waldmann
8dbbd0cad0 catch UnicodeError exceptions caused by ip addr string that can't be decoded by ascii decoder 2014-08-16 21:58:19 +02:00
Thomas Waldmann
070a1445be s/ssl/secure/g
SSL is the old/outdated name. Since 1999, it's called TLS.

Changed some API params.
2014-05-30 01:28:34 +02:00
Thomas Waldmann
46008bf2cd s/SSL/TLS/g (almost)
SSL is the old/outdated name. Since 1999, it's called TLS.

In this changeset, I did the mostly harmless changes (UI, logs, docs).
2014-05-30 01:10:33 +02:00
Thomas Waldmann
9341df05bb optimize filter_by_fqdn(), rename to get_by_fqdn()
as we precisely expect 1 result (0 or more than 1 are error cases), use .get() instead of .filter().
avoid usage of len().
maybe this is a little more efficient than before.
2014-05-29 15:25:38 +02:00
Thomas Waldmann
93b54ab479 handle myip == '' (?myip= in url) - just get ip from REMOTE_ADDR 2014-04-28 01:08:00 +02:00
Thomas Waldmann
36c3c8d314 implement delete API
Very similar to /nic/update and /nic/update_authorized, /nic/delete and /nic/delete_authorized delete
 the A or AAAA record, depending in the kind of IP address given.

 As this is a delete, the specific ip address value is ignored.
2014-01-21 17:50:01 +01:00
Thomas Waldmann
5d2ee03e02 if we get an invalid ip address string with an update (e.g. via myip=... param), return result code 'dnserr'
note: I did not find a better matching result code, seems like dyndns2 api is rather incomplete. :-(
2014-01-21 14:21:35 +01:00
Thomas Waldmann
ba977193ce Merge branch 'master' into py3-port
Conflicts:
	nsupdate/main/_tests/test_main.py
2013-12-24 21:31:40 +01:00
Thomas Waldmann
b317837f58 add a test for dnserr api response
and also fix dnserr api response - should not contain additional info, but just "dnserr"
2013-12-18 04:08:18 +01:00
Thomas Waldmann
807fcaca5a _update: remove unused agent param 2013-12-15 18:12:10 +01:00
Thomas Waldmann
cf6629a0a8 add/fix more docstrings 2013-12-15 17:29:55 +01:00
Thomas Waldmann
0df4efce1c add/fix some module-level docstrings 2013-12-15 17:09:22 +01:00
Thomas Waldmann
711aba237f python 3.3 port
not much tested yet, be careful
2013-12-14 00:35:29 +01:00
Thomas Waldmann
866ddf3bea add available, abuse and abuse_blocked flags to Host, show on UI, script to reset flags
there is an issue with south and sqlite - it doesn't handle migrations that add BooleanField columns with defaults.
just use the faults script to set the flags to their correct default after migrating with south.
2013-11-30 12:32:03 +01:00
Thomas Waldmann
2aeb2a61f8 service updater (host configs): add (give|accept)_(ipv4|ipv6) fields 2013-11-29 02:11:55 +01:00
Thomas Waldmann
6b9c7e9511 add reverse dns lookup results for viewer's current IPs to session, show on hosts overview view (see panel at lower right)
not showing it in home view's jumbotron due to potential cosmetic issues
2013-11-27 08:16:49 +01:00
Thomas Waldmann
aa610e9c3a implement "update other services", with tests, no ui yet
(can be used when adding the records via django admin)
2013-11-26 08:10:05 +01:00
Thomas Waldmann
e9605535b8 add counters for client and server faults (per host) 2013-11-24 11:42:59 +01:00
Thomas Waldmann
1447b670f5 avoid double lookup of the host object
as we have to look it up for auth anyway, return it, so we can continue using it.
2013-11-24 11:09:38 +01:00
Thomas Waldmann
087c1d2c93 deduplicated fqdn lookup uniqueness check, fixed _update return values (must be Response objects, not bool) 2013-11-24 10:43:15 +01:00
Thomas Waldmann
ce83e293bb support notfqdn api result code
we do not really need it as far as the service is concerned (we would give some other valid failure result code),
but it might help to user to more quickly find the mistake in his client configuration.
2013-11-24 06:42:55 +01:00
Thomas Waldmann
e0c83b78b7 clarify hostname in querystring must by same as username used for http basic auth 2013-11-24 06:20:23 +01:00
Thomas Waldmann
1a02925bfa minor changes: fix typo, move comment to right place 2013-11-21 04:10:04 +01:00
Thomas Waldmann
925ad20405 update api: there is no "noauth" return value, it must be "badauth" 2013-11-16 06:09:56 +01:00
Thomas Waldmann
b1ef5ed6b4 api / session ip updates: reorder evaluation, is a bit faster for failures 2013-11-15 13:22:06 +01:00
Thomas Waldmann
f6fb8b67bd try to not write into session unless there is really a change or a refresh needed, reduce code duplication
move code from HomeView to context processor
2013-11-14 02:11:44 +01:00
Thomas Waldmann
f1cdf2ec45 dnstools logging levels improved 2013-11-10 13:59:40 +01:00
Thomas Waldmann
9da1fe95b6 better logging for mismatching username/hostname 2013-11-10 08:12:22 +01:00
Thomas Waldmann
50bdf58398 fix typo 2013-11-10 08:03:36 +01:00
Thomas Waldmann
367bc70f56 security fix: authenticating is not enough, hostname qs param (if given) also needs to match the username 2013-11-10 07:57:40 +01:00
Thomas Waldmann
24b687960e deal with "nameserver not available" and "peer bad signature" in same way as with dns update errors, 2013-11-10 07:04:46 +01:00
Thomas Waldmann
bd3e7c80f7 if a dns update give a rcode != NOERROR, we log it and raise a DnsUpdateError, dyndns2 result code: "dnserr REASON" (also shown on web ui) 2013-11-10 06:29:33 +01:00
Thomas Waldmann
f5c70b03b1 dnstools: use enhanced logger, gives remote addr and user agent automatically 2013-11-09 07:17:05 +01:00
Thomas Waldmann
9cdddbaa0d catch exception that is raised for update usernames that are not fqdn 2013-11-06 13:17:23 +01:00
Thomas Waldmann
51e5efbe8f transform some views from function- to class-based
fixes some pep8 issues. use lowercase function name for the stuff we keep as function.
2013-11-05 00:24:02 +01:00
Thomas Waldmann
4ba29fc3ff detectip: it is not valid without a sessionid, remove the view
and as we currently use the sessionid, we should also name it like that.
2013-11-04 23:09:24 +01:00
Thomas Waldmann
bdb9fd4dab fix KeyError if there is no ipv4/ipv6 key in the session 2013-11-03 17:32:56 +01:00
Thomas Waldmann
7a99935597 use json serializer for sessions, change timestamps' data type, more security docs
json serializer can't serialize datetime (but integers), but is more safe than the pickle serializer.
2013-11-03 09:52:11 +01:00
Thomas Waldmann
e194ac0e46 show whether we received last v4/v6 update via SSL 2013-11-03 08:32:43 +01:00