Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ $ vault write identity/mfa/method/totp \
digits=6
```

Using the TOTP `method_id` and an `entity_id` from after a sucessful MFA login. Use these to generate a QR code.
Vault generates an `entity_id` for users after a successful login. Use the TOTP `method_id` and the `entity_id` of the target user to generate a QR code.

```shell-session
$ vault write -field=barcode \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ $ vault write identity/mfa/method/totp \
digits=6
```

Using the TOTP `method_id` and an `entity_id` from after a sucessful MFA login. Use these to generate a QR code.
Vault generates an `entity_id` for users after a successful login. Use the TOTP `method_id` and the `entity_id` of the target user to generate a QR code.

```shell-session
$ vault write -field=barcode \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ $ vault write identity/mfa/method/totp \
digits=6
```

Using the TOTP `method_id` and an `entity_id` from after a sucessful MFA login. Use these to generate a QR code.
Vault generates an `entity_id` for users after a successful login. Use the TOTP `method_id` and the `entity_id` of the target user to generate a QR code.

```shell-session
$ vault write -field=barcode \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This endpoint creates an MFA method of type TOTP.
|:-------|:----------------------------|
| `POST` | `/identity/mfa/method/totp` |

### Parameters
### Request parameters

- `method_name` `(string)` - The unique name identifier for this MFA method. Supported from Vault 1.13.0.

Expand All @@ -33,6 +33,9 @@ This endpoint creates an MFA method of type TOTP.

- `max_validation_attempts` `(int: 5)` - The maximum number of consecutive failed validation attempts.

- `enable_self_enrollment` `(bool: false)` - <EnterpriseAlert product="vault" inline /> When enabled, allows users to setup TOTP for their account by generating
a TOTP secret (QR code) during login if they do not already have one.

### Sample payload

```json
Expand All @@ -59,11 +62,13 @@ This endpoint updates the configuration of an MFA method of type TOTP.
|:-------|:---------------------------------------|
| `POST` | `/identity/mfa/method/totp/:method_id` |

### Parameters
### Path parameters

- `method_id` `(string: <required>)` - UUID of the MFA method.

- and all of the parameters documented under the preceding "Create" endpoint.
### Request parameters

All of the parameters documented under the preceding ["Create"](#create-totp-mfa-method) endpoint.

### Sample payload

Expand All @@ -88,7 +93,7 @@ ID.
|:-------|:---------------------------------------|
| `GET` | `/identity/mfa/method/totp/:method_id` |

### Parameters
### Path parameters

- `method_id` `(string: <required>)` – UUID of the MFA method.

Expand Down Expand Up @@ -129,7 +134,7 @@ by a [login enforcement](/vault/api-docs/secret/identity/mfa/login-enforcement).
|:---------|:---------------------------------------|
| `DELETE` | `/identity/mfa/method/totp/:method_id` |

### Parameters
### Path parameters

- `method_id` `(string: <required>)` - UUID of the MFA method.

Expand Down Expand Up @@ -182,7 +187,7 @@ method ID.
|:-------|:-------------------------------------|
| `POST` | `/identity/mfa/method/totp/generate` |

### Parameters
### Request parameters

- `method_id` `(string: <required>)` - UUID of the MFA method.

Expand Down Expand Up @@ -225,7 +230,7 @@ the `admin-generate` API stores the generated secret on the given entity ID.
|:-------|:-------------------------------------------|
| `POST` | `/identity/mfa/method/totp/admin-generate` |

### Parameters
### Request parameters

- `method_id` `(string: <required>)` - UUID of the MFA method.

Expand Down Expand Up @@ -275,7 +280,7 @@ secret.
|:-------|:------------------------------------------|
| `POST` | `/identity/mfa/method/totp/admin-destroy` |

### Parameters
### Request parameters

- `method_id` `(string: <required>)` - UUID of the MFA method.

Expand All @@ -300,3 +305,51 @@ $ curl \
--data @payload.json \
http://127.0.0.1:8200/v1/identity/mfa/method/totp/admin-destroy
```

## Self-enroll in TOTP MFA <EnterpriseAlert product="vault" inline />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increased this header size so it is now included in the page table of contents

Image


