PKG-INFO 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. Metadata-Version: 1.1
  2. Name: django-axes
  3. Version: 1.6.0
  4. Summary: Keep track of failed login attempts in Django-powered sites.
  5. Home-page: https://github.com/django-pci/django-axes
  6. Author: Alex Clark
  7. Author-email: aclark@aclark.net
  8. License: MIT
  9. Description: Django Axes
  10. ===========
  11. .. image:: https://secure.travis-ci.org/django-pci/django-axes.png?branch=master
  12. :alt: Build Status
  13. :target: http://travis-ci.org/django-pci/django-axes
  14. ``django-axes`` is a very simple way for you to keep track of failed login
  15. attempts, both for the Django admin and for the rest of your site. The name is
  16. sort of a geeky pun, since ``axes`` can be read interpreted as:
  17. * "access", as in monitoring access attempts
  18. * "axes", as in tools you can use hack (generally on wood). In this case,
  19. however, the "hacking" part of it can be taken a bit further: ``django-axes``
  20. is intended to help you *stop* people from hacking (popular media
  21. definition) your website. Hilarious, right? That's what I thought too!
  22. Requirements
  23. ============
  24. ``django-axes`` requires Django 1.5 or later. The application is intended to
  25. work around the Django admin and the regular ``django.contrib.auth``
  26. login-powered pages.
  27. Installation
  28. ============
  29. You can install the latest stable package running this command::
  30. $ pip install django-axes
  31. Also you can install the development version running this command::
  32. $ pip install -e git+http://github.com/django-pci/django-axes.git#egg=django_axes-dev
  33. Development
  34. ===========
  35. You can contribute to this project forking it from github and sending pull requests.
  36. Running tests
  37. -------------
  38. Tests can be run, after you clone the repository and having django installed, like::
  39. $ PYTHONPATH=$PYTHONPATH:$PWD django-admin.py test axes --settings=axes.test_settings
  40. Configuration
  41. =============
  42. First of all, you must add this project to your list of ``INSTALLED_APPS`` in
  43. ``settings.py``::
  44. INSTALLED_APPS = (
  45. 'django.contrib.admin',
  46. 'django.contrib.auth',
  47. 'django.contrib.contenttypes',
  48. 'django.contrib.sessions',
  49. 'django.contrib.sites',
  50. ...
  51. 'axes',
  52. ...
  53. )
  54. Next, install the ``FailedLoginMiddleware`` middleware::
  55. MIDDLEWARE_CLASSES = (
  56. 'django.middleware.common.CommonMiddleware',
  57. 'django.contrib.sessions.middleware.SessionMiddleware',
  58. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  59. 'axes.middleware.FailedLoginMiddleware'
  60. )
  61. Run ``python manage.py syncdb``. This creates the appropriate tables in your database
  62. that are necessary for operation.
  63. Customizing Axes
  64. ----------------
  65. You have a couple options available to you to customize ``django-axes`` a bit.
  66. These should be defined in your ``settings.py`` file.
  67. * ``AXES_LOGIN_FAILURE_LIMIT``: The number of login attempts allowed before a
  68. record is created for the failed logins. Default: ``3``
  69. * ``AXES_LOCK_OUT_AT_FAILURE``: After the number of allowed login attempts
  70. are exceeded, should we lock out this IP (and optional user agent)?
  71. Default: ``True``
  72. * ``AXES_USE_USER_AGENT``: If ``True``, lock out / log based on an IP address
  73. AND a user agent. This means requests from different user agents but from
  74. the same IP are treated differently. Default: ``False``
  75. * ``AXES_COOLOFF_TIME``: If set, defines a period of inactivity after which
  76. old failed login attempts will be forgotten. Can be set to a python
  77. timedelta object or an integer. If an integer, will be interpreted as a
  78. number of hours. Default: ``None``
  79. * ``AXES_LOGGER``: If set, specifies a logging mechanism for axes to use.
  80. Default: ``'axes.watch_login'``
  81. * ``AXES_LOCKOUT_TEMPLATE``: If set, specifies a template to render when a
  82. user is locked out. Template receives cooloff_time and failure_limit as
  83. context variables. Default: ``None``
  84. * ``AXES_LOCKOUT_URL``: If set, specifies a URL to redirect to on lockout. If
  85. both AXES_LOCKOUT_TEMPLATE and AXES_LOCKOUT_URL are set, the template will
  86. be used. Default: ``None``
  87. * ``AXES_VERBOSE``: If ``True``, you'll see slightly more logging for Axes.
  88. Default: ``True``
  89. * ``AXES_USERNAME_FORM_FIELD``: the name of the form field that contains your
  90. users usernames. Default: ``username``
  91. * ``AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP``: If ``True`` prevents to login
  92. from IP under particular user if attempts limit exceed, otherwise lock out
  93. based on IP.
  94. Default: ``False``
  95. Usage
  96. =====
  97. Using ``django-axes`` is extremely simple. Once you install the application
  98. and the middleware, all you need to do is periodically check the Access
  99. Attempts section of the admin.
  100. By default, django-axes will lock out repeated attempts from the same IP
  101. address. You can allow this IP to attempt again by deleting the relevant
  102. ``AccessAttempt`` records in the admin.
  103. You can also use the ``axes_reset`` management command using Django's
  104. ``manage.py``.
  105. * ``manage.py axes_reset`` will reset all lockouts and access records.
  106. * ``manage.py axes_reset ip`` will clear lockout/records for ip
  107. In your code, you can use ``from axes.utils import reset``.
  108. * ``reset()`` will reset all lockouts and access records.
  109. * ``reset(ip=ip)`` will clear lockout/records for ip
  110. * ``reset(username=username)`` will clear lockout/records for username
  111. Issues
  112. ======
  113. Not being locked out after failed attempts
  114. ------------------------------------------
  115. You may find that Axes is not capturing your failed login attempts. It may be that you need to manually add watch_login to your login url.
  116. For example, in your urls.py::
  117. ...
  118. from django.contrib.auth.views import login, logout, password_change
  119. from axes.decorators import watch_login
  120. ...
  121. urlpatterns = patterns('',
  122. (r'^login/$', watch_login(login), {'template_name': 'auth/login.html'}),
  123. ...
  124. Locked out without reason
  125. -------------------------
  126. It may happen that you have suddenly become locked out without a single failed
  127. attempt. One possible reason is that you are using some custom login form and the
  128. username field is named something different than "username", e.g. "email". This
  129. leads to all users attempts being lumped together. To fix this add the following
  130. to your settings:
  131. AXES_USERNAME_FORM_FIELD = "email"
  132. Using a captcha
  133. ===============
  134. Using https://github.com/mbi/django-simple-captcha you do the following:
  135. 1. Change axes lockout url in ``settings.py``::
  136. AXES_LOCKOUT_URL = '/locked'
  137. 2. Add the url in ``urls.py``::
  138. url(r'^locked/$', locked_out, name='locked_out'),
  139. 3. Create a captcha form::
  140. class AxesCaptchaForm(forms.Form):
  141. captcha = CaptchaField()
  142. 4. Create a captcha view for the above url that resets on captcha success and redirects::
  143. def locked_out(request):
  144. if request.POST:
  145. form = AxesCaptchaForm(request.POST)
  146. if form.is_valid():
  147. ip = get_ip_address_from_request(request)
  148. reset(ip=ip)
  149. return HttpResponseRedirect(reverse_lazy('signin'))
  150. else:
  151. form = AxesCaptchaForm()
  152. return render_to_response('locked_out.html', dict(form=form), context_instance=RequestContext(request))
  153. 5. Add a captcha template::
  154. <form action="" method="post">
  155. {% csrf_token %}
  156. {{ form.captcha.errors }}
  157. {{ form.captcha }}
  158. <div class="form-actions">
  159. <input type="submit" value="Submit" />
  160. </div>
  161. </form>
  162. Done.
  163. Changes
  164. =======
  165. 1.6.0 (2016-01-07)
  166. ------------------
  167. - Stopped using render_to_response so that other template engines work
  168. [tarkatronic]
  169. - Improved performance & DoS prevention on query2str
  170. [tarkatronic]
  171. - Immediately return from is_already_locked if the user is not lockable
  172. [jdunck]
  173. - Iterate over ip addresses only once
  174. [annp89]
  175. - added initial migration files to support django 1.7 &up
  176. [ibaguio]
  177. - Add db indexes to CommonAccess model
  178. [Schweigi]
  179. 1.5.0 (2015-09-11)
  180. ------------------
  181. - Fix #_get_user_attempts to include username when filtering AccessAttempts if AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP is True
  182. [afioca]
  183. 1.4.0 (2015-08-09)
  184. ------------------
  185. - Send the user_locked_out signal. Fixes #94.
  186. [toabi]
  187. 1.3.9 (2015-02-11)
  188. ------------------
  189. - Python 3 fix (#104)
  190. 1.3.8 (2014-10-07)
  191. ------------------
  192. - Rename GitHub organization from django-security to django-pci to emphasize focus on providing assistance with building PCI compliant websites with Django.
  193. [aclark4life]
  194. 1.3.7 (2014-10-05)
  195. ------------------
  196. - Explain common issues where Axes fails silently
  197. [cericoda]
  198. - Allow for user-defined username field for lookup in POST data
  199. [SteveByerly]
  200. - Log out only if user was logged in
  201. [zoten]
  202. - Support for floats in cooloff time (i.e: 0.1 == 6 minutes)
  203. [marianov]
  204. - Limit amount of POST data logged (#73). Limiting the length of value is not enough, as there could be arbitrary number of them, or very long key names.
  205. [peterkuma]
  206. - Improve get_ip to try for real ip address
  207. [7wonders]
  208. - Change IPAddressField to GenericIPAddressField. When using a PostgreSQL database and the client does not pass an IP address you get an inet error. This is a known problem with PostgreSQL and the IPAddressField. https://code.djangoproject.com/ticket/5622. It can be fixed by using a GenericIPAddressField instead.
  209. [polvoblanco]
  210. - Get first X-Forwarded-For IP
  211. [tutumcloud]
  212. - White listing IP addresses behind reverse proxy. Allowing some IP addresses to have direct access to the app even if they are behind a reverse proxy. Those IP addresses must still be on a white list.
  213. [ericbulloch]
  214. - Reduce logging of reverse proxy IP lookup and use configured logger. Fixes #76. Instead of logging the notice that django.axes looks for a HTTP header set by a reverse proxy on each attempt, just log it one-time on first module import. Also use the configured logger (by default axes.watch_login) for the message to be more consistent in logging.
  215. [eht16]
  216. - Limit the length of the values logged into the database. Refs #73
  217. [camilonova]
  218. - Refactored tests to be more stable and faster
  219. [camilonova]
  220. - Clean client references
  221. [camilonova]
  222. - Fixed admin login url
  223. [camilonova]
  224. - Added django 1.7 for testing
  225. [camilonova]
  226. - Travis file cleanup
  227. [camilonova]
  228. - Remove hardcoded url path
  229. [camilonova]
  230. - Fixing tests for django 1.7
  231. [Andrew-Crosio]
  232. - Fix for django 1.7 exception not existing
  233. [Andrew-Crosio]
  234. - Removed python 2.6 from testing
  235. [camilonova]
  236. - Use django built-in six version
  237. [camilonova]
  238. - Added six as requirement
  239. [camilonova]
  240. - Added python 2.6 for travis testing
  241. [camilonova]
  242. - Replaced u string literal prefixes with six.u() calls
  243. [amrhassan]
  244. - Fixes object type issue, response is not an string
  245. [camilonova]
  246. - Python 3 compatibility fix for db_reset
  247. [nicois]
  248. - Added example project and helper scripts
  249. [barseghyanartur]
  250. - Admin command to list login attemps
  251. [marianov]
  252. - Replaced six imports with django.utils.six ones
  253. [amrhassan]
  254. - Replaced u string literal prefixes with six.u() calls to make it compatible with Python 3.2
  255. [amrhassan]
  256. - Replaced `assertIn`s and `assertNotIn`s with `assertContains` and `assertNotContains`
  257. [fcurella]
  258. - Added py3k to travis
  259. [fcurella]
  260. - Update test cases to be python3 compatible
  261. [nicois]
  262. - Python 3 compatibility fix for db_reset
  263. [nicois]
  264. - Removed trash from example urls
  265. [barseghyanartur]
  266. - Added django installer
  267. [barseghyanartur]
  268. - Added example project and helper scripts
  269. [barseghyanartur]
  270. 1.3.6 (2013-11-23)
  271. ------------------
  272. - Added AttributeError in case get_profile doesn't exist [camilonova]
  273. - Improved axes_reset command [camilonova]
  274. 1.3.5 (2013-11-01)
  275. ------------------
  276. - Fix an issue with __version__ loading the wrong version [graingert]
  277. 1.3.4 (2013-11-01)
  278. ------------------
  279. - Update README.rst for PyPI [marty] [camilonova] [graingert]
  280. - Add cooloff period [visualspace]
  281. 1.3.3 (2013-07-05)
  282. ------------------
  283. - Added 'username' field to the Admin table [bkvirendra]
  284. - Removed fallback logging creation since logging cames by default on django 1.4 or later, if you don't have it is because you explicitly wanted. Fixes #45 [camilonova]
  285. 1.3.2 (2013-03-28)
  286. ------------------
  287. - Fix an issue when a user logout [camilonova]
  288. - Match pypi version [camilonova]
  289. - Better User model import method [camilonova]
  290. - Use only one place to get the version number [camilonova]
  291. - Fixed an issue when a user on django 1.4 logout [camilonova]
  292. - Handle exception if there is not user profile model set [camilonova]
  293. - Made some cleanup and remove a pokemon exception handling [camilonova]
  294. - Improved tests so it really looks for the rabbit in the hole [camilonova]
  295. - Match pypi version [camilonova]
  296. 1.3.1 (2013-03-19)
  297. ------------------
  298. - Add support for Django 1.5 [camilonova]
  299. 1.3.0 (2013-02-27)
  300. ------------------
  301. - Bug fix: get_version() format string [csghormley]
  302. 1.2.9 (2013-02-20)
  303. ------------------
  304. - Add to and improve test cases [camilonova]
  305. 1.2.8 (2013-01-23)
  306. ------------------
  307. - Increased http accept header length [jslatts]
  308. 1.2.7 (2013-01-17)
  309. ------------------
  310. - Reverse proxy support [rmagee]
  311. - Clean up README [martey]
  312. 1.2.6 (2012-12-04)
  313. ------------------
  314. - Remove unused import [aclark4life]
  315. 1.2.5 (2012-11-28)
  316. ------------------
  317. - Fix setup.py [aclark4life]
  318. - Added ability to flag user accounts as unlockable. [kencochrane]
  319. - Added ipaddress as a param to the user_locked_out signal. [kencochrane]
  320. - Added a signal receiver for user_logged_out. [kencochrane]
  321. - Added a signal for when a user gets locked out. [kencochrane]
  322. - Added AccessLog model to log all access attempts. [kencochrane]
  323. Keywords: authentication,django,pci,security
  324. Platform: UNKNOWN
  325. Classifier: Development Status :: 5 - Production/Stable
  326. Classifier: Environment :: Web Environment
  327. Classifier: Framework :: Django
  328. Classifier: Intended Audience :: Developers
  329. Classifier: Intended Audience :: System Administrators
  330. Classifier: License :: OSI Approved :: MIT License
  331. Classifier: Operating System :: OS Independent
  332. Classifier: Programming Language :: Python
  333. Classifier: Programming Language :: Python :: 2.7
  334. Classifier: Programming Language :: Python :: 3
  335. Classifier: Topic :: Internet :: Log Analysis
  336. Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
  337. Classifier: Topic :: Security
  338. Classifier: Topic :: System :: Logging