diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2015-07-25 11:11:49 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2015-07-25 11:11:49 -0400 |
| commit | 3bd0a6920af5a3fd2dc04f8a20027d71ada745dc (patch) | |
| tree | 4e934d8fc7e34f3ca9e0a51fb1d2bec66d048958 /docs/lib | |
| parent | 5b79dd7fa81171e3a5e3601ccde2315354eb125b (diff) | |
| parent | ef13f80854a8694bc8f1674207a0a02b91139a66 (diff) | |
| download | passlib-3bd0a6920af5a3fd2dc04f8a20027d71ada745dc.tar.gz | |
Merge
Diffstat (limited to 'docs/lib')
| -rw-r--r-- | docs/lib/passlib.apache.rst | 9 | ||||
| -rw-r--r-- | docs/lib/passlib.context.rst | 7 | ||||
| -rw-r--r-- | docs/lib/passlib.exc.rst | 4 | ||||
| -rw-r--r-- | docs/lib/passlib.ext.django.rst | 7 | ||||
| -rw-r--r-- | docs/lib/passlib.hash.bcrypt.rst | 68 | ||||
| -rw-r--r-- | docs/lib/passlib.hash.bcrypt_sha256.rst | 1 | ||||
| -rw-r--r-- | docs/lib/passlib.totp.rst | 76 |
7 files changed, 151 insertions, 21 deletions
diff --git a/docs/lib/passlib.apache.rst b/docs/lib/passlib.apache.rst index 4fb89a7..a342492 100644 --- a/docs/lib/passlib.apache.rst +++ b/docs/lib/passlib.apache.rst @@ -52,6 +52,15 @@ A quick summary of its usage:: someuser:$apr1$T4f7D9ly$EobZDROnHblCNPCtrgh5i/ anotheruser:$apr1$vBdPWvh1$GrhfbyGvN/7HalW5cS9XB1 +.. warning:: + + :class:`!HtpasswdFile` currently defaults to using :class:`!apr_md5_crypt`, + as this is the only htpasswd hash guaranteed to be portable across operating systems. + However, for security reasons Passlib 1.7 will default to using the strongest algorithm + available on the host platform (e.g. :class:`!bcrypt` or :class:`!sha256_crypt`). + Applications that are relying on the old behavior should specify + ``HtpasswdFile(default_scheme="portable")`` (new in Passlib 1.6.3). + .. autoclass:: HtpasswdFile(path=None, new=False, autosave=False, ...) .. index:: Apache; htdigest diff --git a/docs/lib/passlib.context.rst b/docs/lib/passlib.context.rst index 6d40067..4043aac 100644 --- a/docs/lib/passlib.context.rst +++ b/docs/lib/passlib.context.rst @@ -163,8 +163,11 @@ Options which directly affect the behavior of the CryptContext instance: or fractional number of seconds. .. deprecated:: 1.6 - This option has not proved very useful, and will - be removed in version 1.8. + This option has not proved very useful, is ignored by 1.7, + and will be removed in version 1.8. + + .. versionchanged:: 1.7 + Per deprecation roadmap above, this option is now ignored. .. _context-algorithm-options: diff --git a/docs/lib/passlib.exc.rst b/docs/lib/passlib.exc.rst index 96be468..f40d6f3 100644 --- a/docs/lib/passlib.exc.rst +++ b/docs/lib/passlib.exc.rst @@ -17,6 +17,10 @@ Exceptions .. autoexception:: PasswordSizeError +.. autoexception:: PasslibSecurityError + +.. autoexception:: TokenReuseError + Warnings ======== .. autoexception:: PasslibWarning diff --git a/docs/lib/passlib.ext.django.rst b/docs/lib/passlib.ext.django.rst index 909848c..28e7a3b 100644 --- a/docs/lib/passlib.ext.django.rst +++ b/docs/lib/passlib.ext.django.rst @@ -8,10 +8,9 @@ .. versionadded:: 1.6 -.. note:: +.. versionchanged:: 1.7 - Passlib 1.7's :mod:`passlib.ext.django` extension will drop - support for Django 1.3 and earlier, and require Django 1.4 or newer. + As of Passlib 1.7, this module requires Django 1.6 or newer. This module contains a `Django <http://www.djangoproject.com>`_ plugin which overrides all of Django's password hashing functions, replacing them @@ -41,7 +40,7 @@ of uses: This plugin should be considered "release candidate" quality. It works, and has good unittest coverage, but has seen only limited real-world use. Please report any issues. - It has been tested with Django 0.9.6 - 1.4. + It has been tested with Django 1.6 - 1.8. Installation ============= diff --git a/docs/lib/passlib.hash.bcrypt.rst b/docs/lib/passlib.hash.bcrypt.rst index 041a2bf..55566fa 100644 --- a/docs/lib/passlib.hash.bcrypt.rst +++ b/docs/lib/passlib.hash.bcrypt.rst @@ -32,7 +32,6 @@ for new applications. This class can be used directly as follows:: It is strongly recommended that you install `bcrypt <https://pypi.python.org/pypi/bcrypt>`_ - or `py-bcrypt <https://pypi.python.org/pypi/py-bcrypt>`_ when using this hash. .. seealso:: the generic :ref:`PasswordHash usage examples <password-hash-examples>` @@ -46,23 +45,30 @@ Interface .. index:: pair: environmental variable; PASSLIB_BUILTIN_BCRYPT -.. note:: +Bcrypt Backends +--------------- + +This class will use the first available of five possible backends: - This class will use the first available of five possible backends: +1. `bcrypt <https://pypi.python.org/pypi/bcrypt>`_, if installed. +2. `py-bcrypt <https://pypi.python.org/pypi/py-bcrypt>`_, if installed. +3. `bcryptor <https://bitbucket.org/ares/bcryptor/overview>`_, if installed. +4. stdlib's :func:`crypt.crypt()`, if the host OS supports BCrypt + (primarily BSD-derived systems). +5. A pure-python implementation of BCrypt, built into Passlib. - 1. `bcrypt <https://pypi.python.org/pypi/bcrypt>`_, if installed. - 2. `py-bcrypt <https://pypi.python.org/pypi/py-bcrypt>`_, if installed. - 3. `bcryptor <https://bitbucket.org/ares/bcryptor/overview>`_, if installed. - 4. stdlib's :func:`crypt.crypt()`, if the host OS supports BCrypt - (primarily BSD-derived systems). - 5. A pure-python implementation of BCrypt, built into Passlib. +If no backends are available, :meth:`encrypt` and :meth:`verify` +will throw :exc:`~passlib.exc.MissingBackendError` when they are invoked. +You can check which backend is in use by calling :meth:`!bcrypt.get_backend()`. - If no backends are available, :meth:`encrypt` and :meth:`verify` - will throw :exc:`~passlib.exc.MissingBackendError` when they are invoked. - You can check which backend is in use by calling :meth:`!bcrypt.get_backend()`. +As of Passlib 1.6.3, a one-time check is peformed when the backend is first loaded, +to detect the backend's capabilities & bugs. If this check detects a fatal bug, +a :exc:`~passlib.exc.PasslibSecurityError` will be raised. This generally means +you need to upgrade the external package being used as the backend +(this will be detailed in the error message). .. warning:: - The pure-python backend (#5) is disabled by default! + *The pure-python backend (#5) is disabled by default!* That backend is currently too slow to be usable given the number of rounds required for security. That said, if you have no other alternative and need to use it, @@ -70,7 +76,7 @@ Interface before importing Passlib. What's "too slow"? Passlib's :ref:`rounds selection guidelines <rounds-selection-guidelines>` - currently require BCrypt be able to do >= 12 cost in <= 300ms. By this standard + currently require BCrypt be able to do at least 12 cost in under 300ms. By this standard the pure-python backend is 128x too slow under CPython 2.7, and 16x too slow under PyPy 1.8. (speedups are welcome!) @@ -171,6 +177,37 @@ This implementation of bcrypt differs from others in a few ways: does not support this algorithmic variant either, though it should be *very* rarely encountered in practice. + .. versionchanged:: 1.6.3 + + Passlib will now detect, and refuse to use, any backend which is vulnerable + to this bug. + +* The 'BSD wraparound' bug + + .. _bsd-wraparound-bug: + + OpenBSD <= 5.4, and most bcrypt libraries derived from it's source, + are vulnerable to a 'wraparound' bug [#wraparound]_, where passwords larger + than 254 characters will be incorrectly hashed using only the first few + characters of the string, resulting in a severely weakened hash. + + OpenBSD 5.5 `fixed <http://undeadly.org/cgi?action=article&sid=20140224132743>`_ this flaw, + and introduced the ``$2b$`` hash identifier to indicate the hash was generated with the correct + algorithm. + + py-bcrypt <= 0.4 is known to be vulnerable to this, as well as the os_crypt + backend (if running on a vulnerable operating system). + + Passlib 1.6.3 adds the following: + + * Support for the ``$2b$`` hash format (though for backward compat it has not been made + the default yet). + + * Detects if the active backend is vulnerable to the bug, issues a warning, + and enables a workaround so that vulnerable passwords will still be hashed correctly. + (This does mean that existing hashes suffering this vulnerability will no longer verify + using their correct password). + .. rubric:: Footnotes .. [#f1] the bcrypt format specification - @@ -181,3 +218,6 @@ This implementation of bcrypt differs from others in a few ways: .. [#eight] The flaw in pre-1.1 crypt_blowfish is described here - `CVE-2011-2483 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-2483>`_ + +.. [#wraparound] The wraparound flaw is described here - + `<http://www.openwall.com/lists/oss-security/2012/01/02/4>`_
\ No newline at end of file diff --git a/docs/lib/passlib.hash.bcrypt_sha256.rst b/docs/lib/passlib.hash.bcrypt_sha256.rst index 22420db..255455f 100644 --- a/docs/lib/passlib.hash.bcrypt_sha256.rst +++ b/docs/lib/passlib.hash.bcrypt_sha256.rst @@ -34,7 +34,6 @@ This class can be used directly as follows:: It is strongly recommended that you install `bcrypt <https://pypi.python.org/pypi/bcrypt>`_ - or `py-bcrypt <https://pypi.python.org/pypi/py-bcrypt>`_ when using this hash. See :doc:`passlib.hash.bcrypt` for more details. Interface diff --git a/docs/lib/passlib.totp.rst b/docs/lib/passlib.totp.rst new file mode 100644 index 0000000..2b4aae8 --- /dev/null +++ b/docs/lib/passlib.totp.rst @@ -0,0 +1,76 @@ +.. module:: passlib.totp + :synopsis: totp / two factor authentaction + +======================================================= +:mod:`passlib.totp` -- TOTP / Two Factor Authentication +======================================================= + +.. versionadded:: 1.7 + +.. todo:: + + This module is still a work in progress, it's API may change before release. + + Things left: + + * finish unittests (there are a few cases left) + * write narrative documentation + * get api documentation formatted better (whether by getting nested sections integrated into TOC, + or splitting nested sections out into separate sections / pages). + * probably want a "beta" release of passlib so people can test this a bit before 1.7.0. + + Optional: + + * more verification against other TOTP servers & clients. + * consider native pyqrcode integration (e.g. a ``to_qrcode()`` method) + +.. rst-class:: emphasize-children + +API Reference +============= + +Common Interface +---------------- +.. autoclass:: BaseOTP() + +TOTP (Timed-based tokens) +------------------------- +.. autoclass:: TOTP(key=None, format="base32", \*, new=False, \*\*kwds) + +Helper Classes +.............. + +.. autoclass:: TotpToken() + +.. autoclass:: TotpMatch() + +HOTP (Counter-based tokens) +--------------------------- +.. note:: + + HOTP is used much less frequently, since it's fragile + (as it's much easier for the server & client to get out of sync in their token + count). Unless you have a particular reason, you probably want :class:`TOTP` instead. + +.. autoclass:: HOTP(key=None, format="base32", \*, new=False, \*\*kwds) + +Helper Classes +.............. + +.. autoclass:: HotpMatch() + +Deviations +========== + +* The TOTP Spec [#totpspec]_ includes an potentially offset from the base time (``T0``). + Passlib omits this (fixing it at ``0``), but so do pretty much all other TOTP implementations. + +.. rubric:: Footnotes + +.. [#hotpspec] HOTP Specification - :rfc:`4226` + +.. [#totpspec] TOTP Specification - :rfc:`6238` + +.. [#uriformat] Google's OTPAuth URI format - + `<https://code.google.com/p/google-authenticator/wiki/KeyUriFormat>`_ + |
