Manage server secrets

P4 Server can retrieve sensitive values, such as a client secret or a signing key, from sources that you control instead of storing them itself. The values stay outside the server database and outside the server configuration.

Choose where secrets come from

P4 Server can retrieve a secret from any of the following sources:

  • An environment variable of the p4d process.

  • A file that the p4d service account can read.

  • A remote vault. P4 Server supports one remote vault, the HashiCorp Vault KV version 2 secrets engine. Connections to Vault use TLS, and you can supply a custom CA bundle for hardened Vault deployments.

For each secret, you choose the source by choosing which environment variable you set. To learn how, see Supply secrets to P4 Server.

Identify which secrets the server retrieves

P4 Server retrieves the following secrets from these sources:

Secret Purpose

OIDC client secret

Authenticates the P4 Web Server to Keycloak when P4 Server uses built-in single sign-on (SSO).

Signing key

Signs the requests that the P4 Web Server sends to Keycloak when auth.idp.auth_method is private_key_jwt.

Understand how secrets are handled

  • Error messages never include a secret value.

  • If P4 Server cannot retrieve a secret, requests that need the secret fail. P4 Server does not fall back to a previously retrieved value.

  • P4 Server reads the OIDC client secret and the signing key from their source each time that it uses them. When you replace the contents of a secret file or update a Vault entry, the new value takes effect on the next request, without a reload or a restart.

  • A change to an environment variable takes effect only after you restart the p4d service, because the p4d process reads its environment when it starts.

Next steps