Skip to content

Commit 921c7c5

Browse files
committed
Authentication
1 parent d1a0724 commit 921c7c5

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

doc/concepts/configuration/configuration_authentication.rst

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,108 @@
33
Authentication
44
==============
55

6+
.. admonition:: Enterprise Edition
7+
:class: fact
8+
9+
Authentication features are supported by the `Enterprise Edition <https://www.tarantool.io/compare/>`_ only.
10+
11+
.. _enterprise-auth-restrictions:
12+
13+
Authentication restrictions
14+
---------------------------
15+
16+
Tarantool Enterprise Edition provides the ability to apply additional restrictions for user authentication.
17+
For example, you can specify the minimum time between authentication attempts
18+
or turn off access for guest users.
19+
20+
In the configuration below, :ref:`security.auth_retries <configuration_reference_security_auth_retries>` is set to ``2``,
21+
which means that Tarantool lets a client try to authenticate with the same username three times.
22+
At the fourth attempt, the authentication delay configured with :ref:`security.auth_delay <configuration_reference_security_auth_delay>` is enforced.
23+
This means that a client should wait 10 seconds after the first failed attempt.
24+
25+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/security_auth_restrictions/config.yaml
26+
:language: yaml
27+
:start-at: security:
28+
:end-at: disable_guest
29+
:dedent:
30+
31+
The :ref:`disable_guest <configuration_reference_security_disable_guest>` option turns off access over remote connections from unauthenticated or :ref:`guest <authentication-passwords>` users.
32+
33+
34+
.. _enterprise-password-policy:
35+
36+
Password policy
37+
---------------
38+
39+
A password policy allows you to improve database security by enforcing the use
40+
of strong passwords, setting up a maximum password age, and so on.
41+
When you create a new user with
42+
:doc:`box.schema.user.create </reference/reference_lua/box_schema/user_create>`
43+
or update the password of an existing user with
44+
:doc:`box.schema.user.passwd </reference/reference_lua/box_schema/user_passwd>`,
45+
the password is checked against the configured password policy settings.
46+
47+
In the example below, the following options are specified:
48+
49+
- :ref:`password_min_length <configuration_reference_security_password_min_length>` specifies that a password should be at least 16 characters.
50+
- :ref:`password_enforce_lowercase <configuration_reference_security_password_enforce_lowercase>` and :ref:`password_enforce_uppercase <configuration_reference_security_password_enforce_uppercase>` specify that a password should contain lowercase and uppercase letters.
51+
- :ref:`password_enforce_digits <configuration_reference_security_password_enforce_digits>` and :ref:`password_enforce_specialchars <configuration_reference_security_password_enforce_specialchars>` specify that a password should contain digits and at least one special character.
52+
- :ref:`password_lifetime_days <configuration_reference_security_password_lifetime_days>` sets a maximum password age to 365 days.
53+
- :ref:`password_history_length <configuration_reference_security_password_history_length>` specifies that a new password should differ from the last three passwords.
54+
55+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/security_password_policy/config.yaml
56+
:language: yaml
57+
:start-at: security:
58+
:end-at: password_history_length
59+
:dedent:
60+
61+
62+
63+
64+
.. _enterprise-authentication-protocol:
65+
66+
Authentication protocol
67+
-----------------------
68+
69+
By default, Tarantool uses the
70+
`CHAP <https://en.wikipedia.org/wiki/Challenge-Handshake_Authentication_Protocol>`_
71+
protocol to authenticate users and applies ``SHA-1`` hashing to
72+
:ref:`passwords <authentication-passwords>`.
73+
Note that CHAP stores password hashes in the ``_user`` space unsalted.
74+
If an attacker gains access to the database, they may crack a password, for example, using a `rainbow table <https://en.wikipedia.org/wiki/Rainbow_table>`_.
75+
76+
In the Enterprise Edition, you can enable
77+
`PAP <https://en.wikipedia.org/wiki/Password_Authentication_Protocol>`_ authentication
78+
with the ``SHA256`` hashing algorithm.
79+
For PAP, a password is salted with a user-unique salt before saving it in the database,
80+
which keeps the database protected from cracking using a rainbow table.
81+
82+
To enable PAP, specify the :ref:`security.auth_type <configuration_reference_security_auth_type>` option as follows:
83+
84+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/security_auth_protocol/config.yaml
85+
:language: yaml
86+
:start-at: security:
87+
:end-at: pap-sha256
88+
:dedent:
89+
90+
For new users, the :doc:`box.schema.user.create </reference/reference_lua/box_schema/user_create>` method generates authentication data using ``PAP-SHA256``.
91+
For existing users, you need to reset a password using
92+
:doc:`box.schema.user.passwd </reference/reference_lua/box_schema/user_passwd>`
93+
to use the new authentication protocol.
94+
95+
.. warning::
96+
97+
Given that ``PAP`` transmits a password as plain text,
98+
Tarantool requires configuring :ref:`SSL/TLS <configuration_connections_ssl>`
99+
for a connection.
100+
101+
The example below shows how to specify the authentication protocol using the ``auth_type`` parameter when connecting to an instance using :doc:`net.box </reference/reference_lua/net_box>`:
102+
103+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/security_auth_protocol/myapp.lua
104+
:language: lua
105+
:start-at: local connection
106+
:end-before: return connection
107+
:dedent:
108+
109+
If the authentication protocol isn't specified explicitly on the client side,
110+
the client uses the protocol configured on the server via ``security.auth_type``.

0 commit comments

Comments
 (0)