Chapter 7 of 16 · Application/workload user · orders-api

Choose Workload Auth and Use AppRole

Prefer identity-native authentication and use AppRole only for constrained machines without a stronger runtime identity.

Chapter contract

Persona: Application/workload user · orders-apiPhase: Applications and pipelinesEstimated time: 45 minutes

Prerequisites:

Chapter 6 complete and bootstrap-generated AppRole inputs present under .runtime.

User-visible outcome:

orders-api can exchange separately delivered AppRole factors for a short-lived, scoped token.

Learning objectives

Consumer flow

RoleID plus SecretIDstep 1AppRole loginstep 2Scoped tokenstep 3Application requestsstep 4

Ownership boundary

OwnerConsumer-facing responsibility
You ownDefines consumption, validation, reload, and stop-using behavior.
Platform team ownsProvides trusted runtime identity, protected delivery, network, and telemetry.
Vault ownsOperates auth mounts, policies, engines, audit, and recovery.

Core concepts

RoleID

A role identifier; often non-secret but still scoped operational data.

SecretID

The secret factor, ideally short-lived and response-wrapped.

Response wrapping

A single-purpose token transfers sensitive response data.

Native identity

A signed runtime identity such as IAM, Kubernetes, or CI OIDC.

Commands and configuration

source learn-vault/.runtime/learner.env
cd learn-vault/labs/approle-app
./login.sh
jq '{policies:.auth.policies,lease_duration:.auth.lease_duration}' ../../.runtime/approle-login.json
./whoami.sh

Secret-safety stop

Stop: If RoleID and SecretID live in the same image, repository, CI variable set, or bundle, AppRole has become a static shared credential.

Failure drill

SymptomAppRole login reports invalid role or secret ID.
Likely causesWrong mount, expired or exhausted SecretID, wrong-environment RoleID, or bind mismatch.
Inspect safelyCheck file presence, modes, timestamps, role, mount, and SecretID accessor metadata.
Do not printSecretID, wrapping token, unwrap response, or Vault token.

Break it / fix it

Break it: Swap RoleID and SecretID or use an expired SecretID.

Show diagnosis and fix

Fix it: Restore separately delivered factors or mint a new bounded SecretID through bootstrap.

Escalate with time, endpoint, auth path, role, mount, namespace when relevant, status code, request ID, and sanitized error class. Never attach a credential or response body.

Try it

Bootstrap boundary

labs/bootstrap owns the disposable server, auth mounts, policies, roles, and engines; learner actions begin after setup.

Cost:

$0; local containers only

Starting state:

Run labs/bootstrap/setup.sh and source .runtime/learner.env unless the chapter lab says AppRole alone is sufficient.

User actions:

Use bootstrap-generated RoleID and SecretID files to log in; scripts retain the response only under ignored runtime storage.

cd learn-vault/labs/approle-app
./login.sh
test -s ../../.runtime/approle-login.json
jq -e '.auth.policies|index("lockbox-orders-api")' ../../.runtime/approle-login.json
test "$(stat -f '%Lp' ../../.runtime/approle-login.json)" = 600
./cleanup.sh

Success criteria:

Complete every item in the Verify section using metadata-only evidence; no secret value appears in terminal output or tracked files.

Troubleshooting:

Use the Failure drill and Break it / fix it evidence fields. Stop before broadening policy, weakening identity or TLS checks, or copying secret-bearing diagnostics.

Verify

  1. Login has the lockbox-orders-api policy and a finite TTL.
  2. The response file is mode 0600.
  3. Cleanup removes the token-bearing response.
Evidence rule: retain only status, policy names, TTLs, versions, timestamps, fingerprints, and error classes. Never retain secret values.

Cleanup

Run the lab cleanup. Bootstrap can mint a fresh SecretID for another session.

Project Lockbox increment

AppRole is the portable local identity; production prefers AWS IAM on EC2 and Kubernetes auth on EKS.

Quick check

When does AppRole fit?

Machines or legacy schedulers without a verifiable platform identity.

Why separate the factors?

One delivery-channel compromise should not complete the login.

What does wrapping protect?

Sensitive response delivery through an intermediary.

What is preferred on EKS?

A narrowly bound Kubernetes service-account identity.

Gotchas

Recap and next

Workload auth should derive trust from the runtime; AppRole is a controlled fallback, not the universal default.

Primary references

Continue →