I’ve got a weird one during setup: Vault < (OIDC) > Keycloak
Vault v1.18.5
kubectl: Client Version: v1.32.3
- port-forwarded out to the vault service
- logged into Vault with the root token
- I have full access via root token - no issues there
After sending the keycloak policy to vault:
vault policy write keycloak policy/keycloak-role.hcl
Contents of policy/keycloak-role.hcl
: (referred to later as policy_lines
)
# Mount the OIDC auth method
path "sys/auth/oidc" {
capabilities = [ "create", "read", "update", "delete", "sudo" ]
}
# Configure the OIDC auth method
path "auth/oidc/*" {
capabilities = [ "create", "read", "update", "delete", "list" ]
}
# Write ACL policies
path "sys/policies/acl/*" {
capabilities = [ "create", "read", "update", "delete", "list" ]
}
# List available secrets engines to retrieve accessor ID
path "sys/mounts" {
capabilities = [ "read" ]
}
The only thing that can be read FROM that policy afterwards is:
% vault policy read keycloak
path "/secret/*" {
capabilities = ["read", "list"]
}
This is not something that was even in policy/keycloak-role.hcl
.
However, when I wrap the policy in EOF - it totally works:
% vault policy write keycloak - <<EOF
policy_lines
EOF
I can then, re-run the read operation and get ALL of it:
% vault policy read keycloak
policy_lines
Can someone help me understand why the
vault policy write keycloak policy/keycloak-role.hcl
does NOT work but
the EOF method does?
This is troubling.
NOTE: I’m still testing policies and assume whatever is above is incorrect until testing is done.
If anyone has keycloak/Vault experience and can comment on that bit, also much appreciated.