Rotate the certificate and credentials
You renew the platform certificate and rotate the credentials of your services by updating the environment variables or the config.yml file of the self-hosted-controller (SHC), then applying them with SHC commands. This page gives, for each certificate or credential, the commands that apply it and the components that they restart.
Plan a maintenance window
These procedures restart platform components. PlatformInstallation restarts the secret operator of the platform each time it runs, and redeploys every component whose deployed state differs from the configuration. RestartAllMicroservices restarts every microservice of the platform. K3SInstall restarts the K3s service of the nodes, one node at a time.
Prerequisites
- The platform is installed and the SHC can retrieve its kubeconfig.
- The environment variables of the SHC are in a protected file that you load before each run, as described in Configure the deployment.
Restart the SHC after changing a value
The SHC reads config.yml and resolves its ${env.VARIABLE} references once, when it starts. An open interactive interface keeps the previous values. After a change, quit the interface, load the updated environment variables in the shell that starts the SHC, then open the interface again before running the commands below. If you store the variables in a protected file, load that file again before restarting the SHC. In one-shot CLI mode, each ./run-shc.sh <command> starts a new SHC with the current configuration and the environment of the launching shell.
Renew the platform certificate
Traefik serves one certificate on HTTPS (port 443) and on the syslog (port 10514) and RELP (port 11514) intake ports. The SHC reads this certificate and its private key from the TRAEFIK_PUBKEY and TRAEFIK_PRIVKEY environment variables. The new certificate must meet the conditions described in TLS certificate.
-
In the shell that starts the SHC, load the new certificate and its private key:
export TRAEFIK_PUBKEY="$(cat /path/to/new-certificate.pem)" export TRAEFIK_PRIVKEY="$(cat /path/to/new-private-key.pem)"If you keep these variables in a protected file, update the file and load it instead. Quit any open SHC interface and open it again from this shell before the next step.
-
To regenerate the platform configuration and apply it, run:
exec PlatformConfigurationFile exec PlatformInstallationPlatformInstallationcompares each component with the configuration. It redeploys Traefik with the new certificate in thetraefik-self-hosted-cert-secretsecret of thekube-systemnamespace. It also updates theca-bundleConfigMap, which holds the certificate chain that the platform services trust, in thecommon,inthreat,support,symphony, andsymphony-runtimenamespaces. -
To check the certificate served on each port, run the following commands, with the value of
global.host:for PORT in 443 10514 11514; do echo "Port $PORT" openssl s_client -connect <global.host>:$PORT -servername <global.host> </dev/null 2>/dev/null \ | openssl x509 -noout -subject -enddate doneExpected output: the subject and the expiry date of the new certificate, for each port.
If a port still serves the previous certificate, check the certificate of the secret, then the Traefik logs:
kubectl get secret -n kube-system traefik-self-hosted-cert-secret -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -noout -enddate
kubectl logs -n kube-system -l app=traefik --prefix --tail=200
The console and ingest diagnostics also check the configured and the served certificates. To run them, enter exec Diagnostic --set modules.diagnostic.targets=console,ingest.
Rotate the credentials
| Credential | Where you set it | Applied by | Restarted components |
|---|---|---|---|
| Platform storage keys | STORAGE_S3_ACCESS_KEY, STORAGE_S3_SECRET_KEY |
PlatformInstallation, then RestartAllMicroservices |
Microservices. ClickHouse server pods, when the ClickHouse backups are enabled with the default backup credentials. |
| SMTP server settings | modules.platform_configuration.config.email.smtp.* |
PlatformInstallation, then RestartAllMicroservices |
Microservices. |
| Backup S3 credentials, when they differ from the platform storage keys | modules.platform_configuration.config.backups.s3.access_key, modules.platform_configuration.config.backups.s3.secret_key |
PlatformInstallation |
ClickHouse server pods. |
| OCI registry credentials of the nodes | REGISTRY_USERNAME, REGISTRY_PASSWORD |
K3SInstall |
K3s service of each node. |
| Git and OCI registry credentials of ArgoCD | GIT_HTTP_USERNAME, GIT_HTTP_PASSWORD, REGISTRY_USERNAME, REGISTRY_PASSWORD |
PlatformConfigurationFile, then PlatformInstallation |
None. ArgoCD registers the repositories again with the new credentials. |
| SSH key and sudo password of the nodes | SERVERS_SSH_KEY, SERVERS_SUDO_PASSWORD |
The next SHC command after restarting the SHC. Only the SHC uses them. | None. |
After the SHC has restarted with the updated configuration, PushImages, PushCharts, PushDataBundles, and PushArgoStacks use the new registry and Git credentials at their next run.
Rotate a credential stored in Vault
This procedure applies to the platform storage keys, the SMTP server settings, and the backup S3 credentials. The platform installer stores these values in Vault. Each run of PlatformInstallation writes the values of your configuration to Vault, replacing the previous ones, then restarts the secret operator, which refreshes the Kubernetes secrets of the platform from Vault. The platform services read these secrets when they start.
- Create the new credential with your provider, and keep the previous one valid until the end of this procedure. For the platform storage, give the new key the same permissions on the event buckets and on the backup bucket.
- Update the environment variable or the
config.ymlfield. Quit any open SHC interface, load the updated environment variables in the shell that starts the SHC, then open the interface again before the next step. -
To regenerate the platform configuration and apply it, run:
exec PlatformConfigurationFile exec PlatformInstallation -
For the platform storage keys and the SMTP server settings, restart the microservices so that they read the new values:
exec RestartAllMicroservicesSkip this step when you only changed the backup S3 credentials:
PlatformInstallationalready restarted the ClickHouse server pods. -
To check the platform services, run
exec Diagnostic. Every check reportsOK. - When the backups are enabled, run
exec Backups -m run_now, thenexec Backupsonce the backups are complete. Every component reportsfresh. - Revoke the previous credential with your provider.
Restart the microservices
RestartAllMicroservices restarts every Deployment, StatefulSet, and DaemonSet that carries the io.sekoia.microservice label or annotation, in every namespace, and waits up to 300 seconds in total for their rollouts. The databases carry no such marker: the command leaves them running.
The command fails, and lists the affected workloads, when a workload has a paused, OnDelete, or partitioned rollout, which it does not restart, or when a rollout does not complete within 300 seconds.
Rotate the Git and registry credentials
The registry credentials are used in two places. The nodes pull the container images with the credentials of the /etc/rancher/k3s/registries.yaml file, which K3SInstall renders on every node. ArgoCD reads the Helm charts from your registry, and the ArgoCD stacks from your Git repository, with the credentials registered for each repository. Each run of PlatformInstallation writes the credentials of your configuration to Vault, compares them with the credentials registered in ArgoCD, and registers the repositories again when they differ.
Apply everything in one run
exec Install runs K3SInstall, PlatformConfigurationFile, and PlatformInstallation in one run, with the K3s restarts described in Apply a configuration change.
- Create the new credential, and keep the previous one valid. A registry credential needs push, pull, and delete permissions on the registry project.
- Update
REGISTRY_USERNAMEandREGISTRY_PASSWORD, orGIT_HTTP_USERNAMEandGIT_HTTP_PASSWORD. Quit any open SHC interface, load the updated environment variables in the shell that starts the SHC, then open the interface again before the next step. -
For a registry credential, to write it on the nodes, run:
exec K3SInstallOn each node where
registries.yamlchanges, the command restarts thek3sservice of the manager nodes or thek3s-agentservice of the worker nodes, one node at a time, and waits until the service is back. -
To register the new credentials in ArgoCD, run:
exec PlatformConfigurationFile exec PlatformInstallationPlatformInstallationstops when ArgoCD rejects a repository registration, for example withArgoCD rejected the Git repository registration, or when the registered credentials still differ from Vault after the registration, withArgoCD repository configuration did not converge. Check the new credential, then run the two commands again. -
Revoke the previous credential with your provider.
- A few minutes later, to check that ArgoCD reads the stacks and the charts with the new credential, run
exec DebugArgoCD. Every application reportsSync: SyncedandHealth: Healthy.
Credentials that you cannot rotate with the SHC
| Credential | Behavior | What to do |
|---|---|---|
| Backup encryption keys in use | PlatformInstallation stops, and writes no secret, when BACKUP_ARANGO_CRYPT_KEY or BACKUP_CLICKHOUSE_CRYPT_KEY differs from the key in use. The error reads cannot replace an established Arango backup encryption key or cannot replace an established ClickHouse backup encryption key. It does not check BACKUP_VAULT_CRYPT_KEY. |
Keep the three keys unchanged. See Back up the platform. |
| Sekoia release bucket credentials | Sekoia issues S3_ACCESS_KEY and S3_SECRET_KEY. Only the SHC uses them, to download the release, the content bundles, and the CTI database. |
To change them, contact Sekoia. When Sekoia provides new ones, update the two variables. |
Related links
- Configure the deployment: Certificate conditions and environment variables of the SHC.
- Back up the platform: Backup S3 credentials and encryption keys.
- Run platform diagnostics: Check the certificate and the platform services after a rotation.
- Deploy the platform: Pass the environment variables to the SHC container.