PKG-INFO 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. Metadata-Version: 1.1
  2. Name: django-axes
  3. Version: 2.2.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 a supported Django version. The application is
  25. intended to work around the Django admin and the regular
  26. ``django.contrib.auth`` login-powered pages.
  27. Look at https://www.djangoproject.com/download/ to check if your version
  28. is supported.
  29. Installation
  30. ============
  31. You can install the latest stable package running this command::
  32. $ pip install django-axes
  33. Development
  34. ===========
  35. You can contribute to this project forking it from github and sending pull requests.
  36. Running tests
  37. -------------
  38. Clone the repository and install the django version you want. Then run::
  39. $ ./runtests.py
  40. Configuration
  41. =============
  42. Just add `axes` to your ``INSTALLED_APPS``::
  43. INSTALLED_APPS = (
  44. 'django.contrib.admin',
  45. 'django.contrib.auth',
  46. 'django.contrib.contenttypes',
  47. 'django.contrib.sessions',
  48. 'django.contrib.sites',
  49. ...
  50. 'axes',
  51. ...
  52. )
  53. Remember to run ``python manage.py migrate`` to sync the database.
  54. Customizing Axes
  55. ----------------
  56. You have a couple options available to you to customize ``django-axes`` a bit.
  57. These should be defined in your ``settings.py`` file.
  58. * ``AXES_LOGIN_FAILURE_LIMIT``: The number of login attempts allowed before a
  59. record is created for the failed logins. Default: ``3``
  60. * ``AXES_LOCK_OUT_AT_FAILURE``: After the number of allowed login attempts
  61. are exceeded, should we lock out this IP (and optional user agent)?
  62. Default: ``True``
  63. * ``AXES_USE_USER_AGENT``: If ``True``, lock out / log based on an IP address
  64. AND a user agent. This means requests from different user agents but from
  65. the same IP are treated differently. Default: ``False``
  66. * ``AXES_COOLOFF_TIME``: If set, defines a period of inactivity after which
  67. old failed login attempts will be forgotten. Can be set to a python
  68. timedelta object or an integer. If an integer, will be interpreted as a
  69. number of hours. Default: ``None``
  70. * ``AXES_LOGGER``: If set, specifies a logging mechanism for axes to use.
  71. Default: ``'axes.watch_login'``
  72. * ``AXES_LOCKOUT_TEMPLATE``: If set, specifies a template to render when a
  73. user is locked out. Template receives cooloff_time and failure_limit as
  74. context variables. Default: ``None``
  75. * ``AXES_LOCKOUT_URL``: If set, specifies a URL to redirect to on lockout. If
  76. both AXES_LOCKOUT_TEMPLATE and AXES_LOCKOUT_URL are set, the template will
  77. be used. Default: ``None``
  78. * ``AXES_VERBOSE``: If ``True``, you'll see slightly more logging for Axes.
  79. Default: ``True``
  80. * ``AXES_USERNAME_FORM_FIELD``: the name of the form field that contains your
  81. users usernames. Default: ``username``
  82. * ``AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP``: If ``True`` prevents to login
  83. from IP under particular user if attempts limit exceed, otherwise lock out
  84. based on IP.
  85. Default: ``False``
  86. * ``AXES_NEVER_LOCKOUT_WHITELIST``: If ``True``, users can always login from
  87. whitelisted IP addresses.
  88. Default: ``False``
  89. * ``AXES_BEHIND_REVERSE_PROXY``: If ``True``, it will look for the IP address from the header defined at ``AXES_REVERSE_PROXY_HEADER``. Please make sure if you enable this setting to configure your proxy to set the correct value for the header, otherwise you could be attacked by setting this header directly in every request.
  90. Default: ``False``
  91. * ``AXES_REVERSE_PROXY_HEADER``: If ``AXES_BEHIND_REVERSE_PROXY`` is ``True``, it will look for the IP address from this header.
  92. Default: ``HTTP_X_FORWARDED_FOR``
  93. Usage
  94. =====
  95. Using ``django-axes`` is extremely simple. All you need to do is periodically
  96. check the Access Attempts section of the admin.
  97. By default, django-axes will lock out repeated attempts from the same IP
  98. address. You can allow this IP to attempt again by deleting the relevant
  99. ``AccessAttempt`` records in the admin.
  100. You can also use the ``axes_reset`` management command using Django's
  101. ``manage.py``.
  102. * ``manage.py axes_reset`` will reset all lockouts and access records.
  103. * ``manage.py axes_reset ip`` will clear lockout/records for ip
  104. In your code, you can use ``from axes.utils import reset``.
  105. * ``reset()`` will reset all lockouts and access records.
  106. * ``reset(ip=ip)`` will clear lockout/records for ip
  107. * ``reset(username=username)`` will clear lockout/records for a username
  108. Issues
  109. ======
  110. Not being locked out after failed attempts
  111. ------------------------------------------
  112. You may find that Axes is not capturing your failed login attempts. It may
  113. be that you need to manually add watch_login to your login url.
  114. For example, in your urls.py::
  115. ...
  116. from my.custom.app import login
  117. from axes.decorators import watch_login
  118. ...
  119. urlpatterns = patterns('',
  120. (r'^login/$', watch_login(login)),
  121. ...
  122. Locked out without reason
  123. -------------------------
  124. It may happen that you have suddenly become locked out without a single failed
  125. attempt. One possible reason is that you are using some custom login form and the
  126. username field is named something different than "username", e.g. "email". This
  127. leads to all users attempts being lumped together. To fix this add the following
  128. to your settings:
  129. AXES_USERNAME_FORM_FIELD = "email"
  130. Using a captcha
  131. ===============
  132. Using https://github.com/mbi/django-simple-captcha you do the following:
  133. 1. Change axes lockout url in ``settings.py``::
  134. AXES_LOCKOUT_URL = '/locked'
  135. 2. Add the url in ``urls.py``::
  136. url(r'^locked/$', locked_out, name='locked_out'),
  137. 3. Create a captcha form::
  138. class AxesCaptchaForm(forms.Form):
  139. captcha = CaptchaField()
  140. 4. Create a captcha view for the above url that resets on captcha success and redirects::
  141. def locked_out(request):
  142. if request.POST:
  143. form = AxesCaptchaForm(request.POST)
  144. if form.is_valid():
  145. ip = get_ip_address_from_request(request)
  146. reset(ip=ip)
  147. return HttpResponseRedirect(reverse_lazy('signin'))
  148. else:
  149. form = AxesCaptchaForm()
  150. return render_to_response('locked_out.html', dict(form=form), context_instance=RequestContext(request))
  151. 5. Add a captcha template::
  152. <form action="" method="post">
  153. {% csrf_token %}
  154. {{ form.captcha.errors }}
  155. {{ form.captcha }}
  156. <div class="form-actions">
  157. <input type="submit" value="Submit" />
  158. </div>
  159. </form>
  160. Done.
  161. Changes
  162. =======
  163. 2.2.0 (2016-07-20)
  164. ------------------
  165. - Improve the logic when using a reverse proxy to avoid possible attacks.
  166. [camilonova]
  167. 2.1.0 (2016-07-14)
  168. ------------------
  169. - Add `default_app_config` so you can just use `axes` in `INSTALLED_APPS`
  170. [vdboor]
  171. 2.0.0 (2016-06-24)
  172. ------------------
  173. - Removed middleware to use app_config
  174. [camilonova]
  175. - Lots of cleaning
  176. [camilonova]
  177. - Improved test suite and versions
  178. [camilonova]
  179. 1.7.0 (2016-06-10)
  180. ------------------
  181. - Use render shortcut for rendering LOCKOUT_TEMPLATE
  182. [Radosław Luter]
  183. - Added app_label for RemovedInDjango19Warning
  184. [yograterol]
  185. - Add iso8601 translator.
  186. [mullakhmetov]
  187. - Edit json response. Context now contains ISO 8601 formatted cooloff time
  188. [mullakhmetov]
  189. - Add json response and iso8601 tests.
  190. [mullakhmetov]
  191. - Fixes issue 162: UnicodeDecodeError on pip install
  192. [joeribekker]
  193. - Added AXES_NEVER_LOCKOUT_WHITELIST option to prevent certain IPs from being locked out.
  194. [joeribekker]
  195. 1.6.1 (2016-05-13)
  196. ------------------
  197. - Fixes whitelist check when BEHIND_REVERSE_PROXY
  198. [Patrick Hagemeister]
  199. - Made migrations py3 compatible
  200. [mvdwaeter]
  201. - Fixing #126, possibly breaking compatibility with Django<=1.7
  202. [int-ua]
  203. - Add note for upgrading users about new migration files
  204. [kelseyq]
  205. - Fixes #148
  206. [camilonova]
  207. - Decorate auth_views.login only once
  208. [teeberg]
  209. - Set IP public/private classifier to be compliant with RFC 1918.
  210. [SilasX]
  211. - Issue #155. Lockout response status code changed to 403.
  212. [Артур Муллахметов]
  213. - BUGFIX: Missing migration
  214. [smeinel]
  215. 1.6.0 (2016-01-07)
  216. ------------------
  217. - Stopped using render_to_response so that other template engines work
  218. [tarkatronic]
  219. - Improved performance & DoS prevention on query2str
  220. [tarkatronic]
  221. - Immediately return from is_already_locked if the user is not lockable
  222. [jdunck]
  223. - Iterate over ip addresses only once
  224. [annp89]
  225. - added initial migration files to support django 1.7 &up. Upgrading users should run migrate --fake-initial after update
  226. [ibaguio]
  227. - Add db indexes to CommonAccess model
  228. [Schweigi]
  229. 1.5.0 (2015-09-11)
  230. ------------------
  231. - Fix #_get_user_attempts to include username when filtering AccessAttempts if AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP is True
  232. [afioca]
  233. 1.4.0 (2015-08-09)
  234. ------------------
  235. - Send the user_locked_out signal. Fixes #94.
  236. [toabi]
  237. 1.3.9 (2015-02-11)
  238. ------------------
  239. - Python 3 fix (#104)
  240. 1.3.8 (2014-10-07)
  241. ------------------
  242. - Rename GitHub organization from django-security to django-pci to emphasize focus on providing assistance with building PCI compliant websites with Django.
  243. [aclark4life]
  244. 1.3.7 (2014-10-05)
  245. ------------------
  246. - Explain common issues where Axes fails silently
  247. [cericoda]
  248. - Allow for user-defined username field for lookup in POST data
  249. [SteveByerly]
  250. - Log out only if user was logged in
  251. [zoten]
  252. - Support for floats in cooloff time (i.e: 0.1 == 6 minutes)
  253. [marianov]
  254. - 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.
  255. [peterkuma]
  256. - Improve get_ip to try for real ip address
  257. [7wonders]
  258. - 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.
  259. [polvoblanco]
  260. - Get first X-Forwarded-For IP
  261. [tutumcloud]
  262. - 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.
  263. [ericbulloch]
  264. - 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.
  265. [eht16]
  266. - Limit the length of the values logged into the database. Refs #73
  267. [camilonova]
  268. - Refactored tests to be more stable and faster
  269. [camilonova]
  270. - Clean client references
  271. [camilonova]
  272. - Fixed admin login url
  273. [camilonova]
  274. - Added django 1.7 for testing
  275. [camilonova]
  276. - Travis file cleanup
  277. [camilonova]
  278. - Remove hardcoded url path
  279. [camilonova]
  280. - Fixing tests for django 1.7
  281. [Andrew-Crosio]
  282. - Fix for django 1.7 exception not existing
  283. [Andrew-Crosio]
  284. - Removed python 2.6 from testing
  285. [camilonova]
  286. - Use django built-in six version
  287. [camilonova]
  288. - Added six as requirement
  289. [camilonova]
  290. - Added python 2.6 for travis testing
  291. [camilonova]
  292. - Replaced u string literal prefixes with six.u() calls
  293. [amrhassan]
  294. - Fixes object type issue, response is not an string
  295. [camilonova]
  296. - Python 3 compatibility fix for db_reset
  297. [nicois]
  298. - Added example project and helper scripts
  299. [barseghyanartur]
  300. - Admin command to list login attemps
  301. [marianov]
  302. - Replaced six imports with django.utils.six ones
  303. [amrhassan]
  304. - Replaced u string literal prefixes with six.u() calls to make it compatible with Python 3.2
  305. [amrhassan]
  306. - Replaced `assertIn`s and `assertNotIn`s with `assertContains` and `assertNotContains`
  307. [fcurella]
  308. - Added py3k to travis
  309. [fcurella]
  310. - Update test cases to be python3 compatible
  311. [nicois]
  312. - Python 3 compatibility fix for db_reset
  313. [nicois]
  314. - Removed trash from example urls
  315. [barseghyanartur]
  316. - Added django installer
  317. [barseghyanartur]
  318. - Added example project and helper scripts
  319. [barseghyanartur]
  320. 1.3.6 (2013-11-23)
  321. ------------------
  322. - Added AttributeError in case get_profile doesn't exist [camilonova]
  323. - Improved axes_reset command [camilonova]
  324. 1.3.5 (2013-11-01)
  325. ------------------
  326. - Fix an issue with __version__ loading the wrong version [graingert]
  327. 1.3.4 (2013-11-01)
  328. ------------------
  329. - Update README.rst for PyPI [marty] [camilonova] [graingert]
  330. - Add cooloff period [visualspace]
  331. 1.3.3 (2013-07-05)
  332. ------------------
  333. - Added 'username' field to the Admin table [bkvirendra]
  334. - 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]
  335. 1.3.2 (2013-03-28)
  336. ------------------
  337. - Fix an issue when a user logout [camilonova]
  338. - Match pypi version [camilonova]
  339. - Better User model import method [camilonova]
  340. - Use only one place to get the version number [camilonova]
  341. - Fixed an issue when a user on django 1.4 logout [camilonova]
  342. - Handle exception if there is not user profile model set [camilonova]
  343. - Made some cleanup and remove a pokemon exception handling [camilonova]
  344. - Improved tests so it really looks for the rabbit in the hole [camilonova]
  345. - Match pypi version [camilonova]
  346. 1.3.1 (2013-03-19)
  347. ------------------
  348. - Add support for Django 1.5 [camilonova]
  349. 1.3.0 (2013-02-27)
  350. ------------------
  351. - Bug fix: get_version() format string [csghormley]
  352. 1.2.9 (2013-02-20)
  353. ------------------
  354. - Add to and improve test cases [camilonova]
  355. 1.2.8 (2013-01-23)
  356. ------------------
  357. - Increased http accept header length [jslatts]
  358. 1.2.7 (2013-01-17)
  359. ------------------
  360. - Reverse proxy support [rmagee]
  361. - Clean up README [martey]
  362. 1.2.6 (2012-12-04)
  363. ------------------
  364. - Remove unused import [aclark4life]
  365. 1.2.5 (2012-11-28)
  366. ------------------
  367. - Fix setup.py [aclark4life]
  368. - Added ability to flag user accounts as unlockable. [kencochrane]
  369. - Added ipaddress as a param to the user_locked_out signal. [kencochrane]
  370. - Added a signal receiver for user_logged_out. [kencochrane]
  371. - Added a signal for when a user gets locked out. [kencochrane]
  372. - Added AccessLog model to log all access attempts. [kencochrane]
  373. Keywords: authentication,django,pci,security
  374. Platform: UNKNOWN
  375. Classifier: Development Status :: 5 - Production/Stable
  376. Classifier: Environment :: Web Environment
  377. Classifier: Framework :: Django
  378. Classifier: Intended Audience :: Developers
  379. Classifier: Intended Audience :: System Administrators
  380. Classifier: License :: OSI Approved :: MIT License
  381. Classifier: Operating System :: OS Independent
  382. Classifier: Programming Language :: Python
  383. Classifier: Programming Language :: Python :: 2.7
  384. Classifier: Programming Language :: Python :: 3
  385. Classifier: Topic :: Internet :: Log Analysis
  386. Classifier: Topic :: Security
  387. Classifier: Topic :: System :: Logging