The self-enroll endpoint lets users setup TOTP MFA by generating a TOTP
secret (QR code) during login if they do not already have one. To use
self-enrollment you must set [`enable_self_enrollment`](./totp#enable_self_enrollment) to `true` for the TOTP MFA
method.

| Method | Path |
|:-------|:----------------------------------------|
| `POST` | `/identity/mfa/method/totp/self-enroll` |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth mentioning somewhere that the UI only enters the self-enroll workflow if only one enforcement is configured because that's when /validate returns self_enrollment_enabled: true? Maybe in the section Configure the TOTP Method.

Technically, users could circumvent this by manually requesting self-enroll via curl, right? Though, I'm not sure it's worth going into that level of detail...

@kubawi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point, I completely forgot about that. Yes, I think we should mention it wherever we can as long as this makes sense, to avoid users being confused. Maybe it would make sense to add screenshots of the whole flow somewhere? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - I was holding off on screenshots until I heard back from the education team (since I just took a best guess at where to add docs 😂 )

But yes - @schavis - do you have thoughts on:

  1. If and where we should add screenshots to walkthrough the UI login flow?
  2. Where we should callout that even if enable_self_enrollment is configured to true the UI will only enter self-enroll if only one MFA login enforcement is configured.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what happened to my original reply from last night =\

If and where we should add screenshots to walkthrough the UI login flow?

In general, we try to limit the number of screenshots due to the maintenance burden. Is there a "hero" screenshot we can reference to help folks orient themselves in the GUI?

Where we should callout that even if enable_self_enrollment is configured to true

Since we're essentially calling out a configuration gotcha, I'd recommend adding it as part of the instructions under "Option 1: Configure TOTP for self-enrollment".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The QR code appears after the user logs in, so I'm not sure that it would provide much of a benefit. I'm thinking we can add it later, if we think it'd be helpful, but for now I don't think it's necessary.

I'll add below!


### Request parameters

- `mfa_request_id` `(string: <required>)` - The unique identifier of an MFA
requirement in the authentication response of a login request.

- `mfa_method_id` `(string: <required>)` - UUID of the MFA method.

### Sample payload

```json
{
"mfa_request_id": "5879c74a-1418-1948-7be9-97b209d693a7",
"mfa_method_id": "4746fb81-028c-cd4e-026b-7dd18fe4c2f4"
}
```

### Sample request

```shell-session
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/identity/mfa/method/totp/self-enroll
```

### Sample response
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this, contents is copy/pasted from the sample output above


```json
{
"data": {
"barcode": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADIEAAAAADYoy0BAAAGZElEQVR4nOyd7W4jNwxFkyLv/8pbpMAAHnUo8pJyc1Oc82OB2KOP9QVFSyTlrz9/PsCIv356AnDn6/ufz89e48i6ov6u59f319ezfqtWnf2/snHX19XnVL7bYyFmIIgZCGLG5/e61V2b37WWXkRr9+lxonEvqv1XfeHK6/NYiBkIYgaCmPH19GK2j4ieX9/P9h0R2T6l+pzqYzKfmM0zQvk8sRAzEMQMBDHj0YdMqa6Z1TOvyDdF/VTPnqLnVzIfePLEHAsxA0HMQBAz3uJDqvuVbO1Vv/934yzReNV4ykmwEDMQxAwEMePRh5xeG6fxjNXnVM+Y1HHVM7Tq56R8nliIGQhiBoKYcfMhp2LT6hp7UY2hV8dTY/KZT1N9SufzxELMQBAzEMSMf3zI6X2HembUXbuz8dT9g+qLIiafJxZiBoKYgSBm3OpDunlMartTubrdeEUWI1dzAqa5wK9gIWYgiBkIYsaReIi6P1jbqd/7qznDqm9SfcKJs6sVLMQMBDEDQcz43K3z3fqLaf336fiFymQf8dRe8aVYiBkIYgaCmHHzIdW8pGo8QT1rOuULTvkc9a6TqD+lTgULMQNBzEAQMx7jIRdqjV7ULvpbrReJxl/nodYodseLxu/GWz6wED8QxAwEMeN2X9ZK9/4neRLDNfrUc919yPp8t/8PLMQPBDEDQcyQ6tTVO0JWqvGT6PWu75jub6L+T/kg4iHGIIgZCGLGKB5yKn5SpVuDWKXrI0/4jgss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6FDVmruaBTWsU1bMwdT67/zcWYgaCmIEgZrR+g+piPata18Tu9/Zurq5aTxLNV833qs6nMg8sxAwEMQNBzHisD8lQ6y3W/qt3kpyuS8/ez3xiNL/qfMjL+oUgiBkIYkYppn7R9THd56s5tBGn60myfcSJ3GMsxAwEMQNBzGjdlxXRja1068mj9tla3c3DysaLxon+fgILMQNBzEAQM476kG5c5aJ7BnS6bqX6+jS/jLysXwCCmIEgZmx/x7DK6btCurF31WdMawPfkXOMhZiBIGYgiBmPvx+iUo2RV/vp3llSpZuXpfqgbNwnsBAzEMQMBDHjSH0InAMLMePvAAAA//8x2VnbmmL6HQAAAABJRU5ErkJggg==",
"url": "otpauth://totp/vault:4746fb81-028c-cd4e-026b-7dd18fe4c2f4?algorithm=SHA1&digits=6&issuer=vault&period=30&secret=6HQ4RZ7GM6MMLRKVDCI23LXNZF7UDZ2U"
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ MFA in Vault includes the following login types:
- `Time-based One-time Password (TOTP)` - If configured and enabled on a login path,
this would require a TOTP passcode along with a Vault token to be presented
while invoking the API login request. The passcode will be validated against the
TOTP key present in the caller's identify in Vault.
TOTP key present in the caller's identify in Vault. <EnterpriseAlert product="vault" inline />
TOTP supports [self-enrollment](/vault/docs/enterprise/mfa#self-enroll-mfa-totp).

- `Okta` - If Okta push is configured and enabled on a login path, then the enrolled
device of the user will receive a push notification to either approve or deny access
Expand Down Expand Up @@ -246,6 +247,29 @@ The following table lists the known authenticator applications and encryption al
| Google Authenticator mobile app | &#9989; | &#9989; |
| Yubico Authenticator for Desktop | &#9989; | &#9989; |

#### Option 1: Configure TOTP for self-enrollment <EnterpriseAlert product="vault" inline />

To make the Vault GUI prompt users with a QR code if they do not have TOTP setup for their account:

1. Set `enable_self_enrollment` to `true` in the TOTP method configuration.

```shell-session
$ vault write identity/mfa/method/totp \
generate=true \
issuer=Vault \
period=30 \
key_size=30 \
algorithm=SHA256 \
digits=6 \
enable_self_enrollment=true
```

1. Ensure you only have one MFA login enforcement enabled. You can associate
multiple MFA methods with the enforcement rule, but you can only have one
rule active at a time to allow self-enrollment.

#### Option 2: Configure TOTP for admin-managed enrollment

Configure the Login MFA TOTP method and note down the resulting `method_id`.

```shell-session
Expand All @@ -258,7 +282,7 @@ $ vault write identity/mfa/method/totp \
digits=6
```

Using the TOTP `method_id` and an `entity_id` from after a sucessful MFA login. Use these to generate a QR code.
Vault generates an `entity_id` for users after a successful login. Use the TOTP `method_id` and the `entity_id` of the target user to generate a QR code.

```shell-session
$ vault write -field=barcode \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MFA in Vault can be of the following types.
- **Time-based One-time Password (TOTP)** - If configured and enabled on a path,
this would require a TOTP passcode along with Vault token, to be presented
while invoking the API request. The passcode will be validated against the
TOTP key present in the identity of the caller in Vault.
TOTP key present in the identity of the caller in Vault. TOTP supports [self-enrollment](#self-enroll-mfa-totp).

- **Okta** - If Okta push is configured and enabled on a path, then the enrolled
device of the user will get a push notification to approve or deny the access
Expand All @@ -43,6 +43,19 @@ MFA methods are globally managed within the `System Backend` using the HTTP API.
Please see [MFA API](/vault/api-docs/system/mfa) for details on how to configure an MFA
method.

## Self-enroll MFA TOTP

The TOTP method supports self-enrollment so users can generate their own QR codes without admin assistance.

```text
$ vault write sys/mfa/method/totp/my_self_enroll_totp \
issuer=Vault \
period=30 \
key_size=30 \
algorithm=SHA256 \
enable_self_enrollment=true
```

## MFA methods in policies

MFA requirements on paths are specified as `mfa_methods` along with other ACL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ alphabetic order by name.

@include 'telemetry-metrics/vault/replication/rpc/client/persist_alias.mdx'

@include 'telemetry-metrics/vault/replication/rpc/client/persist_pending_login_mfa_secret.mdx'

@include 'telemetry-metrics/vault/replication/rpc/client/register_auth.mdx'

@include 'telemetry-metrics/vault/replication/rpc/client/register_lease.mdx'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ your Vault instance. Enterprise installations also include

@include 'telemetry-metrics/vault/replication/rpc/client/persist_alias.mdx'

@include 'telemetry-metrics/vault/replication/rpc/client/persist_pending_login_mfa_secret.mdx'

@include 'telemetry-metrics/vault/replication/rpc/client/register_auth.mdx'

@include 'telemetry-metrics/vault/replication/rpc/client/register_lease.mdx'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### vault.replication.rpc.client.persist_pending_login_mfa_secret ((#vault-replication-rpc-client-persist_pending_login_mfa_secret))

Metric type | Value | Description
----------- | ----- | -----------
summary | ms | Time required by the client to persist the pending login MFA TOTP secret
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### vault.replication.rpc.server.persist_pending_login_mfa_secret ((#vault-replication-rpc-server-persist_pending_login_mfa_secret))

Metric type | Value | Description
----------- | ----- | -----------
summary | ms | Time required by the server to persist the pending login MFA TOTP secret
Loading