Manage Age encryption for development, security, and recovery
This documentation was written for SOPS that is using Age encryption. Please check the Use SOPS for value encryption page for other KMS providers.
Prerequisites
- Version >=
v3.1
Local development setup
Steps
-
Create a values folder:
mkdir -p values-folder ~/workspace -
Clone the values repo from Gitea:
In case your TLS certificate is not trusted, set GIT_SSL_NO_VERIFY to clone the git repository:
export GIT_SSL_NO_VERIFY=truegit clone gitea.<cluster.domainSuffix>/otomi/values.git ~/workspace/values-folder -
Copy SOPS_AGE_KEY secret:
-
Copy the
SOPS_AGE_KEYsecret, which is the private key for Age, from the cluster. It is located in theotomi-pipelinesnamespace in theotomi-sops-secrets, or in theotominamespace in theotomi-apisecret. -
Create a
.secretsfile in the values-folder at the root level and insert theSOPS_AGE_KEYinto it.
Don't forget to use
=instead of:.SOPS_AGE_KEY=AGE-SECRET-KEY-1XXX -
-
Export ENV_DIR:
Export
ENV_DIRin the core repository to useotomi-cli.export ENV_DIR=~/workspace/values-folder -
Use
otomi-cli:The local development environment is now ready to use otomi-cli commands.
Age keys rotation
Please follow the local development setup steps above and be prepared to use
otomi-cli.
Steps
-
Decrypt files with the old key and credentials:
docker run -it -v $ENV_DIR:/home/app/stack/env linode/apl-core binzx/otomi decryptThe decrypted files have the
.decextension. -
Change the following files
-
In the
env/settings.yamlfile update thekms.sops.age.publicKeyproperty. -
In the
env/secrets.settings.yaml.decfile update thekms.sops.age.privateKeyproperty. -
In the
.secretsfile change theSOPS_AGE_KEYcredential.
-
-
Change the modification date of each
.decfileThis way we enforce encryption of all secret files.
cd ~/workspace/values-folder && find . -name '*.dec' -type f -exec touch {} \; -
Encrypt the
*.decfiles:docker run -it -v $ENV_DIR:/home/app/stack/env linode/apl-core binzx/otomi encrypt -
Update the secrets in the cluster. Update the following secrets in the cluster for
SOPS_AGE_KEY:-
Update the
otomi-sops-secretssecret in theotomi-pipelinesnamespace. -
Update the
otomi-apisecret in theotominamespace.
These secrets and related applications are managed by Argo CD, so don’t forget to update the secret values via Argo CD. It’s also possible to use a tool such as Kubernetes Lens to update Argo CD applications.
Alternatively,otomi applycan be used to update the secrets in the cluster before the nextgit push. -
-
Push the values to the
otomi-valuesrepo in Gitea:cd ~/workspace/values-folder && git push
Age disaster recovery
For disaster recovery, users need the
SOPS_AGE_KEY, which is the private key for Age. Please make sure to store theSOPS_AGE_KEYin a secure place. This key can be obtained from theotomi-sops-secretssecret in theotomi-pipelinesnamespace or from theotomi-apisecret in theotominamespace.
To configure Age public and private keys, add or update the following kms section in the values.yaml file when installing the App Platform.
kms:
sops:
provider: age
age:
publicKey: <age-public-key>
privateKey: <age-private-key>
Make sure to replace age-public-key and age-private-key values with your actual (existing) Age public and private keys.
Updated 4 months ago
