diff --git a/doc/book/admin/access_control.rst b/doc/book/admin/access_control.rst index 18f5d82219..3a4e3333d1 100644 --- a/doc/book/admin/access_control.rst +++ b/doc/book/admin/access_control.rst @@ -4,6 +4,20 @@ Access control ================================================================================ + +.. NOTE:: + + Starting from crud 1.6.0 (crud-ee 1.7.3), the user on behalf of whom CRUD operations are performed through the router + must be granted privileges to execute CRUD read and write operations. + See the list of minimum required privileges for reading and writing through CRUD + in the :ref:`Minimum set of privileges in typical Tarantool scenarios ` section. + + Without these privileges, the user will get an access error when executing CRUD operations. + The error can occur either on the router side or on the storage side, depending on which component lacks the required permissions. + For example, the error may be caused by missing access to routing metadata, + missing ``read``/ ``write`` privileges for the target user space, or missing ``execute`` privileges to call the required ``crud.*`` methods on the router. + + This section explains how Tarantool makes it possible for administrators to prevent unauthorized access to the database and to certain functions. @@ -375,3 +389,134 @@ at start of the transaction using :doc:`/reference/reference_lua/box_session/syn To track all connects and disconnects, you can use :ref:`connection and authentication triggers `. + + +.. _authentication-users_minimal_priv: + +-------------------------------------------------------------------------------- +Minimum set of privileges in typical Tarantool scenarios +-------------------------------------------------------------------------------- + +This section provides a list of the minimum required privileges for the following typical Tarantool usage scenarios: + +- :ref:`Reading and writing data with CRUD ` + +.. _authentication-users_minimal_priv-crud_read_write: + +Reading and writing data with CRUD +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +CRUD passes the name of the user who initiated the operation on the router to the storage side. +The internal call is performed via the vshard service user, +after which CRUD switches to the forwarded user and executes the operation with that user’s privileges. + +For the correct operation of CRUD methods, the user on behalf of whom requests are made to the cluster through the +router must be granted a minimum set of privileges **on each storage instance**. + +Starting from crud 1.6.0, grant the user the required privileges on +the user spaces and, if applicable, on the DDL sharding metadata spaces. + +Starting from crud 1.7.0, also grant the user the ``read`` privilege +on the ``_bucket`` space. + +Router-side privileges +^^^^^^^^^^^^^^^^^^^^^^ + +It is **not recommended** to grant an application user the ``execute`` privilege on universe, +because it allows executing arbitrary Lua code and significantly broadens the user’s permissions. + +On the router, register only the required CRUD functions and grant the +application user permission to execute them: + +.. code-block:: lua + + local crud_functions = { + 'crud.select', + 'crud.get', + 'crud.insert', + 'crud.replace', + 'crud.update', + 'crud.upsert', + 'crud.delete', + } + + for _, name in ipairs(crud_functions) do + box.schema.func.create(name, { + setuid = false, + if_not_exists = true, + }) + box.schema.user.grant( + 'db_user', 'execute', 'function', name, + {if_not_exists = true} + ) + end + +Storage-side privileges +^^^^^^^^^^^^^^^^^^^^^^^ + +The minimum set of privileges on a storage instance depends on the enabled functionality and the CRUD version. +To read and write data, the user must have read and write access to the target user spaces, for example, the ``bands`` space: + +.. code-block:: lua + + box.schema.user.grant('db_user', 'read,write', 'space', 'bands') + +**Access to routing-related system spaces** + +* Read access to ``_bucket`` — starting from CRUD 1.7.0, storage-side operations ``bucket_ref``/ ``bucket_unref`` require it to verify the bucket state and ownership. +* If DDL-based routing metadata is used, ``read`` access to ``_ddl_sharding_key`` and ``_ddl_sharding_func`` is required. + + .. note:: + + Privileges for DDL sharding metadata are required only in configurations where + CRUD routing relies on metadata stored in DDL. + + CRUD loads sharding metadata from the system spaces + ``_ddl_sharding_key`` and ``_ddl_sharding_func``: + + * ``_ddl_sharding_key`` — sharding key metadata; + * ``_ddl_sharding_func`` — user-defined sharding function metadata. + + If the cluster uses a user-defined sharding function, you need to grant + read access to both spaces. + + .. code-block:: lua + + box.schema.user.grant('db_user', 'read', 'space', '_ddl_sharding_key') + box.schema.user.grant('db_user', 'read', 'space', '_ddl_sharding_func') + +Example: + +.. code-block:: lua + + box.schema.user.grant('db_user', 'read', 'space', '_bucket') + box.schema.user.grant('db_user', 'read', 'space', '_ddl_sharding_key') + box.schema.user.grant('db_user', 'read', 'space', '_ddl_sharding_func') + box.schema.user.grant('db_user', 'read,write', 'space', 'bands') + + +Internal vshard/CRUD calls on storage +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In some configurations (in particular, on Tarantool 2.x or when privileges are configured manually), internal calls on +storage may require ``execute`` privileges for a set of service functions ``vshard.storage.*``. + +.. note:: + + These ``execute`` privileges are required for the **vshard service user** (or for the **``sharding`` role**, if it is + used in the cluster), not for the application user (for example, ``db_user``). + + The application user must have: + + * router-side privileges to call the required ``crud.*`` methods; + * storage-side privileges for the required spaces (user spaces and, if applicable, routing metadata spaces such as + ``_bucket`` and DDL metadata spaces). + +Granting the ``execute`` privilege on ``universe`` to the application user is not recommended. + +.. note:: + + Without these privileges, the user will get an access error when executing CRUD operations. + The error can occur either on the router side or on the storage side, depending on which component lacks the required permissions. + For example, the error may be caused by missing access to routing metadata, + missing ``read``/``write`` privileges for the target user space, or missing ``execute`` privileges to call the required ``crud.*`` methods on the router. diff --git a/locale/ru/LC_MESSAGES/book/admin/access_control.po b/locale/ru/LC_MESSAGES/book/admin/access_control.po index b9ed740711..aaa35d0183 100644 --- a/locale/ru/LC_MESSAGES/book/admin/access_control.po +++ b/locale/ru/LC_MESSAGES/book/admin/access_control.po @@ -2,6 +2,38 @@ msgid "Access control" msgstr "Управление доступом" +msgid "" +"Starting from crud 1.6.0 (crud-ee 1.7.3), the user on behalf of whom CRUD " +"operations are performed through the router must be granted privileges to " +"execute CRUD read and write operations. See the list of minimum required " +"privileges for reading and writing through CRUD in the :ref:`Minimum set of " +"privileges in typical Tarantool scenarios `" +" section." +msgstr "" +"Начиная с версии crud 1.6.0 (crud-ee 1.7.3), перед началом работы для " +"пользователя, от имени которого выполняются CRUD-операции через роутер, " +"необходимо задать права на выполнение CRUD-операций чтения и записи данных. " +"Список минимально необходимых разрешений для чтения и записи через CRUD " +"приведен в разделе :ref:`Минимальный набор разрешений в типовых сценариях " +"Tarantool `." + + +msgid "" +"Without these privileges, the user will get an access error when executing " +"CRUD operations. The error can occur either on the router side or on the " +"storage side, depending on which component lacks the required permissions. " +"For example, the error may be caused by missing access to routing metadata, " +"missing ``read``/ ``write`` privileges for the target user space, or missing " +"``execute`` privileges to call the required ``crud.*`` methods on the router." +msgstr "" +"Без этих прав пользователь получит ошибку доступа при выполнении CRUD-" +"операций. Ошибка может возникать как на стороне роутера, так и на стороне " +"хранилища — в зависимости от того, какому компоненту не хватает необходимых " +"разрешений. Например, ошибка может быть вызвана отсутствием доступа к " +"метаданным маршрутизации, отсутствием прав ``read``/``write`` на целевой " +"пользовательский спейс или отсутствием права ``execute`` для вызова " +"необходимых методов ``crud.*`` на роутере." + msgid "" "This section explains " "how Tarantool makes it possible for administrators to prevent unauthorized " @@ -746,3 +778,199 @@ msgid "" msgstr "" "Чтобы отследить все подключения и отключения, можно использовать " ":ref:`триггеры соединений и аутентификации `." + +msgid "Minimum set of privileges in typical Tarantool scenarios" +msgstr "Минимальный набор разрешений в типовых сценариях Tarantool" + +msgid "" +"This section provides a list of the minimum required privileges for the " +"following typical Tarantool usage scenarios:" +msgstr "" +"В этом разделе приведен список минимально необходимых разрешений для " +"следующих типовых сценариев работы с Tarantool:" + +msgid "Reading and writing data with CRUD" +msgstr "Чтение и запись данных через модуль CRUD" + +msgid "Reading and writing data with CRUD" +msgstr "Чтение и запись данных через модуль CRUD" + +msgid "" +"CRUD passes the name of the user who initiated the operation on the router " +"to the storage side. The internal call is performed via the vshard service " +"user, after which CRUD switches to the forwarded user and executes the " +"operation with that user’s privileges." +msgstr "" +"CRUD передает на сторону хранилища имя пользователя, который инициировал " +"операцию на роутере. Внутренний вызов выполняется от имени служебного " +"пользователя vshard, после чего CRUD переключается на переданного " +"пользователя и выполняет операцию с его правами." + +msgid "" +"For the correct operation of CRUD methods, the user on behalf of whom " +"requests are made to the cluster through the router must be granted a " +"minimum set of privileges **on each storage instance**." +msgstr "" +"Для корректной работы методов CRUD пользователю, от имени которого " +"выполняются обращения к кластеру через роутер, необходимо предоставить " +"минимальный набор прав **на каждом экземпляре хранилища**." + +msgid "" +"Starting from crud 1.6.0, grant the user the required privileges on the " +"user spaces and, if applicable, on the DDL sharding metadata spaces." +msgstr "" +"Начиная с версии crud 1.6.0, выдайте пользователю необходимые права на " +"пользовательские спейсы и, если применимо, на спейсы метаданных шардирования " +"DDL." + +msgid "" +"Starting from crud 1.7.0, also grant the user the ``read`` privilege on the " +"``_bucket`` space." +msgstr "" +"Начиная с версии crud 1.7.0, также выдайте пользователю право ``read`` на " +"спейс ``_bucket``." + +msgid "Router-side privileges" +msgstr "Права на стороне роутера" + +msgid "" +"It is **not recommended** to grant an application user the ``execute`` " +"privilege on universe, because it allows executing arbitrary Lua code and " +"significantly broadens the user’s permissions." +msgstr "" +"Выдавать прикладному пользователю право ``execute`` на universe **не " +"рекомендуется**, поскольку оно позволяет выполнять произвольный Lua-код и " +"существенно расширяет полномочия пользователя." + +msgid "" +"On the router, register only the required CRUD functions and grant the " +"application user permission to execute them:" +msgstr "" +"На роутере зарегистрируйте только необходимые функции CRUD и выдайте " +"прикладному пользователю право на их вызов:" + +msgid "Storage-side privileges" +msgstr "Права на стороне хранилища" + +msgid "" +"The minimum set of privileges on a storage instance depends on the enabled " +"functionality and the CRUD version. To read and write data, the user must " +"have read and write access to the target user spaces, for example, the " +"``bands`` space:" +msgstr "" +"Минимальный набор прав на экземпляре хранилища зависит от включенной " +"функциональности и версии CRUD. Для чтения и записи данных у пользователя " +"должен быть доступ на чтение и запись к целевым пользовательским спейсам, " +"например к спейсу ``bands``:" + +msgid "**Access to routing-related system spaces**" +msgstr "**Доступ к системным спейсам, связанным с маршрутизацией**" + +msgid "" +"Read access to ``_bucket`` — starting from CRUD 1.7.0, storage-side " +"operations ``bucket_ref``/ ``bucket_unref`` require it to verify the bucket " +"state and ownership." +msgstr "" +"Доступ на чтение к ``_bucket`` — начиная с CRUD 1.7.0, операции " +"``bucket_ref``/``bucket_unref`` на стороне хранилища требуют его для " +"проверки состояния и принадлежности сегмента." + +msgid "" +"If DDL-based routing metadata is used, ``read`` access to " +"``_ddl_sharding_key`` and ``_ddl_sharding_func`` is required." +msgstr "" +"Если используются метаданные маршрутизации на основе DDL, требуется доступ " +"``read`` к ``_ddl_sharding_key`` и ``_ddl_sharding_func``." + +msgid "" +"Privileges for DDL sharding metadata are required only in configurations " +"where CRUD routing relies on metadata stored in DDL." +msgstr "" +"Права на метаданные шардирования DDL требуются только в конфигурациях, где " +"маршрутизация CRUD опирается на метаданные, хранящиеся в DDL." + +msgid "" +"CRUD loads sharding metadata from the system spaces ``_ddl_sharding_key`` " +"and ``_ddl_sharding_func``:" +msgstr "" +"CRUD загружает метаданные шардирования из системных спейсов " +"``_ddl_sharding_key`` и ``_ddl_sharding_func``:" + +msgid "``_ddl_sharding_key`` — sharding key metadata;" +msgstr "``_ddl_sharding_key`` — метаданные ключа шардирования;" + +msgid "" +"``_ddl_sharding_func`` — user-defined sharding function metadata." +msgstr "" +"``_ddl_sharding_func`` — метаданные пользовательской функции шардирования." + +msgid "" +"If the cluster uses a user-defined sharding function, you need to grant " +"read access to both spaces." +msgstr "" +"Если в кластере используется пользовательская функция шардирования, " +"необходимо выдать доступ на чтение к обоим спейсам." + +msgid "Example:" +msgstr "Пример:" + +msgid "Internal vshard/CRUD calls on storage" +msgstr "Внутренние вызовы vshard/CRUD на хранилище" + +msgid "" +"In some configurations (in particular, on Tarantool 2.x or when privileges " +"are configured manually), internal calls on storage may require ``execute`` " +"privileges for a set of service functions ``vshard.storage.*``." +msgstr "" +"В некоторых конфигурациях (в частности, на Tarantool 2.x или при настройке " +"прав вручную) внутренние вызовы на хранилище могут требовать права " +"``execute`` на набор служебных функций ``vshard.storage.*``." + +msgid "" +"These ``execute`` privileges are required for the **vshard service user** " +"(or for the **``sharding`` role**, if it is used in the cluster), not for " +"the application user (for example, ``db_user``)." +msgstr "" +"Эти права ``execute`` требуются **служебному пользователю vshard** (или " +"**роли ``sharding``**, если она используется в кластере), а не прикладному " +"пользователю (например, ``db_user``)." + +msgid "The application user must have:" +msgstr "Прикладной пользователь должен иметь:" + +msgid "router-side privileges to call the required ``crud.*`` methods;" +msgstr "права на стороне роутера для вызова необходимых методов ``crud.*``;" + +msgid "" +"storage-side privileges for the required spaces (user spaces and, if " +"applicable, routing metadata spaces such as ``_bucket`` and DDL metadata " +"spaces)." +msgstr "" +"права на стороне хранилища на необходимые спейсы (пользовательские спейсы " +"и, если применимо, спейсы метаданных маршрутизации, такие как ``_bucket`` и " +"спейсы метаданных DDL)." + +msgid "" +"Granting the ``execute`` privilege on ``universe`` to the application user " +"is not recommended." +msgstr "" +"Выдавать прикладному пользователю право ``execute`` на ``universe`` не " +"рекомендуется." + +msgid "" +"Without these privileges, the user will get an access error when executing " +"CRUD operations. The error can occur either on the router side or on the " +"storage side, depending on which component lacks the required permissions. " +"For example, the error may be caused by missing access to routing metadata, " +"missing ``read``/ ``write`` privileges for the target user space, or missing " +"``execute`` privileges to call the required ``crud.*`` methods on the router." +msgstr "" +"Без этих прав пользователь получит ошибку доступа при выполнении CRUD- " +"операций. Ошибка может возникать как на стороне роутера, так и на стороне " +"хранилища — в зависимости от того, какому компоненту не хватает необходимых " +"разрешений. Например, ошибка может быть вызвана отсутствием доступа к " +"метаданным маршрутизации, отсутствием прав ``read``/``write`` на целевой " +"пользовательский спейс или отсутствием права ``execute`` для вызова " +"необходимых методов ``crud.*`` на роутере." + +