Skip to content

Commit bb4f1ab

Browse files
committed
Authentication
1 parent d1a0724 commit bb4f1ab

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

doc/concepts/configuration/configuration_authentication.rst

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

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

0 commit comments

Comments
 (0)