a3dfde5cec
* 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
114 lines
4.2 KiB
Markdown
114 lines
4.2 KiB
Markdown
---
|
|
layout: "docs"
|
|
page_title: "Authentication"
|
|
sidebar_title: "Authentication"
|
|
sidebar_current: "docs-concepts-auth"
|
|
description: |-
|
|
Before performing any operation with Vault, the connecting client must be authenticated.
|
|
---
|
|
|
|
# Authentication
|
|
|
|
Authentication in Vault is the process by which user or machine supplied
|
|
information is verified against an internal or external system. Vault supports
|
|
multiple [auth methods](/docs/auth/index.html) including GitHub,
|
|
LDAP, AppRole, and more. Each auth method has a specific use case.
|
|
|
|
Before a client can interact with Vault, it must _authenticate_ against an
|
|
auth method. Upon authentication, a token is generated. This token is
|
|
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.
|
|
|
|
## auth methods
|
|
|
|
Vault supports a number of auth methods. Some backends are targeted
|
|
toward users while others are targeted toward machines. Most authentication
|
|
backends must be enabled before use. To enable an auth method:
|
|
|
|
```sh
|
|
$ vault write sys/auth/my-auth type=userpass
|
|
```
|
|
|
|
This enables the "userpass" auth method at the path "my-auth". This
|
|
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
|
|
# ...
|
|
```
|
|
|
|
Vault supports multiple auth methods simultaneously, and you can even
|
|
mount the same type of auth method at different paths. Only one
|
|
authentication is required to gain access to Vault, and it is not currently
|
|
possible to force a user through multiple auth methods to gain
|
|
access, although some backends do support MFA.
|
|
|
|
## 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
|
|
|
|
### Via the CLI
|
|
|
|
To authenticate with the CLI, `vault login` is used. This supports many
|
|
of the built-in auth methods. For example, with GitHub:
|
|
|
|
```
|
|
$ vault login -method=github token=<token>
|
|
...
|
|
```
|
|
|
|
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.
|
|
|
|
To determine what variables are needed for an auth method,
|
|
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.
|
|
|
|
### Via the API
|
|
|
|
API authentication is generally used for machine authentication. Each
|
|
auth method implements its own login endpoint. Use the `vault path-help`
|
|
mechanism to find the proper endpoint.
|
|
|
|
For example, the GitHub login endpoint is located at `auth/github/login`.
|
|
And to determine the arguments needed, `vault path-help auth/github/login` can
|
|
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
|
|
the specific auth method in use. It is specific to each backend
|
|
how leasing is implemented.
|
|
|
|
And just like secrets, identities can be renewed without having to
|
|
completely reauthenticate. Just use `vault token renew <token>` with the
|
|
leased token associated with your identity to renew it.
|