Supply secrets to P4 Server
You supply each secret to P4 Server as a P4 variable, in the same way as other P4 variables such as P4PORT. The name of the variable determines whether the value comes directly from the variable, from a file, or from a remote vault.
Choose how to supply a secret
Each secret has a base name, such as P4IDPCLIENTSECRET. You can supply the secret in any of the following forms:
| Variable | Value of the variable |
|---|---|
|
|
The secret itself. You can supply this form only in the environment: P4 Server refuses to store it with |
|
|
The path to a file that contains the secret. A path is not a secret, so you can also set this variable with |
|
|
The name of the secret in a remote vault. You can also set this variable with |
If you set more than one form for the same secret, P4 Server uses the first form in the order shown in the table and silently ignores the others. Unset any form that you do not use.
The names are uppercase and start with P4. A value that you store with p4 configure set takes precedence over the same variable in the environment. These variables are read when the server starts, so restart the server after you change one.
P4ENVIRO, p4 set, and the Windows services registry.Identify the variables for each secret
| Secret | Variable names |
|---|---|
|
OIDC client secret |
|
|
Signing key |
If |
Format the secret values
P4 Server expects the following formats:
-
Multiple versions. To supply more than one version of a secret, separate the versions with a space, a line feed, or a carriage return. List the newest version first.
-
Signing keys. A key must be a JSON Web Key (JWK) that is Base64url-encoded. P4 Server rejects a raw, unencoded JWK.
-
Tokens and other text secrets. P4 Server stores these values as they are, without encoding. Because whitespace separates versions, a value cannot contain whitespace.
Set a secret on Linux
To set a variable for a systemd service, add the following to the service unit. Replace the placeholder with your own value.
[Service] Environment=P4IDPCLIENTSECRET=<client-secret>
After you edit a unit file, run systemctl daemon-reload and restart the p4d service.
To keep the secret out of the unit file, supply the secret in a file that the service account alone can read, and then name the file:
[Service] Environment=P4IDPCLIENTSECRETFILE=/etc/p4d/secrets/oidc-client-secret
Set a secret on Windows
To set a system environment variable, run the following command from an elevated command prompt, and then restart the p4d service:
setx P4IDPCLIENTSECRET "<client-secret>" /M
Next steps
To retrieve a secret from a remote vault, see Retrieve secrets from HashiCorp Vault. To change a secret on a running server, see Rotate secrets.