Skip to content

Commit 8ce794e

Browse files
committed
Config credentials: reference
1 parent ebed02a commit 8ce794e

File tree

1 file changed

+187
-37
lines changed

1 file changed

+187
-37
lines changed

doc/reference/configuration/configuration_reference.rst

Lines changed: 187 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ The ``config`` section defines various parameters related to centralized configu
332332
``config`` can be defined in the global :ref:`scope <configuration_scopes>` only.
333333

334334
* :ref:`config.reload <configuration_reference_config_reload>`
335-
* :ref:`config.context.* <configuration_reference_config_context_all>`
335+
* :ref:`config.context.* <configuration_reference_config_context_options>`
336336
* :ref:`config.etcd.* <configuration_reference_config_etcd>`
337337

338338
.. _configuration_reference_config_reload:
@@ -356,12 +356,12 @@ The ``config`` section defines various parameters related to centralized configu
356356
| Environment variable: TT_CONFIG_RELOAD
357357
358358

359-
.. _configuration_reference_config_context_all:
359+
.. _configuration_reference_config_context_options:
360360

361361
config.context.*
362362
~~~~~~~~~~~~~~~~
363363

364-
This section describes options related to loading configuration settings from external storage.
364+
This section describes options related to loading configuration settings from external storage such as external files or environment variables.
365365

366366
* :ref:`config.context <configuration_reference_config_context>`
367367

@@ -379,13 +379,8 @@ This section describes options related to loading configuration settings from ex
379379
**Since:** :doc:`3.0.0 </release/3.0.0>`.
380380

381381
Specify how to load settings from external storage.
382-
There are the following storage types:
383-
384-
* file
385-
* environment variable
386-
387382
For example, this option can be used to load passwords from safe storage.
388-
You can find the examples in :ref:`configuration_credentials_loading_secrets`.
383+
You can find examples in the :ref:`configuration_credentials_loading_secrets` section.
389384

390385
|
391386
| Type: map
@@ -397,26 +392,66 @@ This section describes options related to loading configuration settings from ex
397392

398393
.. confval:: config.context.<name>
399394

395+
The name of an entity that identifies a configuration value to load.
400396

401397
.. _configuration_reference_config_context_name_env:
402398

403399
.. confval:: config.context.<name>.env
404400

401+
The name of an environment variable to load a configuration value from.
402+
To load a configuration value from an environment variable, set :ref:`config.context.\<name\>.from <configuration_reference_config_context_name_from>` to ``env``.
403+
404+
**Example:**
405+
406+
In this example, passwords are loaded from the ``DBADMIN_PASSWORD`` and ``SAMPLEUSER_PASSWORD`` environment variables:
407+
408+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials_context_env/config.yaml
409+
:language: yaml
410+
:start-at: config:
411+
:end-before: credentials:
412+
:dedent:
413+
414+
See also: :ref:`configuration_credentials_loading_secrets`.
415+
405416

406417
.. _configuration_reference_config_context_name_from:
407418

408419
.. confval:: config.context.<name>.from
409420

421+
The type of storage to load a configuration value from.
422+
There are the following storage types:
423+
424+
* ``file``: load a configuration value from a file.
425+
In this case, you need to specify the path to the file using :ref:`config.context.\<name\>.file <configuration_reference_config_context_name_file>`.
426+
* ``env``: load a configuration value from an environment variable.
427+
In this case, specify the environment variable name using :ref:`config.context.\<name\>.env <configuration_reference_config_context_name_env>`.
428+
410429

411430
.. _configuration_reference_config_context_name_file:
412431

413432
.. confval:: config.context.<name>.file
414433

434+
The path to a file to load a configuration value from.
435+
To load a configuration value from a file, set :ref:`config.context.\<name\>.from <configuration_reference_config_context_name_from>` to ``file``.
436+
437+
**Example:**
438+
439+
In this example, passwords are loaded from the ``dbadmin_password.txt`` and ``sampleuser_password.txt`` files:
440+
441+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials_context_file/config.yaml
442+
:language: yaml
443+
:start-at: config:
444+
:end-before: credentials:
445+
:dedent:
446+
447+
See also: :ref:`configuration_credentials_loading_secrets`.
448+
415449

416450
.. _configuration_reference_config_context_name_rstrip:
417451

418452
.. confval:: config.context.<name>.rstrip
419453

454+
(Optional) Whether to strip whitespace characters and newlines from the end of data.
420455

421456

422457

