75 Commits

Author SHA1 Message Date
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
Thomas Waldmann
461da24b52 add useragent to api / authorized update logging 2013-11-02 02:39:25 +01:00
Thomas Waldmann
7f8e62cc30 use AJAX to update view with current IPs, cosmetic changes, deal with v4 and v6 js separately 2013-11-01 06:03:36 +01:00
Thomas Waldmann
60f03b0472 fix typo in CSRF setting, fix pep8 issues 2013-11-01 04:22:53 +01:00
Thomas Waldmann
2529263a48 remove stale IPs from session, so we don't show outdated information
could happen if there once was a IPv6 connection, but now is not any more.
it now kills infos older than 3 minutes from the session.

it also shows the age of the infos now on the hosts overview view (but not on home view due to cosmetic reasons).

optimization: only request the fake images for ipv4/v6 detection if we don't have a fresh IP already.

added example settings for using detectip on (ip6-)localhost
2013-11-01 04:03:34 +01:00
Thomas Waldmann
252a7e5d0b fix some stuff the pycharm code checker found
it also thought the db param of init_db is not needed, but it is, added a comment there
2013-10-27 13:34:56 +01:00
Thomas Waldmann
979f2f8b3e separate ipv4 and v6 update timestamps 2013-10-27 13:09:46 +01:00
Bastian Blank
09e31209f1 Create 204 response in detect ip view 2013-10-18 00:19:05 +02:00
Bastian Blank
d2eab62ac4 Move all stuff into own top-level package 2013-10-17 23:59:07 +02:00
Thomas Waldmann
2982bd6e30 new check_ip() validates if a str is a ip addr and also determines address family, deduplicate code 2013-10-03 20:39:55 +02:00
Thomas Waldmann
377c0f3e18 api: use Response() more often 2013-10-03 19:38:07 +02:00
Thomas Waldmann
1924888b37 reorder imports: stdlib, other libs, django, nsupdate stuff (views, etc.) 2013-10-03 19:26:39 +02:00
Thomas Waldmann
15c01730b0 add dnspython issue URL and TODO 2013-10-03 17:25:10 +02:00
Thomas Waldmann
da2cf11f70 fix typo 2013-10-03 01:18:48 +02:00
Fabian Faessler
aad646c045 fixed dns api, so an empty myip get parameter is treated like no myip parameter used. made the update ip adr as ajax. 2013-09-29 23:34:07 +02:00