Restrict Django sessions to IP and/or user agent.
Project description
Restricts Django sessions to IP and/or user agent.
If the IP or user agent changes after creating the session, the a 400 response is given to the request, the session is flushed (all session data deleted, new session created) and a warning is logged. The goal of this middleware is to make it harder for an attacker to use a session ID they obtained. It does not make abuse of session IDs impossible.
For compatibility with IPv6 privacy extensions, by default only the first 64 bits of an IPv6 address are checked.
Documentation
The full documentation is at https://django-restricted-sessions.readthedocs.org.
Quickstart
Install django-restricted-sessions:
pip install django-restricted-sessions
Then add it to your middleware after SessionMiddleware:
MIDDLEWARE_CLASSES = [ .... 'django.contrib.sessions.middleware.SessionMiddleware', 'restrictedsessions.middleware.RestrictedSessionsMiddleware', .... ]
History
0.1.1 (2014-02-18)
Added missing netaddr requirement to setup.py.
0.1.0 (2014-02-17)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-restricted-sessions-0.1.1.tar.gz
.
File metadata
- Download URL: django-restricted-sessions-0.1.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d38e1cd3744940e6b1b03c793ad6607802dfffe97126d8ed6278a25653e4f986 |
|
MD5 | 5fa31855c1fbaf78741370698a4189c6 |
|
BLAKE2b-256 | ca750b09173d0bd6aa3412e8a2c520e5e7b053a68b50f3a93a2608970e4e5e63 |