Why Not a VPN
My old way of reaching the Homelab was typical: connect to the internal network over WireGuard, then SSH from a jump host to the other machines. It worked, but a few problems were unavoidable:
- Once the VPN is up, the whole internal network is visible to the client, and the only access boundary is “connected or not”
- Keys and known_hosts entries pile up on the jump host, and the only record of who logged in to which machine and when lives in shell history
- Giving a temporary device access usually means adding a VPN peer or copying a private key
Zero trust turns this around: you are not trusted just because you are on the internal network. Every connection re-verifies identity and authorizes only up to a specific Target. HashiCorp Boundary does exactly this: users first sign in through an auth method (password, OIDC, LDAP, and so on), then a Role/Grant decides whether they can connect to a given Target. The actual connection is proxied by a Worker, so the user never needs the target’s network location or long-lived credentials.
This article deploys Vault and Boundary on one Debian 12 VM and gets the whole path working:
User -> Boundary CLI/UI -> Controller -> Vault Transit (encryption)
-> Worker -> Target 127.0.0.1:22
Tested: initializing Vault 2.2.2 and Transit, Boundary 0.21.3 with PostgreSQL/Controller/Worker, password auth, users/roles/grants, TCP Targets, SSH sessions through Boundary, and the full OIDC login flow with Authentik 2026.8.5 (Provider/Application, Authorization Code, callback, automatic User creation).
Not tested: Authentik managed groups (the managed group mechanism was verified with a temporary test IdP; Authentik needs an extra groups scope mapping), Vault Agent/AppRole auto-renewal, and cross-version upgrades.
Comparison
| Option | What it is | OSS limitations | Best for |
|---|---|---|---|
| Boundary | Zero trust access in the HashiCorp ecosystem | OSS has TCP Targets only, no SSH Targets or session recording | Existing Vault users who want identity-driven authorization |
| Teleport | Enterprise access platform | The community edition is fairly capable, but the architecture is heavier | Full auditing and one entry point for SSH/K8s/DB |
| Cloudflare Access | SaaS zero trust | Depends on Cloudflare’s network | Teams that don’t want to self-host the control plane |
| JumpServer | Bastion host | Leans toward traditional ops auditing | Web terminals and session recordings |
One limitation of Boundary’s OSS edition needs to be stated up front: it only has TCP Targets. Even though the CLI offers targets create ssh, the OSS Controller returns Unknown type provided; automatic credential injection and session recording for SSH Targets are Enterprise/HCP features. In OSS you can use a TCP Target plus boundary connect to forward a local port, then SSH from the client side. That is the route this article takes.
Architecture and Lab Setup
Lab environment
- Debian 12 VM, 4 vCPU / 5.8 GiB RAM
- Vault 2.2.2, listening on
127.0.0.1:8202, Raft storage - Boundary 0.21.3, Controller
9200/9201, Worker9202 - PostgreSQL 15 (Docker), listening only on
127.0.0.1:5432 - Everything on one machine; Vault and Boundary talk over localhost
In production, Vault, the Boundary Controller and the Worker should be split up: Vault on its own machine, the Controller exposing only the API, and the Worker on a network segment that can reach the target resources. For convenience this article keeps them on one VM, but the ports and configuration are written so they can be separated.
graph TB
CLI["Client Boundary CLI"]
UI["Client Boundary UI"]
subgraph Host["Debian 12 VM"]
Controller[Boundary Controller<br/>:9200 API / :9201 Cluster]
Worker[Boundary Worker<br/>:9202 Proxy]
PG[(PostgreSQL<br/>:5432)]
Vault[HashiCorp Vault 2.2.2<br/>:8202]
Target[SSH Target<br/>127.0.0.1:22]
Controller --> PG
Controller --> Vault
Worker --> Controller
Worker --> Target
end
CLI -->|"HTTP/HTTPS"| Controller
UI -->|"HTTP/HTTPS"| Controller
style Controller fill:#7c3aed,color:#fff
style Worker fill:#22c55e,color:#fff
style Vault fill:#eab308,color:#000
style PG fill:#2563eb,color:#fff
| Port | Purpose |
|---|---|
| 8202 / 8203 | Vault API / Raft cluster |
| 9200 / 9201 | Boundary Controller API / cluster |
| 9202 | Boundary Worker proxy |
| 5432 | Boundary PostgreSQL, listening on 127.0.0.1 only |
| 22 | The SSH Target being accessed |
With everything running, Vault, Boundary, and PostgreSQL use about 700 MiB of RAM in total; most of the rest is left for the system and test sessions.
Deploying Vault
Installing the binary
The community binaries for Vault 2.x are available from HashiCorp Releases. This article uses 2.2.2:
cd /tmp
curl -fO https://releases.hashicorp.com/vault/2.2.2/vault_2.2.2_linux_amd64.zip
unzip vault_2.2.2_linux_amd64.zip
sudo install -m 755 vault /usr/local/bin/vault
vault version
# Vault v2.2.2 ...
Configuring Raft storage
To save a layer of certificates, the lab runs Vault over HTTP; in production you should enable TLS on the listener and point Boundary’s KMS configuration at https://:
# /etc/vault-boundary.d/vault.hcl
ui = true
api_addr = "http://127.0.0.1:8202"
cluster_addr = "http://127.0.0.1:8203"
disable_mlock = true
storage "raft" {
path = "/opt/vault-boundary/data"
node_id = "vault-boundary-1"
}
listener "tcp" {
address = "127.0.0.1:8202"
cluster_address = "127.0.0.1:8203"
tls_disable = true
}
sudo useradd --system --home /opt/vault-boundary/data --shell /sbin/nologin vault || true
sudo mkdir -p /opt/vault-boundary/data /etc/vault-boundary.d
sudo chown -R vault:vault /opt/vault-boundary
The systemd service:
# /etc/systemd/system/vault-boundary.service
[Unit]
Description=Vault for Boundary lab
After=network-online.target
Wants=network-online.target
[Service]
User=vault
Group=vault
ExecStart=/usr/local/bin/vault server -config=/etc/vault-boundary.d/vault.hcl
Restart=on-failure
LimitMEMLOCK=infinity
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now vault-boundary
VAULT_ADDR=http://127.0.0.1:8202 vault status
Initialization and unsealing
The lab uses a single share to keep things simple; production should use at least 5 shares with a threshold of 3, and store the unseal keys separately:
VAULT_ADDR=http://127.0.0.1:8202 \
vault operator init -key-shares=1 -key-threshold=1 -format=json \
| sudo tee /root/vault-boundary-init.json >/dev/null
sudo chmod 600 /root/vault-boundary-init.json
Pull the unseal key and root token out of the JSON, then unseal:
KEY=$(sudo python3 -c 'import json;print(json.load(open("/root/vault-boundary-init.json"))["unseal_keys_b64"][0])')
ROOT=$(sudo python3 -c 'import json;print(json.load(open("/root/vault-boundary-init.json"))["root_token"])')
VAULT_ADDR=http://127.0.0.1:8202 vault operator unseal "$KEY"
The root token is only for initialization. Once that is done, create scoped tokens or an AppRole and keep the root token offline.
Transit engine
Boundary uses Vault Transit to encrypt sensitive fields in its database. Transit keys never leave Vault; Boundary sends plaintext in and gets ciphertext back:
export VAULT_ADDR=http://127.0.0.1:8202
export VAULT_TOKEN="$ROOT"
vault secrets enable transit
vault write -f transit/keys/boundary
vault write -f transit/keys/boundary-worker-auth
vault write -f transit/keys/boundary-recovery
The lab uses one periodic token allowed to access transit/* to cut down on variables; production should tighten this per key:
vault policy write boundary-controller - <<'EOF'
path "transit/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}
EOF
sudo mkdir -p /etc/boundary.d
vault token create -policy=boundary-controller -period=24h -field=token \
| sudo tee /etc/boundary.d/vault-token >/dev/null
sudo chmod 600 /etc/boundary.d/vault-token
VAULT_TOKEN through systemd’s EnvironmentFile. In production, use AppRole so Vault Agent can fetch and renew the token itself, then render it to /run/boundary/vault-token.env; that way the token doesn’t sit in service config and no manual rotation is needed. The Vault Agent approach was not tested end to end here.Checking Vault status and Transit:
VAULT_ADDR=http://127.0.0.1:8202 vault status
VAULT_TOKEN="$ROOT" vault secrets list | grep transit
# transit/ transit transit_afeaf5ae n/a
Deploying Boundary
Installing 0.21.3
The Boundary community edition is currently 0.21.3:
cd /tmp
curl -fO https://releases.hashicorp.com/boundary/0.21.3/boundary_0.21.3_linux_amd64.zip
unzip boundary_0.21.3_linux_amd64.zip
sudo install -m 755 boundary /usr/local/bin/boundary
boundary version
# Version Number: 0.21.3
PostgreSQL
Boundary keeps its metadata in PostgreSQL. The lab runs an instance in Docker that listens only on localhost:
docker volume create boundary-postgres-data
docker run --name boundary-postgres -d \
-e POSTGRES_USER=boundary \
-e POSTGRES_PASSWORD='<strong-password>' \
-e POSTGRES_DB=boundary \
-v boundary-postgres-data:/var/lib/postgresql/data \
-p 127.0.0.1:5432:5432 \
--restart unless-stopped \
postgres:15-alpine
Create the system user and directories for Boundary first:
sudo useradd --system --home /var/lib/boundary --shell /usr/sbin/nologin boundary || true
sudo mkdir -p /etc/boundary.d /var/lib/boundary /var/log/boundary
sudo chown -R boundary:boundary /etc/boundary.d /var/lib/boundary /var/log/boundary
Put the database URL and Vault token in an environment file with 600 permissions:
# /etc/boundary.d/boundary.env
DATABASE_URL=postgresql://boundary:<strong-password>@127.0.0.1:5432/boundary?sslmode=disable
VAULT_ADDR=http://127.0.0.1:8202
VAULT_TOKEN=<periodic token or the value rendered by Vault Agent>
Controller configuration
# /etc/boundary.d/controller.hcl
disable_mlock = true
controller {
name = "boundary-controller-01"
database {
url = "postgresql://boundary:<strong-password>@127.0.0.1:5432/boundary?sslmode=disable"
}
}
listener "tcp" {
purpose = "api"
address = "127.0.0.1:9200"
tls_disable = true
}
listener "tcp" {
purpose = "cluster"
address = "127.0.0.1:9201"
tls_disable = true
}
kms "transit" {
purpose = "root"
address = "http://127.0.0.1:8202"
disable_renewal = true
key_name = "boundary"
mount_path = "transit"
}
kms "transit" {
purpose = "worker-auth"
address = "http://127.0.0.1:8202"
disable_renewal = true
key_name = "boundary-worker-auth"
mount_path = "transit"
}
kms "transit" {
purpose = "recovery"
address = "http://127.0.0.1:8202"
disable_renewal = true
key_name = "boundary-recovery"
mount_path = "transit"
}
tls_disable = true, and Vault is HTTP too. Production should enable TLS on the Boundary listeners, or terminate TLS with Nginx/Ingress, and set the Controller’s advertise_url and the OIDC api_url_prefix to the external HTTPS address.All three KMS stanzas read the token from the VAULT_TOKEN environment variable; disable_renewal = true means renewal is handled externally (Vault Agent in production, a periodic token in the lab).
Worker configuration
# /etc/boundary.d/worker.hcl
disable_mlock = true
listener "tcp" {
address = "127.0.0.1:9202"
purpose = "proxy"
}
worker {
name = "boundary-worker-01"
public_addr = "127.0.0.1:9202"
initial_upstreams = ["127.0.0.1:9201"]
tags {
type = ["worker", "egress"]
}
}
kms "transit" {
purpose = "worker-auth"
address = "http://127.0.0.1:8202"
disable_renewal = true
key_name = "boundary-worker-auth"
mount_path = "transit"
}
name, or startup fails. auth_storage_path also can’t be combined with KMS auth; it belongs to PKI auth mode.systemd services
Controller and Worker share the same environment file; the Vault token is injected through EnvironmentFile and read from the environment when the process starts.
# /etc/systemd/system/boundary-controller.service
[Unit]
Description=HashiCorp Boundary Controller
After=network-online.target boundary-postgres.service
Wants=network-online.target
[Service]
User=boundary
Group=boundary
EnvironmentFile=/etc/boundary.d/boundary.env
ExecStart=/usr/local/bin/boundary server -config=/etc/boundary.d/controller.hcl
Restart=on-failure
RestartSec=5
LimitMEMLOCK=infinity
[Install]
WantedBy=multi-user.target
The Worker service is the same, with ExecStart pointing at worker.hcl and After=boundary-controller.service added.
Initializing the database
The database must be initialized before Boundary’s first start:
sudo -u boundary env \
VAULT_ADDR=http://127.0.0.1:8202 \
VAULT_TOKEN="$(sudo cat /etc/boundary.d/vault-token)" \
boundary database init -config /etc/boundary.d/controller.hcl
On success, the output includes the admin login and the automatically created org, project, host catalog, and two TCP Targets. Save the output to a file with 600 permissions; if the admin credentials are lost, the only way back is the recovery KMS or rebuilding the database.
sudo systemctl daemon-reload
sudo systemctl enable --now boundary-controller boundary-worker
sudo ss -tlnp | grep -E ':(9200|9201|9202) '
Once the Worker registers, the Workers page in the Boundary admin console shows its version, address, and latest heartbeat:

The Controller UI is on port 9200 by default:


Checking service status
systemctl is-active boundary-controller boundary-worker vault-boundary
# active
# active
# active
VAULT_ADDR=http://127.0.0.1:8202 vault status
# Sealed false
Vault, Boundary, and PostgreSQL status, and the CLI output for the lab-ssh Target:

Authorization model
Boundary’s authorization model has several layers; getting the concepts straight first keeps the commands from becoming confusing:
| Concept | Purpose |
|---|---|
| Scope | Hierarchy container: Global -> Organization -> Project |
| Auth Method | Authentication method, such as password, OIDC, or LDAP |
| Account | Login credentials under a given Auth Method |
| User | Identity entity, which can be linked to multiple Accounts |
| Role | Permission carrier containing Grants and Principals |
| Grant | Permission statement in the form ids=...;type=...;actions=... |
| Target | What the user ultimately connects to (TCP/SSH/database, and so on) |
Auth methods must live in the Global or Org scope, not in a Project; Targets and Roles usually live in a Project. A typical flow:
- Create a Project under the Org
- Create a password or OIDC Auth Method under the Org
- Create a User and link the Account to it
- Create a Role under the Project with the Target grant and principals
- After login, the user only sees and connects to authorized Targets
Hands-on: creating a restricted user
The commands below run with the admin token. The CLI’s BOUNDARY_TOKEN environment variable is marked deprecated, so prefer -token env://TOKEN explicitly:
export BOUNDARY_ADDR=http://127.0.0.1:9200
export TOKEN="$(sudo cat /root/boundary-token)"
# 1. Create a project under the existing org
boundary scopes create \
-scope-id o_xxxxxxxxxx \
-name boundary-lab \
-description "Boundary lab project" \
-token env://TOKEN
# 2. Create a password auth method under the org
boundary auth-methods create password \
-scope-id o_xxxxxxxxxx \
-name lab-password \
-description "Lab password auth" \
-token env://TOKEN
# 3. Create a user
boundary users create \
-scope-id o_xxxxxxxxxx \
-name lab-user \
-description "Lab user" \
-token env://TOKEN
# 4. Create a password account
export LAB_PASS='<lab-password>'
boundary accounts create password \
-auth-method-id ampw_xxxxxxxxxx \
-login-name labuser \
-password env://LAB_PASS \
-token env://TOKEN
# 5. Link the account to the user
boundary users add-accounts \
-id <user_id> \
-account <account_id> \
-token env://TOKEN
Then create a Role under the Project that grants only list and connect on Targets:
boundary roles create \
-scope-id p_xxxxxxxxxx \
-name lab-target-role \
-token env://TOKEN
boundary roles add-grants \
-id <role_id> \
-grant 'ids=*;type=target;actions=list,read,authorize-session' \
-token env://TOKEN
boundary roles add-principals \
-id <role_id> \
-principal <user_id> \
-token env://TOKEN
Log in as the normal user and confirm the Target is visible:
export LAB_PASS='<lab-password>'
boundary authenticate password \
-keyring-type none \
-auth-method-id ampw_xxxxxxxxxx \
-login-name labuser \
-password env://LAB_PASS \
-format json > /tmp/lab-auth.json
export LAB_TOKEN="$(python3 -c 'import json;print(json.load(open("/tmp/lab-auth.json"))["item"]["attributes"]["token"])')"
boundary targets list -scope-id p_xxxxxxxxxx -token env://LAB_TOKEN
In testing, this user only had list/read/authorize-session on target and no admin permissions; after login they could see lab-ssh and the two automatically created Targets.
Grant syntax
ids=<resource ID or *>;type=<resource type>;actions=<actions>;output_fields=<optional fields>
The minimal grants you’ll commonly need:
| Purpose | Grant |
|---|---|
| View and connect to Targets | ids=*;type=target;actions=list,read,authorize-session |
| View sessions | ids=*;type=session;actions=list,read |
| Manage Host Catalogs | ids=*;type=host-catalog;actions=* plus permissions on host-set and host |
| Global admin | ids=*;type=*;actions=* (admins only) |
Permissions inherit downward from the parent scope, but a Role is itself a scope resource; when you create a Role in a Project, its grants only apply inside that Project by default.
Targets and SSH sessions
During initialization Boundary automatically creates one direct-address Target and one Host Set-based Target. You can add an explicit lab-ssh:
boundary targets create tcp \
-scope-id p_xxxxxxxxxx \
-name lab-ssh \
-description "SSH to lab host" \
-address 127.0.0.1 \
-default-port 22 \
-token env://TOKEN
The OSS edition only supports TCP Targets, so the connection flow is to get a local proxy port from Boundary and then SSH from the client:
boundary connect -target-id ttcp_xxxxxxxxxx -token env://LAB_TOKEN
The output looks like:
Proxy listening information:
Address: 127.0.0.1
Port: 43931
Protocol: tcp
Session ID: s_xxxxxxxxxx
Then open another terminal:
ssh -p 43931 -i ~/.ssh/boundary_test \
-o StrictHostKeyChecking=no [email protected]
Test output:
Warning: Permanently added '[127.0.0.1]:43931' (ED25519) to the list of known hosts.
lab-ssh-target-ok
boundary targets create ssh, the OSS Controller returns Unknown type provided. Automatic credential injection and session recording for SSH Targets require Enterprise or HCP Boundary. On OSS, a TCP Target + boundary connect + client-side SSH works, but auditing depends entirely on logs on the client and the Target.boundary connect ssh -target-id ... against a direct address such as 127.0.0.1 can fail with hostname contains invalid characters. Get a local port with boundary connect and then use the system ssh; the behavior is more predictable and it’s easier to specify a private key and known_hosts policy.Worker selection
Workers can be filtered by tags and -egress-worker-filter. The Worker in this article carries two tags, type=worker and type=egress; with a single Worker there’s nothing to filter, but with multiple Workers or network segments you can target one by tag, for example:
boundary targets create tcp \
-egress-worker-filter '"egress" in "/tags/type"' \
...
OIDC integration
Password auth covers Boundary’s core path. In real use you’d rather plug in Authentik so users sign in with a unified identity. Boundary’s OIDC configuration has a few ordering and field gotchas; here it is split up by the actual flow.
The full OIDC flow in Boundary
sequenceDiagram
participant User as User browser
participant Boundary as Boundary Controller
participant IdP as Authentik
User->>Boundary: Open the login page and pick the OIDC auth method
Boundary->>User: 302 to the IdP authorization endpoint (with state/nonce)
User->>IdP: Sign in and authorize
IdP->>User: 302 back to the Boundary callback (authorization code)
User->>Boundary: GET /v1/auth-methods/oidc:authenticate:callback?code=...
Boundary->>IdP: Exchange the code for tokens
IdP-->>Boundary: id_token + access_token
Boundary->>Boundary: Validate issuer/audience/signature, extract sub/name/email/groups
Boundary->>Boundary: Create an Account on first login; if the method is the scope's primary, also create a User
Boundary-->>User: Login succeeds, land in the Boundary UI
There are three key points here:
- The callback URL is fixed:
<api-url-prefix>/v1/auth-methods/oidc:authenticate:callback. Theoidcin the path is a literal, not the Auth Method ID; the real ID isamoidc_..., but it never appears in the callback path. - Auth Methods are inactive by default: after creation you must explicitly switch to
active-public(oractive-private), otherwise the login page won’t show it at all. - Only the primary Auth Method auto-creates Users: the first OIDC login creates an Account; if this Auth Method isn’t the scope’s primary, Boundary refuses to auto-create the User and reports
auth method is not primary for the scope so refusing to auto-create user.
Configuring Authentik
Create an OAuth2/OpenID Provider and an Application in Authentik:
| Setting | Value |
|---|---|
| Provider type | OAuth2/OpenID |
| Name | HashiCorp Boundary |
| Authorization flow | default-provider-authorization-explicit-consent |
| Client type | Confidential |
| Client ID | Generated automatically or custom; note it down |
| Client Secret | Generated automatically; note it down |
| Redirect URI | https://boundary.example.com/v1/auth-methods/oidc:authenticate:callback |
| Signing Key | Pick an RSA key |
| Grant types | Authorization Code, Refresh Token |
| Scopes | openid, email, profile, groups |
The Application uses the same Provider, with the Launch URL set to Boundary’s external address.
If you want Authentik groups to reach Boundary, add a Scope Mapping (optional for plain login; add it when you need group mapping):
- Open Customization -> Property Mappings -> Create -> Scope Mapping
- Set Name to
groupsand Scope name togroups - Expression:
return {
"groups": [group.name for group in request.user.ak_groups.all()],
}
- Back in the Provider’s Advanced protocol settings, add the
groupsscope to Scopes.
Verify OIDC Discovery:
curl -s https://auth.example.com/application/o/hashicorp-boundary/.well-known/openid-configuration \
| jq '{issuer, authorization_endpoint, token_endpoint, userinfo_endpoint, jwks_uri}'
issuer must match exactly what you enter in Boundary, especially the trailing slash.
Creating the OIDC Auth Method in Boundary
export BOUNDARY_ADDR=https://boundary.example.com
export TOKEN='<admin-token>'
export OIDC_CLIENT_SECRET='<authentik-client-secret>'
boundary auth-methods create oidc \
-scope-id o_xxxxxxxxxx \
-name authentik-oidc \
-description "Authentik OIDC" \
-issuer 'https://auth.example.com/application/o/hashicorp-boundary/' \
-client-id '<client-id>' \
-client-secret "$OIDC_CLIENT_SECRET" \
-api-url-prefix 'https://boundary.example.com' \
-signing-algorithm RS256 \
-claims-scopes email \
-claims-scopes profile \
-account-claim-maps 'email=name' \
-allowed-audience '<client-id>' \
-token env://TOKEN
Parameter reference:
| Parameter | Purpose |
|---|---|
-issuer |
The IdP’s issuer URL; must match the discovery document |
-client-id / -client-secret |
Client credentials from the Authentik Provider |
-api-url-prefix |
Boundary’s external address, used to build the callback URL |
-claims-scopes |
Extra scopes to request; repeatable. Without email/profile you usually only get sub, and the username may be a hash |
-account-claim-maps |
Map IdP claims onto Boundary’s standard claims (sub/name/email), in from=to form; email=name uses the email as the display name |
-allowed-audience |
Optional; when set, validates the aud returned by the IdP, usually the client ID |
-idp-ca-cert |
When Authentik uses a private CA, hand the CA certificate to Boundary for verification |
-client-secret env://VAR was taken as a literal string, and the OIDC callback failed with invalid_client. Either read the value into a shell variable first and pass it directly (-client-secret "$OIDC_CLIENT_SECRET"), or create the method and then update it with the real value. Don’t put this value in your shell history.Read the callback URL:
boundary auth-methods read -id amoidc_xxxxxxxxxx -token env://TOKEN -format json \
| jq -r '.item.attributes.callback_url'
# https://boundary.example.com/v1/auth-methods/oidc:authenticate:callback
Put it into the Authentik Provider’s Redirect URI. The two must match character for character.
Activating it and setting it as primary
The OIDC method is created as inactive; activate it first:
boundary auth-methods change-state oidc \
-id amoidc_xxxxxxxxxx \
-state active-public \
-token env://TOKEN
active-public shows it on the login page; active-private is visible only to authenticated users and can’t be used for first-time login.
Then make it the primary method of its scope:
boundary scopes update \
-id o_xxxxxxxxxx \
-primary-auth-method-id amoidc_xxxxxxxxxx \
-token env://TOKEN
Each scope can have only one primary. If you have both password and OIDC login, setting OIDC as primary still lets the password method sign in existing users, but new OIDC users can only be auto-created by the primary method.
Without a primary set, after OIDC consent you’ll see:
user not found for account acctoidc_xxx and auth method is not primary
for the scope so refusing to auto-create user
This isn’t an Authentik misconfiguration; it’s Boundary’s auto-provisioning policy. Either set a primary or create the User manually and link the OIDC Account to it.
Hands-on: a complete OIDC login with Authentik
The lab Authentik 2026.8.5 runs at http://127.0.0.1:9000. I created an OAuth2/OpenID Provider HashiCorp Boundary and an Application hashicorp-boundary, with Client ID boundary and the Boundary callback as the Redirect URI; the test user [email protected] belongs to the boundary-users group.
On the Boundary side I created the authentik-oidc method:
- issuer:
http://127.0.0.1:9000/application/o/hashicorp-boundary/ - claims scopes:
email,profile - account claim maps:
email=name - state:
active-public - set as the global scope’s primary
The login page now shows the authentik-oidc method:

Clicking it opens Authentik’s login window:

After entering the username/password and completing consent, Authentik redirects back to Boundary; the first login auto-creates the Account/User for [email protected] and lands in the admin console:

This run verified:
- Authentik’s Provider/Application Authorization Code flow
- Matching the Boundary callback URL, issuer, and client ID/secret
claims-scopes email/profileyielding the email and display nameaccount-claim-maps email=namemapping the display name to the email- The OIDC entry appearing on the login page after
active-public - Automatic User creation on first OIDC login after setting
primary - The callback URL using the literal
oidc, not the Auth Method ID
If you create the Provider through Authentik’s API instead of its UI, grant_types defaults to an empty list. The OIDC authorization request then fails, Boundary only sees invalid_request: The request is otherwise malformed, and Authentik’s log shows Invalid grant_type for provider.
Set it explicitly when creating the Provider:
"grant_types": ["authorization_code", "refresh_token"]
In the UI, just check Authorization Code and Refresh Token under Grant types. This is a pitfall I actually hit when creating the Provider via the API.
Logging in with the CLI
boundary authenticate oidc \
-auth-method-id amoidc_xxxxxxxxxx \
-keyring-type none
The CLI prints a login URL and waits for the browser to finish OIDC; with no browser on the server, copy the URL to your workstation. On success you get a Boundary token in the current terminal.
Group mapping: managed groups
Once OIDC users are auto-created, they still need to be mapped to Roles. Boundary’s managed groups can maintain group membership from IdP claims:
boundary managed-groups create oidc \
-auth-method-id amoidc_xxxxxxxxxx \
-name boundary-users \
-description "OIDC users" \
-filter '"boundary-users" in "/userinfo/groups"' \
-token env://TOKEN
The filter uses JSON Pointer:
/userinfo/groupsmaps togroupsin the UserInfo response/token/groupsmaps togroupsin the ID Token- The group name in the filter must match the group name the IdP actually returns, case-sensitively
I verified the managed group mechanism against a temporary test IdP: after login, the matching Account appeared in member_ids. With Authentik, you need to add the groups claim via the Scope Mapping above and then use the same filter; I did not verify that step separately on Authentik. Then add the managed group as a principal of the Role:
boundary roles add-principals \
-id r_xxxxxxxxxx \
-principal mgoidc_xxxxxxxxxx \
-token env://TOKEN
profile scope doesn’t necessarily include group information. Add a groups scope mapping as shown above and request groups in Boundary’s -claims-scopes; otherwise /userinfo/groups will be empty and the managed group will never match.OIDC troubleshooting checklist
1. invalid_client / Invalid client credentials
First check that the client secrets on the Boundary and Authentik sides match. In testing, -client-secret env://VAR was not resolved and the value had to be passed literally; fix it after creation with auth-methods update oidc -client-secret "$SECRET".
2. auth method is not primary
Run boundary scopes update -id <scope> -primary-auth-method-id <oidc-auth-method-id>.
3. The OIDC method doesn’t appear on the login page
Check state in auth-methods read. Both inactive and active-private are hidden from the first-login page.
4. Redirect URI mismatch
The IdP’s Redirect URI must be https://<api-url-prefix>/v1/auth-methods/oidc:authenticate:callback; the path contains oidc, not amoidc_....
5. issuer mismatch
Authentik issuers usually end with /application/o/<slug>/, and the trailing slash is required; trust the issuer in the discovery document.
6. A private CA stops Boundary from reaching Authentik
The Boundary Controller must trust Authentik’s CA. Use -idp-ca-cert /path/to/ca.pem, or install the Homelab Root CA in the system trust store. Don’t work around it with -tls-insecure.
7. The username is a hash
That means only sub was available. Add -claims-scopes email -claims-scopes profile and use -account-claim-maps to map email or preferred_username to name.
8. groups is empty
Authentik needs a custom groups scope mapping and Boundary needs -claims-scopes groups; both are required.
Operations
Routine checks
# Service status
systemctl is-active vault-boundary boundary-controller boundary-worker
# Vault seal status
VAULT_ADDR=http://127.0.0.1:8202 vault status
# Boundary sessions
export TOKEN="$(sudo cat /root/boundary-token)"
boundary sessions list -scope-id p_xxxxxxxxxx -token env://TOKEN
# Recent logs
journalctl -u boundary-controller -n 50 --no-pager
journalctl -u boundary-worker -n 50 --no-pager
Backup
Boundary’s metadata lives in PostgreSQL, so backups work like any PostgreSQL database:
docker exec boundary-postgres pg_dump -U boundary -d boundary -F t \
> /tmp/boundary-backup.tar
This backup came out at about 9 MB. Restore it into a scratch database to verify:
docker exec boundary-postgres psql -U boundary -d boundary \
-c "DROP DATABASE IF EXISTS boundary_restore_test;" \
-c "CREATE DATABASE boundary_restore_test;"
docker cp /tmp/boundary-backup.tar boundary-postgres:/tmp/backup.tar
docker exec boundary-postgres pg_restore -U boundary \
-d boundary_restore_test --no-owner --no-privileges /tmp/backup.tar
docker exec boundary-postgres psql -U boundary -d boundary_restore_test \
-tAc "select (select count(*) from auth_account), (select count(*) from iam_user), (select count(*) from target);"
# 2|5|2
docker exec boundary-postgres psql -U boundary -d boundary \
-c "DROP DATABASE boundary_restore_test;"
Vault uses Raft snapshots:
VAULT_ADDR=http://127.0.0.1:8202 VAULT_TOKEN="$ROOT" \
vault operator raft snapshot save /tmp/vault-boundary.snap
ls -lh /tmp/vault-boundary.snap
# 23K
Keep Vault’s unseal key, root token, and snapshots separate; never store the unseal key and a snapshot on the same disk.
Upgrade
Back up the Boundary database and a Vault snapshot, and stop the Controller/Worker first. Upgrading the Boundary binary usually means replacing /usr/local/bin/boundary, running the database migrations, and restarting the services; check the official release notes for version requirements. This article did not test a cross-version upgrade, so don’t copy the lab commands straight into production.
Troubleshooting
1. Boundary fails to start with a Vault KMS auth error
Check that VAULT_ADDR and VAULT_TOKEN made it into the Boundary process environment. The order of systemd’s EnvironmentFile entries matters; if a static token file is loaded and then a Vault Agent rendered file, the later one wins. Inspect the effective environment with systemctl show boundary-controller -p Environment (careful not to leak the token).
2. Worker startup complains about a missing name
KMS auth mode requires worker { name = "..." }; auth_storage_path is for PKI mode and can’t be mixed with KMS.
3. Login works but no Targets are visible
Check the Role’s grants, principals, and scope. If a grant allows list but not authorize-session, Targets are visible but connections fail; a Role created at the Org level rather than in the Project also changes the scope of its permissions.
4. boundary connect ssh fails with hostname contains invalid characters
Common with OSS + TCP Targets and direct IPs. Use boundary connect to get a local port and then run the system ssh.
5. Creating an SSH Target fails on OSS
OSS only supports tcp Targets. SSH Targets, session recording, and enterprise credential injection require Enterprise/HCP.
6. Boundary can’t reach Vault after a Vault restart
Vault comes back sealed by default and must be unsealed again. Production should automate the unseal flow or use auto-unseal (cloud KMS/HSM); otherwise Boundary can’t create new sessions while Vault is sealed.
7. The Boundary initialization credentials are lost
The admin login and password printed by boundary database init are shown only once. If they’re lost, try the recovery KMS flow or restore the database from backup; without a recovery configuration, rebuilding is the only option. Save the initialization output to a file with 600 permissions immediately.
References
- HashiCorp Boundary documentation
- Boundary Controller configuration
- Boundary Worker configuration
- Boundary domain model
- Boundary Transit KMS
- Vault documentation
- Vault Transit engine
- Vault Raft storage
- Boundary Releases
- Boundary Auth Methods
- Boundary Managed Groups
- Authentik OAuth2/OpenID Provider
- Authentik Docker Compose install
- Vault Releases
Comments