2015-04-18 00:18:20 +00:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Authentication"
|
New Docs Website (#5535)
* conversion stage 1
* correct image paths
* add sidebar title to frontmatter
* docs/concepts and docs/internals
* configuration docs and multi-level nav corrections
* commands docs, index file corrections, small item nav correction
* secrets converted
* auth
* add enterprise and agent docs
* add extra dividers
* secret section, wip
* correct sidebar nav title in front matter for apu section, start working on api items
* auth and backend, a couple directory structure fixes
* remove old docs
* intro side nav converted
* reset sidebar styles, add hashi-global-styles
* basic styling for nav sidebar
* folder collapse functionality
* patch up border length on last list item
* wip restructure for content component
* taking middleman hacking to the extreme, but its working
* small css fix
* add new mega nav
* fix a small mistake from the rebase
* fix a content resolution issue with middleman
* title a couple missing docs pages
* update deps, remove temporary markup
* community page
* footer to layout, community page css adjustments
* wip downloads page
* deps updated, downloads page ready
* fix community page
* homepage progress
* add components, adjust spacing
* docs and api landing pages
* a bunch of fixes, add docs and api landing pages
* update deps, add deploy scripts
* add readme note
* update deploy command
* overview page, index title
* Update doc fields
Note this still requires the link fields to be populated -- this is solely related to copy on the description fields
* Update api_basic_categories.yml
Updated API category descriptions. Like the document descriptions you'll still need to update the link headers to the proper target pages.
* Add bottom hero, adjust CSS, responsive friendly
* Add mega nav title
* homepage adjustments, asset boosts
* small fixes
* docs page styling fixes
* meganav title
* some category link corrections
* Update API categories page
updated to reflect the second level headings for api categories
* Update docs_detailed_categories.yml
Updated to represent the existing docs structure
* Update docs_detailed_categories.yml
* docs page data fix, extra operator page remove
* api data fix
* fix makefile
* update deps, add product subnav to docs and api landing pages
* Rearrange non-hands-on guides to _docs_
Since there is no place for these on learn.hashicorp, we'll put them
under _docs_.
* WIP Redirects for guides to docs
* content and component updates
* font weight hotfix, redirects
* fix guides and intro sidenavs
* fix some redirects
* small style tweaks
* Redirects to learn and internally to docs
* Remove redirect to `/vault`
* Remove `.html` from destination on redirects
* fix incorrect index redirect
* final touchups
* address feedback from michell for makefile and product downloads
2018-10-19 15:40:11 +00:00
|
|
|
sidebar_title: "Authentication"
|
2015-04-18 00:18:20 +00:00
|
|
|
sidebar_current: "docs-concepts-auth"
|
|
|
|
description: |-
|
|
|
|
Before performing any operation with Vault, the connecting client must be authenticated.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Authentication
|
|
|
|
|
2017-07-14 15:15:22 +00:00
|
|
|
Authentication in Vault is the process by which user or machine supplied
|
|
|
|
information is verified against an internal or external system. Vault supports
|
2017-09-13 01:48:52 +00:00
|
|
|
multiple [auth methods](/docs/auth/index.html) including GitHub,
|
|
|
|
LDAP, AppRole, and more. Each auth method has a specific use case.
|
2015-04-18 00:18:20 +00:00
|
|
|
|
2017-07-14 15:15:22 +00:00
|
|
|
Before a client can interact with Vault, it must _authenticate_ against an
|
2017-09-13 01:48:52 +00:00
|
|
|
auth method. Upon authentication, a token is generated. This token is
|
2017-07-14 15:15:22 +00:00
|
|
|
conceptually similar to a session ID on a website. The token may have attached
|
|
|
|
policy, which is mapped at authentication time. This process is described in
|
|
|
|
detail in the [policies concepts](/docs/concepts/policies.html) documentation.
|
2015-04-18 00:18:20 +00:00
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
## auth methods
|
2015-04-18 00:18:20 +00:00
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
Vault supports a number of auth methods. Some backends are targeted
|
2017-07-14 15:15:22 +00:00
|
|
|
toward users while others are targeted toward machines. Most authentication
|
2017-09-13 01:48:52 +00:00
|
|
|
backends must be enabled before use. To enable an auth method:
|
2015-04-18 00:18:20 +00:00
|
|
|
|
2017-07-14 15:15:22 +00:00
|
|
|
```sh
|
|
|
|
$ vault write sys/auth/my-auth type=userpass
|
|
|
|
```
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
This enables the "userpass" auth method at the path "my-auth". This
|
2017-07-14 15:15:22 +00:00
|
|
|
authentication will be accessible at the path "my-auth". Often you will see
|
|
|
|
authentications at the same path as their name, but this is not a requirement.
|
|
|
|
|
|
|
|
To learn more about this authentication, use the built-in `path-help` command:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ vault path-help auth/my-auth
|
|
|
|
# ...
|
|
|
|
```
|
2015-04-18 00:18:20 +00:00
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
Vault supports multiple auth methods simultaneously, and you can even
|
|
|
|
mount the same type of auth method at different paths. Only one
|
2017-07-14 15:15:22 +00:00
|
|
|
authentication is required to gain access to Vault, and it is not currently
|
2017-09-13 01:48:52 +00:00
|
|
|
possible to force a user through multiple auth methods to gain
|
2017-07-14 15:15:22 +00:00
|
|
|
access, although some backends do support MFA.
|
2015-04-18 00:18:20 +00:00
|
|
|
|
|
|
|
## Tokens
|
|
|
|
|
|
|
|
There is an [entire page dedicated to tokens](/docs/concepts/tokens.html),
|
|
|
|
but it is important to understand that authentication works by verifying
|
|
|
|
your identity and then generating a token to associate with that identity.
|
|
|
|
|
|
|
|
For example, even though you may authenticate using something like GitHub,
|
|
|
|
Vault generates a unique access token for you to use for future requests.
|
|
|
|
The CLI automatically attaches this token to requests, but if you're using
|
|
|
|
the API you'll have to do this manually.
|
|
|
|
|
|
|
|
This token given for authentication with any backend can also be used
|
|
|
|
with the full set of token commands, such as creating new sub-tokens,
|
|
|
|
revoking tokens, and renewing tokens. This is all covered on the
|
|
|
|
[token concepts page](/docs/concepts/tokens.html).
|
|
|
|
|
|
|
|
## Authenticating
|
|
|
|
|
2017-07-14 15:15:22 +00:00
|
|
|
### Via the CLI
|
2015-04-18 00:18:20 +00:00
|
|
|
|
2018-04-25 21:59:38 +00:00
|
|
|
To authenticate with the CLI, `vault login` is used. This supports many
|
2017-09-13 01:48:52 +00:00
|
|
|
of the built-in auth methods. For example, with GitHub:
|
2015-04-18 00:18:20 +00:00
|
|
|
|
|
|
|
```
|
2017-09-13 01:48:52 +00:00
|
|
|
$ vault login -method=github token=<token>
|
2015-04-18 00:18:20 +00:00
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
After authenticating, you will be logged in. The CLI command will also
|
|
|
|
output your raw token. This token is used for revocation and renewal.
|
|
|
|
As the user logging in, the primary use case of the token is renewal,
|
|
|
|
covered below in the "Auth Leases" section.
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
To determine what variables are needed for an auth method,
|
2015-04-18 00:18:20 +00:00
|
|
|
supply the `-method` flag without any additional arguments and help
|
|
|
|
will be shown.
|
|
|
|
|
|
|
|
If you're using a method that isn't supported via the CLI, then the API
|
|
|
|
must be used.
|
|
|
|
|
2017-07-14 15:15:22 +00:00
|
|
|
### Via the API
|
2015-04-18 00:18:20 +00:00
|
|
|
|
|
|
|
API authentication is generally used for machine authentication. Each
|
2017-09-13 01:48:52 +00:00
|
|
|
auth method implements its own login endpoint. Use the `vault path-help`
|
2015-04-18 00:18:20 +00:00
|
|
|
mechanism to find the proper endpoint.
|
|
|
|
|
|
|
|
For example, the GitHub login endpoint is located at `auth/github/login`.
|
2015-07-13 10:12:09 +00:00
|
|
|
And to determine the arguments needed, `vault path-help auth/github/login` can
|
2015-04-18 00:18:20 +00:00
|
|
|
be used.
|
|
|
|
|
|
|
|
## Auth Leases
|
|
|
|
|
|
|
|
Just like secrets, identities have
|
|
|
|
[leases](/docs/concepts/lease.html) associated with them. This means that
|
|
|
|
you must reauthenticate after the given lease period to continue accessing
|
|
|
|
Vault.
|
|
|
|
|
|
|
|
To set the lease associated with an identity, reference the help for
|
2017-09-13 01:48:52 +00:00
|
|
|
the specific auth method in use. It is specific to each backend
|
2015-04-18 00:18:20 +00:00
|
|
|
how leasing is implemented.
|
|
|
|
|
|
|
|
And just like secrets, identities can be renewed without having to
|
2018-01-15 20:19:28 +00:00
|
|
|
completely reauthenticate. Just use `vault token renew <token>` with the
|
2015-09-12 01:08:32 +00:00
|
|
|
leased token associated with your identity to renew it.
|