diff options
| author | jvoisin | 2018-11-18 15:37:00 +0100 |
|---|---|---|
| committer | jvoisin | 2018-11-18 15:37:00 +0100 |
| commit | 6075f6b13b4b37cc1a5c35fd8c84f83c9ba49aa6 (patch) | |
| tree | 72dc445b473d838aa64bf8a55c56cdac01699a33 /doc/source | |
| parent | 844722c54aaa390ef40e5bd41186828ee8b593db (diff) | |
Improve the cookie encryption documentation
This should close #261
Diffstat (limited to 'doc/source')
| -rw-r--r-- | doc/source/encryption.rst | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/source/encryption.rst b/doc/source/encryption.rst index 23f36b4..856927d 100644 --- a/doc/source/encryption.rst +++ b/doc/source/encryption.rst | |||
| @@ -49,26 +49,28 @@ Cookie encryption | |||
| 49 | 49 | ||
| 50 | The encryption is done via the `tweetnacl library <https://tweetnacl.cr.yp.to/>`_, | 50 | The encryption is done via the `tweetnacl library <https://tweetnacl.cr.yp.to/>`_, |
| 51 | thus using `curve25519 <https://en.wikipedia.org/wiki/Curve25519>`__, `xsalsa20 <https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant>`__ and `poly1305 <https://en.wikipedia.org/wiki/Poly1305>`__ for the encryption. We chose this | 51 | thus using `curve25519 <https://en.wikipedia.org/wiki/Curve25519>`__, `xsalsa20 <https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant>`__ and `poly1305 <https://en.wikipedia.org/wiki/Poly1305>`__ for the encryption. We chose this |
| 52 | library because of its portability, simplicity and reduced size (a single `.h` and | 52 | library because of its portability, license (public-domain), simplicity and reduced size (a single `.h` and |
| 53 | `.c` file.). | 53 | `.c` file.). |
| 54 | 54 | ||
| 55 | The key is derived from multiple sources, such as : | 55 | The key is derived from multiple sources, such as: |
| 56 | * The ``secret_key`` provided in the configuration. | 56 | * The ``secret_key`` provided in the configuration in the ``sp.global.secret_key`` |
| 57 | * An environment variable, such as the ``REMOTE_ADDR`` (remote IP address) or the *extended master secret* from TLS connections (`RFC7627 <https://tools.ietf.org/html/rfc7627>`_) | 57 | option. It's recommended to use something like ``head -c 256 /dev/urandom | tr -dc |
| 58 | * The user-agent. | 58 | 'a-zA-Z0-9'`` as a value. |
| 59 | * An optional environment variable, such as ``REMOTE_ADDR`` (remote IP address) or the *extended master secret* from TLS connections (`RFC7627 <https://tools.ietf.org/html/rfc7627>`_) in the ``sp.global.cookie_env_var`` option. | ||
| 60 | * The `user-agent <https://en.wikipedia.org/wiki/User_agent>`__. | ||
| 59 | 61 | ||
| 60 | 62 | ||
| 61 | .. warning:: | 63 | .. warning:: |
| 62 | 64 | ||
| 63 | To use this feature, you **must** set the :ref:`global.secret_key <config_global>` | 65 | To use this feature, you **must** set the :ref:`global.secret_key <config_global>` variable |
| 64 | and the :ref:`global.cookie_env_var <config_global>` variables. | 66 | and **should** set the :ref:`global.cookie_env_var <config_global>` one too. |
| 65 | This design decision prevents an attacker from | 67 | This design decision prevents an attacker from |
| 66 | `trivially bruteforcing <https://www.idontplaydarts.com/2011/11/decrypting-suhosin-sessions-and-cookies/>`_ | 68 | `trivially bruteforcing <https://www.idontplaydarts.com/2011/11/decrypting-suhosin-sessions-and-cookies/>`_ |
| 67 | or re-using session cookies. | 69 | or re-using session cookies. |
| 68 | If the simulation mode isn’t specified in the configuration, snuffleupagus will drop any request that it was unable to decrypt. | 70 | If the simulation mode isn’t specified in the configuration, snuffleupagus will drop any request that it was unable to decrypt. |
| 69 | 71 | ||
| 70 | Since PHP doesn't handle session cookie and non-session cookie in the same way, | 72 | Since PHP doesn't handle session cookie and non-session cookie in the same way, |
| 71 | thus we are providing two different ways. | 73 | so does Snuffleupagus. |
| 72 | 74 | ||
| 73 | 75 | ||
| 74 | Session cookie | 76 | Session cookie |
