Rotate the JWT Signing Keys
OpenMetadata signs the JWT tokens it issues with one RSA key pair, set injwtTokenConfiguration. These tokens include user sessions, personal access tokens, and bot tokens such as the one the ingestion-bot uses. Rotate the key pair when you replace the default keys shipped for testing, when the private key may have leaked, or when your security policy requires it.
Rotation is a hard cut. You stop every server, start them all with the new key pair, and then regenerate the bot tokens with the regenerate-bot-tokens command. Tokens signed by the old key stop working.
Before You Start
Check the following before you rotate the keys:- You run OpenMetadata 2.1.0 or later.
- You have picked a time when bot downtime is acceptable.
- You have shell access to a host, container, or pod that can run
./bootstrap/openmetadata-ops.sh. It needs the same configuration as the servers and network access to the server API. A server container or pod meets both conditions. pipelineServiceClientConfiguration.metadataApiEndpoint(SERVER_HOST_API_URL) is set in that configuration. The command reads the server’s JSON Web Key Set (JWKS) from this endpoint and redeploys pipelines through it.
Step 1: Create a New Key Pair
OpenMetadata reads the private key as DER PKCS#8 and the public key as DER X.509. Use keys of 2048 bits or more:JWT_KEY_ID, so that services that cache the JWKS fetch the new key. The Enable JWT Tokens page asks you to keep the key ID unchanged across upgrades. A key rotation is the exception.
Keep private_key.der secret. Make it readable only by the user that runs the OpenMetadata server.
Step 2: Restart Every Server with the New Keys
Stop every OpenMetadata server before you start any server with the new keys. Do not use a rolling restart. During a rolling restart, a restarted server can fetch the old public key from a server that has not restarted yet. This happens whenauthenticationConfiguration.publicKeyUrls (AUTHENTICATION_PUBLIC_KEYS) points to an OpenMetadata URL behind a load balancer. The server caches that key for up to 24 hours and keeps accepting old user sessions and personal access tokens. The default localhost JWKS URL avoids this problem.
Set the following values in the configuration of every server and of the host that runs openmetadata-ops.sh. All of them must hold the same values.
Follow the steps for your deployment:
- Bare Metal
- Docker
- Kubernetes
- Stop every OpenMetadata server.
- Copy
private_key.derandpublic_key.derto the OpenMetadataconfdirectory of each server, or to the paths set inRSA_PRIVATE_KEY_FILE_PATHandRSA_PUBLIC_KEY_FILE_PATH. - Set
JWT_KEY_ID, orjwtTokenConfiguration.keyIdinconf/openmetadata.yaml, to the new key ID. - Start every server.
- Users get
401 Unauthorizedon their old sessions and must sign in again. - Holders of personal access tokens must create new tokens.
- Bots stay rejected until you complete step 3.
Step 3: Regenerate the Bot Tokens
Runregenerate-bot-tokens from the OpenMetadata server directory, with the same configuration the servers use:
- Bare Metal
- Docker
- Kubernetes
- Fetches
<metadataApiEndpoint>/v1/system/config/jwksand checks that it lists the configured key ID with the same public key. If it doesn’t, the command changes nothing, prints the reason, and exits with code2. This check reads only the server behindmetadataApiEndpoint, so it cannot confirm that every server restarted. - Gives every bot that uses JWT authentication a new token signed by the new key. Each change is recorded in the audit log as an update by
admin. A bot whose token was revoked is skipped and stays without a token. - Redeploys every ingestion pipeline that is marked as deployed, so that it uses the new
ingestion-bottoken. WhenpipelineServiceClientConfiguration.enabledisfalse, the command skips this step.
Command Options
Without
--skip-current, the command replaces every token except revoked ones. Run it without the option to replace a leaked bot token without rotating the keys. Don’t use --skip-current in that case, because the leaked token still verifies under the configured key and would be kept.
Command Results
The command prints one row per bot with one of these outcomes:REGENERATED: The bot has a new token.ALREADY_CURRENT: The token was left unchanged. This outcome appears only with--skip-current.SKIPPED: The bot has no bot user, doesn’t use JWT authentication, or its token was revoked.FAILED: The token wasn’t replaced. The details column gives the reason.
If a bot fails with
changed concurrently, re-run, someone edited it while the command ran. Run the command again with --skip-current, so that only the failed bots get new tokens.
If every bot fails with Private key does not match the public key, RSA_PRIVATE_KEY_FILE_PATH and RSA_PUBLIC_KEY_FILE_PATH point to keys from different pairs. No token is stored in that case.
Pipelines That Aren’t Redeployed
The command redeploys only pipelines marked as deployed. To deploy every pipeline registered in OpenMetadata, including pipelines that were never deployed, run:Step 4: Check the Result
Confirm the following:/api/v1/system/config/jwkson each server lists only the new key ID.- The command report shows every bot as
REGENERATED, orALREADY_CURRENTon a--skip-currentrun. Bots whose tokens you revoked show asSKIPPED. - Ingestion pipelines run again, on schedule or when you trigger them manually.
Update Tokens Stored Outside OpenMetadata
The new keys invalidate copies of old tokens that other systems hold. Update the following:- Personal access tokens: The command doesn’t re-sign or delete personal access tokens. The old tokens can still appear as unexpired in the UI, but requests that use them return
401 Unauthorized. Ask their owners to revoke the old tokens, create new ones, and update their clients. - Copied bot tokens: Copy the new token from Settings > Bots to every system that holds the old one, such as CI jobs and external pipelines.
- Airflow lineage backend: Replace
jwt_tokenin the[lineage]section ofairflow.cfg, ormetadata_config.securityConfig.jwtTokenin the JSON file set inOPENMETADATA_LINEAGE_CONFIG. Pipeline redeployment doesn’t update these values. - Airflow
OpenMetadataHook: Replace the password of the Airflow connection that the hook uses,openmetadata_defaultby default. Pipeline redeployment doesn’t update this connection. - Services that verify OpenMetadata tokens through the JWKS: Make sure they reload the JWKS and accept the new key ID. Remove any cached or pinned copy of the old public key, so that they reject tokens signed by it.