Skip to content

triauth for HashiCorp VaultOIDC

Let your platform team open Vault, on the web and in the terminal, with one approval on their own device, and no Vault passwords.

  • IT and infrastructure
Sign-in through
OpenID Connect bridge
Available in
Every edition, web interface and command line
Set up in
The oidc auth method

About HashiCorp Vault

Vault stores and hands out secrets: database passwords, API keys, certificates, and encryption keys, with an audit trail and short-lived credentials. Operations and platform teams run it as the central secrets store for applications and people. OpenBao, the community fork, carries the same sign-in method.

Connect HashiCorp Vault to triauth

Vault signs people in through the triauth OpenID Connect bridge, with its OIDC auth method. Once connected, people on your team choose OIDC on the web interface's sign-in page, or run vault login -method=oidc in a terminal, type their username, and approve on their own device. Vault then issues them its own token. Nobody keeps a Vault password, and when someone leaves, removing their identity records at your domain ends their access to Vault as well.

How it works

  1. Open oidc.triauth.org and enter your domain. Paste Vault's redirect address, https://vault.example.com/ui/vault/auth/oidc/oidc/callback with your own Vault address in place of vault.example.com. Click Add another redirect URI, add http://localhost:8250/oidc/callback for the command line, and click Connect app. The bridge gives you a client ID and a client secret.

  2. Enable the auth method and describe the bridge to it. Replace example.com with your domain, vault.example.com with your Vault address, and the two placeholders with the client ID and the client secret from the bridge.

    sh
    vault auth enable oidc
    vault write auth/oidc/config \
      oidc_discovery_url="https://oidc.triauth.org/example.com" \
      oidc_client_id="<client ID from the bridge>" \
      oidc_client_secret="<client secret from the bridge>" \
      default_role="reader"
    vault write auth/oidc/role/reader \
      allowed_redirect_uris="https://vault.example.com/ui/vault/auth/oidc/oidc/callback" \
      allowed_redirect_uris="http://localhost:8250/oidc/callback" \
      user_claim="email" \
      groups_claim="groups" \
      oidc_scopes="email,profile,groups" \
      token_policies="reader" \
      token_ttl="8h"
  3. Open the web interface, choose the method OIDC, and click Sign in with OIDC Provider. In a terminal, run vault login -method=oidc instead.

Checkpoint

The sign-in page's OIDC method shows Sign in with OIDC Provider. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve. Vault then shows the token's policies. In a terminal, vault login -method=oidc opens the same page in the browser, and the terminal shows the token once the person has approved.

Good to know

  • Everyone with an identity at your domain can sign in with the default role and gets its policies. To let only one team in, limit the app to a group when you connect it, or set bound_claims on the role.
  • The groups published at your domain become group aliases. An external identity group in Vault with the matching alias gives its members more policies.
  • Vault's own token, eight hours in the example, decides how long a sign-in lasts.

For the person who connects the app

SettingValue
Redirect addressestwo on one connection: https://<your-vault>/ui/vault/auth/<mount path>/oidc/callback for the web interface, oidc being the default mount path, and http://localhost:8250/oidc/callback for the command line, which listens on port 8250 unless port= on the login command says otherwise. Both go into the role's allowed_redirect_uris
Where in Vaultthe oidc auth method's config and roles, through the CLI, the API, or the web interface
Discoveryoidc_discovery_url takes https://oidc.triauth.org/<your domain> without the well-known part, and the rest comes from the discovery document
Scopesopenid is added by Vault. email,profile,groups brings the rest
Groupsvault write identity/group name="platform" type="external" policies="platform" and vault write identity/group-alias name="platform@example.com" mount_accessor="<the oidc accessor>" canonical_id="<the group id>" connect a group at your domain to Vault policies

Vault keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. Vault's JWT/OIDC auth method explains every parameter, and the OIDC tutorial walks through the group aliases.

Next steps

All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.