@@ -610,116 +645,231 @@ This section describes options related to :ref:`storing configuration in etcd <c
610645
credentials
611646
-----------
612647

613-
.. TODO: https://github.com/tarantool/doc/issues/3666
648+
The ``credentials`` section allows you to create users and grant them the specified privileges.
649+
Learn more in :ref:`configuration_credentials`.
614650

615651
.. NOTE::
616652

617653
``credentials`` can be defined in any :ref:`scope <configuration_scopes>`.
618654

619655

620-
- :ref:`credentials.roles.* <configuration_reference_credentials_roles>`
621-
- :ref:`credentials.users.* <configuration_reference_credentials_users>`
622-
- :ref:`<user_or_role_name>.privileges.* <configuration_reference_credentials_privileges>`
656+
* :ref:`credentials.roles.* <configuration_reference_credentials_roles_options>`
657+
* :ref:`credentials.users.* <configuration_reference_credentials_users_options>`
658+
* :ref:`<user_or_role_name>.privileges.* <configuration_reference_credentials_privileges_options>`
623659

624660

625-
.. _configuration_reference_credentials_roles:
661+
.. _configuration_reference_credentials_roles_options:
626662

627-
.. confval:: credentials.roles
663+
credentials.roles.*
664+
~~~~~~~~~~~~~~~~~~~
628665

629-
| Type: map
630-
| Default: nil
631-
| Environment variable: TT_CREDENTIALS_ROLES
666+
* :ref:`credentials.roles <configuration_reference_credentials_roles>`
632667

668+
* :ref:`credentials.roles.\<role_name\>.roles <configuration_reference_credentials_roles_name_roles>`
669+
* :ref:`credentials.roles.\<role_name\>.privileges <configuration_reference_credentials_roles_name_privileges>`
633670

634-
.. _configuration_reference_credentials_users:
671+
.. _configuration_reference_credentials_roles:
635672

636-
.. confval:: credentials.users
673+
.. confval:: credentials.roles
637674

638-
| Type: map
639-
| Default: nil
640-
| Environment variable: TT_CREDENTIALS_USERS
675+
An array of :ref:`roles <access_control_concepts_roles>` that can be granted to users or other roles.
676+
677+
**Example:**
641678

679+
In the example below, the ``writers_space_reader`` role gets privileges to select data in the ``writers`` space:
642680

681+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/config.yaml
682+
:language: yaml
683+
:start-after: spaces: [ books ]
684+
:end-at: spaces: [ writers ]
685+
:dedent:
643686

644-
.. _configuration_reference_credentials_role:
687+
See also: :ref:`configuration_credentials_managing_users_roles`.
645688

646-
credentials.roles.*
647-
~~~~~~~~~~~~~~~~~~~
689+
| Type: map
690+
| Default: nil
691+
| Environment variable: TT_CREDENTIALS_ROLES
648692
649693
.. _configuration_reference_credentials_roles_name_roles:
650694

651695
.. confval:: credentials.roles.<role_name>.roles
652696

697+
An array of :ref:`roles <access_control_concepts_roles>` granted to this role.
653698

654699
.. _configuration_reference_credentials_roles_name_privileges:
655700

656701
.. confval:: credentials.roles.<role_name>.privileges
657702

658-
See :ref:`privileges <configuration_reference_credentials_privileges>`.
703+
An array of :ref:`privileges <authentication-owners_privileges>` granted to this role.
659704

705+
See :ref:`\<user_or_role_name\>.privileges.* <configuration_reference_credentials_privileges_options>`.
660706

661-
.. _configuration_reference_credentials_user:
707+
708+
.. _configuration_reference_credentials_users_options:
662709

663710
credentials.users.*
664711
~~~~~~~~~~~~~~~~~~~
665712

713+
* :ref:`credentials.users <configuration_reference_credentials_users>`
714+
715+
* :ref:`credentials.users.\<username\>.password <configuration_reference_credentials_users_name_password>`
716+
* :ref:`credentials.users.\<username\>.roles <configuration_reference_credentials_users_name_roles>`
717+
* :ref:`credentials.users.\<username\>.privileges <configuration_reference_credentials_users_name_privileges>`
718+
719+
.. _configuration_reference_credentials_users:
720+
721+
.. confval:: credentials.users
722+
723+
An array of :ref:`users <access_control_concepts_users>`.
724+
725+
**Example:**
726+
727+
In this example, ``sampleuser`` gets the following privileges:
728+
729+
* Privileges granted to the ``writers_space_reader`` role.
730+
* Privileges to select and modify data in the ``books`` space.
731+
732+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/config.yaml
733+
:language: yaml
734+
:start-at: sampleuser:
735+
:end-at: [ books ]
736+
:dedent:
737+
738+
See also: :ref:`configuration_credentials_managing_users_roles`.
739+
740+
| Type: map
741+
| Default: nil
742+
| Environment variable: TT_CREDENTIALS_USERS
743+
666744

667745
.. _configuration_reference_credentials_users_name_password:
668746

669747
.. confval:: credentials.users.<username>.password
670748

749+
A user's password.
750+
751+
**Example:**
752+
753+
In the example below, a password for the ``dbadmin`` user is set:
754+
755+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/config.yaml
756+
:language: yaml
757+
:start-at: credentials:
758+
:end-at: T0p_Secret
759+
:dedent:
760+
761+
See also: :ref:`configuration_credentials_loading_secrets`.
671762

672763
.. _configuration_reference_credentials_users_name_roles:
673764

674765
.. confval:: credentials.users.<username>.roles
675766

767+
An array of :ref:`roles <access_control_concepts_roles>` granted to this user.
676768

677769
.. _configuration_reference_credentials_users_name_privileges:
678770

679771
.. confval:: credentials.users.<username>.privileges
680772

681-
See :ref:`privileges <configuration_reference_credentials_privileges>`.
773+
An array of :ref:`privileges <authentication-owners_privileges>` granted to this user.
682774

775+
See :ref:`\<user_or_role_name\>.privileges.* <configuration_reference_credentials_privileges_options>`.
683776

684-
.. _configuration_reference_credentials_privileges:
777+
778+
.. _configuration_reference_credentials_privileges_options:
685779

686780
<user_or_role_name>.privileges.*
687781
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
688782

689-
.. _configuration_reference_credentials_users_name_privileges_permissions:
783+
* :ref:`\<user_or_role_name\>.privileges <configuration_reference_credentials_privileges>`
784+
785+
* :ref:`\<user_or_role_name\>.privileges.permissions <configuration_reference_credentials_privileges_permissions>`
786+
* :ref:`\<user_or_role_name\>.privileges.spaces <configuration_reference_credentials_privileges_spaces>`
787+
* :ref:`\<user_or_role_name\>.privileges.functions <configuration_reference_credentials_privileges_functions>`
788+
* :ref:`\<user_or_role_name\>.privileges.sequences <configuration_reference_credentials_privileges_sequences>`
789+
* :ref:`\<user_or_role_name\>.privileges.lua_eval <configuration_reference_credentials_privileges_lua_eval>`
790+
* :ref:`\<user_or_role_name\>.privileges.lua_call <configuration_reference_credentials_privileges_lua_call>`
791+
* :ref:`\<user_or_role_name\>.privileges.sql <configuration_reference_credentials_privileges_sql>`
792+
793+
.. _configuration_reference_credentials_privileges:
794+
795+
.. confval:: <user_or_role_name>.privileges
796+
797+
Privileges that can be granted to a user or role using the following options:
798+
799+
* :ref:`credentials.users.\<username\>.privileges <configuration_reference_credentials_users_name_privileges>`
800+
* :ref:`credentials.roles.\<role_name\>.privileges <configuration_reference_credentials_roles_name_privileges>`
801+
802+
.. _configuration_reference_credentials_privileges_permissions:
690803

691804
.. confval:: <user_or_role_name>.privileges.permissions
692805

806+
Permissions assigned to this user or a user with this role.
807+
808+
**Example:**
693809

694-
.. _configuration_reference_credentials_users_name_privileges_spaces:
810+
In this example, ``sampleuser`` gets privileges to select and modify data in the ``books`` space:
811+
812+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/config.yaml
813+
:language: yaml
814+
:start-at: sampleuser:
815+
:end-at: [ books ]
816+
:dedent:
817+
818+
See also: :ref:`configuration_credentials_managing_users_roles`.
819+
820+
.. _configuration_reference_credentials_privileges_spaces:
695821

696822
.. confval:: <user_or_role_name>.privileges.spaces
697823

824+
Spaces to which this user or a user with this role gets the specified permissions.
825+
826+
**Example:**
698827

699-
.. _configuration_reference_credentials_users_name_privileges_functions:
828+
In this example, ``sampleuser`` gets privileges to select and modify data in the ``books`` space:
829+
830+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/config.yaml
831+
:language: yaml
832+
:start-at: sampleuser:
833+
:end-at: [ books ]
834+
:dedent:
835+
836+
See also: :ref:`configuration_credentials_managing_users_roles`.
837+
838+
839+
.. _configuration_reference_credentials_privileges_functions:
700840

701841
.. confval:: <user_or_role_name>.privileges.functions
702842

843+
Functions to which this user or a user with this role gets the specified permissions.
703844

704-
.. _configuration_reference_credentials_users_name_privileges_sequences:
845+
846+
.. _configuration_reference_credentials_privileges_sequences:
705847

706848
.. confval:: <user_or_role_name>.privileges.sequences
707849

850+
Sequences to which this user or a user with this role gets the specified permissions.
851+
708852

709-
.. _configuration_reference_credentials_users_name_privileges_lua_eval:
853+
.. _configuration_reference_credentials_privileges_lua_eval:
710854

711855
.. confval:: <user_or_role_name>.privileges.lua_eval
712856

857+
Whether this user or a user with this role can execute arbitrary Lua code.
858+
713859

714-
.. _configuration_reference_credentials_users_name_privileges_lua_call:
860+
.. _configuration_reference_credentials_privileges_lua_call:
715861

716862
.. confval:: <user_or_role_name>.privileges.lua_call
717863

864+
Whether this user or a user with this role can call any global user-defined Lua function.
718865

719-
.. _configuration_reference_credentials_users_name_privileges_sql:
866+
867+
.. _configuration_reference_credentials_privileges_sql:
720868

721869
.. confval:: <user_or_role_name>.privileges.sql
722870

871+
Whether this user or a user with this role can execute an arbitrary SQL expression.
872+
723873

724874

725875

0 commit comments

Comments
 (0)