| 1 | --- |
| 2 | features: |
| 3 | - | |
| 4 | [`blueprint per-user-auth-plugin-reqs <https://blueprints.launchpad.net/keystone/+spec/per-user-auth-plugin-reqs>`_] |
| 5 | Per-user Multi-Factor-Auth rules (MFA Rules) have been implemented. These |
| 6 | rules define which auth methods can be used (e.g. Password, TOTP) and |
| 7 | provides the ability to require multiple auth forms to successfully get |
| 8 | a token. |
| 9 | |
| 10 | The MFA rules are set via the user create and update API |
| 11 | (``POST/PATCH /v3/users``) call; the options allow an admin to force a user |
| 12 | to use specific forms of authentication or combinations of forms of |
| 13 | authentication to get a token. The rules are specified as follows:: |
| 14 | |
| 15 | user["options"]["multi_factor_auth_rules"] = [["password", "totp"], ["password", "custom-auth-method"]] |
| 16 | |
| 17 | The rules are specified as a list of lists. The elements of the sub-lists |
| 18 | must be strings and are intended to mirror the required authentication |
| 19 | method names (e.g. ``password``, ``totp``, etc) as defined in the |
| 20 | ``keystone.conf`` file in the ``[auth] methods`` option. |
| 21 | |
| 22 | Each list of methods specifies a rule. If the auth methods provided by a |
| 23 | user match (or exceed) the auth methods in the list, that rule is used. |
| 24 | The first rule found (rules will not be processed in a specific order) |
| 25 | that matches will be used. If a user has the ruleset defined as |
| 26 | ``[["password", "totp"]]`` the user must provide both password and totp |
| 27 | auth methods (and both methods must succeed) to receive a token. However, |
| 28 | if a user has a ruleset defined as ``[["password"], ["password", "totp"]]`` |
| 29 | the user may use the ``password`` method on it's own but would be required |
| 30 | to use both ``password`` and ``totp`` if ``totp`` is specified at all. |
| 31 | |
| 32 | Any auth methods that are not defined in ``keystone.conf`` in the |
| 33 | ``[auth] methods`` option are ignored when the rules are processed. Empty |
| 34 | rules are not allowed. If a rule is empty due to no-valid auth methods |
| 35 | existing within it, the rule is discarded at authentication time. If there |
| 36 | are no rules or no valid rules for the user, authentication occurs in the |
| 37 | default manner: any single configured auth method is sufficient to receive |
| 38 | a token. |
| 39 | |
| 40 | In the case a user should be exempt from MFA Rules, regardless if they are |
| 41 | set, the User-Option ``multi_factor_auth_enabled`` may be set to |
| 42 | ``False`` for that user via the user create and update API |
| 43 | (``POST/PATCH /v3/users``) call. If this option is set to ``False`` the |
| 44 | MFA rules will be ignored for the user. Any other value except ``False`` |
| 45 | will result in the MFA Rules being processed; the option can only be |
| 46 | a boolean (``True`` or ``False``) or "None" (which will result in the |
| 47 | default behavior (same as ``True``) but the option will no longer be shown |
| 48 | in the ``user["options"]`` dictionary. |
| 49 | |
| 50 | To mark a user exempt from the MFA Rules:: |
| 51 | |
| 52 | user["options"]["multi_factor_auth_enabled"] = False |
| 53 | |
| 54 | The ``token`` auth method typically should not be specified in any MFA |
| 55 | Rules. The ``token`` auth method will include all previous auth methods |
| 56 | for the original auth request and will match the appropriate ruleset. This |
| 57 | is intentional, as the ``token`` method is used for rescoping/changing |
| 58 | active projects. |
| 59 | |
| 60 | SECURITY INFO: The MFA rules are only processed when authentication happens |
| 61 | through the V3 authentication APIs. If V2 Auth is enabled it is possible to |
| 62 | circumvent the MFA rules if the user can authenticate via V2 Auth API. |
| 63 | It is recommended to disable V2 authentication for full enforcement of |
| 64 | the MFA rules. |