Secrets Rotation
Introduction
Secrets rotation is the process of updating or replacing sensitive information stored as Kubernetes secrets. Secrets rotation is crucial for maintaining strong security and mitigating risks of unauthorized access or data breaches.
In a multi-component system, such as a ForgeOps deployment, each component interacts with others using secrets. Therefore, it’s important to consider dependencies among components and perform secrets rotation while maintaining consistent interaction among dependent components.
The forgeops command includes the rotate sub-command
to enable ds-env-secrets and ds-passwords rotation consistently. You can
rotate other ForgeOps required secrets also with due consideration to the
impact on dependent components and downtime.
Performing secrets and passwords rotation
This section describes how to rotate secrets and password in ForgeOps deployments. The steps for rotating each secret are mentioned separately for easier understanding and usage.
Rotating ds-env-secrets
The ds-env-secrets controls access to DS from AM and IDM,
and would normally cause a downtime when rotated. To avoid such a downtime, the
forgeops rotate command creates old-ds-env-secrets
temporarily to contain old secrets.
In ForgeOps release 2025.2.1, the DS image was built to accommodate multiple passwords. This enables secrets rotation with no downtime.
- For deployments using DS images from 2025.1 or earlier
-
If you are using the DS image from the 2025.1 release or earlier, then perform these steps to enable multiple passwords in DS.
-
In your terminal window, set up environment variables to get the password and connection string (DSPASS and CONN_STR):
$ export DSPASS=$(kubectl get secret ds-passwords -n my_ns -o yaml | yq '.data["dirmanager.pw"]' | tr -d '"' | base64 -d -i -) $ export CONN_STR="--hostname localhost --port 4444 --bindDn uid=admin --trustAll --no-prompt --bindPassword $DSPASS"
-
Set up DS pods to enable multiple passwords:
$ kubectl exec -it ds-cts-0 — bin/dsconfig set-password-policy-prop \ set-password-policy-prop --policy-name "Default Password Policy" \ --set allow-multiple-password-values:true $CONN_STR $ kubectl exec -it ds-cts-0 — bin/dsconfig set-password-policy-prop \ set-password-policy-prop --policy-name "Root Password Policy" \ --set allow-multiple-password-values:true $CONN_STR $ kubectl exec -it ds-idrepo-0 — bin/dsconfig set-password-policy-prop \ set-password-policy-prop --policy-name "Default Password Policy" \ --set allow-multiple-password-values:true $CONN_STR $ kubectl exec -it ds-idrepo-0 — bin/dsconfig set-password-policy-prop \ set-password-policy-prop --policy-name "Root Password Policy" \ --set allow-multiple-password-values:true $CONN_STR
-
To rotate ds-env-secrets, run the forgeops rotate --namespace
my_ns ds-env-secrets command.
The command prompts you to perform steps to complete rotation of ds-env-secrets.
Rotating ds-passwords
To rotate ds-passwords, run the forgeops rotate --namespace
my_ns ds-passwords command.
The command prompts you to perform steps to complete rotation of ds-passwords.
You must restart the DS pods to update the admin user password because
that password is set on DS pod startup. This could also require
restarting some services instead of redeploying components.
At the end of its successful run, the forgeops rotate command prompts the user to:
-
Delete the temporary secrets.
-
Remove the old passwords.
Rotating amster secret
- Impact
-
This secret is specific to Amster and doesn’t cause a downtime.
- Procedure
-
-
Trigger renewal of Kubernetes secret:
-
When using
secret agent:$ kubectl delete secret amster
-
When using
secrets generator:$ kubectl annotate secrets amster secret-generator.v1.mittwald.de/regenerate=amster
-
-
Rolling restart AM pods to pick up new
amstersecret:$ kubectl rollout restart deployment am -n my-ns -
Refresh amster job to verify
amstercan access AM:-
Delete amster job to allow redeployment:
$ kubectl delete job amster -n my-ns -
Deploy platform changes (
amster)-
For Helm:
$ helm upgrade -i identity-platform --repo https://ForgeRock.github.io/forgeops/ \ --version my-prod-version \ --values /path/to/forgeops/helm/my-env/values.yaml
-
For Kustomize:
$ forgeops apply amster --env-name my-env
-
-
-
Ensure that the
amster importprocess has completed successfully:$ kubectl logs -f amster-pod -n my-ns
-
Rotating am-env-secrets
- Impact
-
AM depends on this secret for authentication. Therefore, during the short time between restarting AM and rerunning Amster, requests that need authentication could fail.
- Procedure
-
-
Trigger renewal of Kubernetes secret:
-
When using
secret agent:$ kubectl delete secret am-env-secrets
-
When using
secrets generator:$ kubectl annotate secrets idm-env-secrets secret-generator.v1.mittwald.de/regenerate=am-env-secrets
-
-
Rolling restart AM pods to pick up new amster secret:
$ kubectl rollout restart deployment am -n my-ns -
Reinitiate the amster job:
-
Delete the amster job to allow redeployment:
$ kubectl delete job amster -n my-ns -
Redeploy
amster:-
For Helm:
$ helm upgrade -i identity-platform --repo https://ForgeRock.github.io/forgeops/ \ --values /path/to/forgeops/helm/my-env/values.yaml -
For Kustomize:
$ forgeops apply amster --env-name my-env
-
-
-
Ensure that the amster import process has completed successfully:
$ kubectl logs -f amster-pod -n my-ns
-
Retrieve the new password for
amadminuser to log in to the platform:$ forgeops info | grep amadmin
-
Log in to the platform with new
amadminpassword to verify the platform is up and running.
-
Rotating amster-env-secrets
- Impact
-
In the very short time between restarting IDM and Amster importing necessary data, the platform isn’t accessible. Amster takes a few seconds to import data.
- Procedure
-
-
Trigger renewal of Kubernetes secret:
-
When using
secret agent:$ kubectl delete secret amster-env-secrets
-
When using
secrets generator:$ kubectl annotate secrets amster-env-secrets secret-generator.v1.mittwald.de/regenerate=amster-env-secrets
-
-
Rolling restart IDM pods to get the new amster secret:
$ kubectl rollout restart deployment idm -n my-ns -
Rerun the
amsterjob to import the new secrets:-
Delete the
amsterjob to allow redeployment:$ kubectl delete job amster -n my-ns -
Redeploy Amster:
-
When using Helm to deploy:
$ helm upgrade -i identity-platform --repo https://ForgeRock.github.io/forgeops/ --values /path/to/custom/values.yaml
-
When using Kustomize deploy:
$ forgeops apply --env-name my-env amster
-
-
-
Rotating idm-env-secrets
- Procedure
-
-
Trigger renewal of Kubernetes secret:
-
When using
secret agent:$ kubectl delete secret idm-env-secrets
-
When using
secrets generator:$ kubectl annotate secrets idm-env-secrets secret-generator.v1.mittwald.de/regenerate=OPENIDM_ADMIN_PASSWORD
-
-
Rolling restart IDM pods:
$ kubectl rollout restart deployment idm
-
Check pods have come up:
$ kubectl get pods -l app.kubernetes.io/component=idm -n my-ns
-
Rotating ds-ssl-keypair
| It’s not advisable to rotate this secret. If you rotate this secret DS data replication will fail until all the DS pods are restarted. |
- Procedure
-
-
Delete the
ds-ssl-keypairsecret:$ kubectl delete secret ds-ssl-keypair -n my-ns -
Check that the secret is recreated:
$ kubectl get secret ds-ssl-keypair -n my-ns -
Rolling restart
ds-ctspods to pick up new secret:$ kubectl rollout restart sts ds-cts -n my-ns -
Rolling restart
ds-idrepopods to pick up new secret:$ kubectl rollout restart sts ds-idrepo -n my-ns -
Rolling restart AM pods to pick up new secret:
$ kubectl rollout restart deployment am -n my-ns -
Rolling restart IDM pods to pick up new secret:
$ kubectl rollout restart deployment idm -n my-ns -
Check pods to ensure they have come back up:
$ kubectl get pods -l app.kubernetes.io/component=ds-cts -n my-ns $ kubectl get pods -l app.kubernetes.io/component=ds-idrepo -n my-ns $ kubectl get pods -l app.kubernetes.io/component=am -n my-ns $ kubectl get pods -l app.kubernetes.io/component=idm -n my-ns
-
Rotating am-passwords
- Impact
-
Rotating
am-passwordsdoesn’t necessitate a down-time.am-passwordsis used only in ForgeOps deployments that usesecret agentfor secrets management. It’s not relevant for deployments that usesecrets generator. - Procedure
-
-
Trigger renewal of Kubernetes secret:
$ kubectl delete secret am-passwords $ kubectl delete secret am-keystore
-
Delete the AM pod:
$ kubectl delete pod am-wxyz-abcd -
Recreate keystore to use the new secret.
-
Rotating keystore-create
- Impact
-
You can rotate
keystore-createonly when usingsecret generatorand provisioning a new keystore. - Procedure
-
-
Trigger renewal of Kubernetes secret:
$ kubectl annotate secrets idm-env-secrets secret-generator.v1.mittwald.de/regenerate=keystore-create
-
Delete the
keystore-createjob:$ kubectl delete job keystore-create
-
Redeploy platform products to redeploy the
keystore-createjob:$ kubectl rollout restart deployment am $ kubectl rollout restart deployment idm
-
Verify if the pods have come up:
$ kubectl get pods -l app.kubernetes.io/component=am -n my-ns
-
Rotating ds-master-keypair
|
Do not rotate |