keycloakvault

How to utilize vault feature in Keycloak


I'm attempting to use the Vault feature in Keycloak 24 by following the documentation provided at https://www.keycloak.org/server/vault.

According to the documentation, I've tried to set up a plain-text file-based vault as follows and named as 'iam_smtphost', iam is realm name

smtphost.amazonses.com
  1. I then mounted this file in the Keycloak Docker container.
  2. The run command first executes /opt/keycloak/bin/kc.sh build --vault=file.
  3. Then It executes exec /opt/keycloak/bin/kc.sh start-dev --http-port=8200 --hostname=localhost --vault-dir=/vault/secrets/.
  4. I referred to the secret as ${vault.smtphost} in the admin console realm settings.

Keycloak starts normally and works properly. However, when attempting to send an email, it doesn't retrieve the value from the secret file I provided; instead, it interprets the string literally and fails.

I'm unsure how to properly utilize this feature.


Solution

  • You should try to start your server not with start-dev but use start and use --optimized.