- Enable the jwt auth method:
vault auth enable jwt
- federate the kubernetes cluster:
vault write auth/jwt/config \
oidc_discovery_url=<KUBERNETES URL> \
oidc_discovery_ca_pem=@<KUBERNETES CA PEM FILE> \
bound_issuer=<KUBERNETES ISSUER>
The Kubernetes CA certificate PEM can be obtained with:
kubectl get cm kube-root-ca.crt \
-o jsonpath="{['data']['ca\.crt']}" > kubernetes_ca.crt
- Create the
aegis-operator
policy in Hashicorp Vault
path "identity/entity" {
capabilities = ["create", "read", "update", "delete"]
}
path "identity/entity/name/*" {
capabilities = ["read","delete"]
}
path "identity/oidc/role/*" {
capabilities = ["create", "read", "update", "delete"]
}
path "identity/entity-alias" {
capabilities = ["create", "read", "update","delete"]
}
path "identity/entity-alias/id/*" {
capabilities = [ "read","delete"]
}
path "auth/jwt/role/*"{
capabilities = ["create", "read", "update","delete"]
}
path "sys/auth" {
capabilities = ["read"]
}
- Create the jwt AEGIS role
vault write auth/jwt/role/aegis \
role_type="jwt" \
bound_audiences="vault" \
user_claim="sub" \
bound_subject="system:serviceaccount:operator-system:operator-controller-manager" \
policies="aegis-operator" \
ttl="1h"
- Create the
jwt_issuer
policy
path "identity/oidc/token/*" {capabilities = ["create","read"]}
- Create a named key
POST {{vault_address}}/v1/identity/oidc/key/aegis-key
X-Vault-Token: {{vault_token}}
{
"name": "aegis-key",
"allowed_client_ids": ["*"]
}