Skip to content

feat: Retrieve ENCRYPTION_KEY from backup server - #363

Open
adskyiproger wants to merge 1 commit into
developfrom
ocrvs-10927
Open

feat: Retrieve ENCRYPTION_KEY from backup server#363
adskyiproger wants to merge 1 commit into
developfrom
ocrvs-10927

Conversation

@adskyiproger

@adskyiproger adskyiproger commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Related issue: opencrvs/opencrvs-core#10927

This PR adds a more secure decrypt-on-boot flow for environments using OpenCRVS disk encryption. The goal is to help protect citizens’ data in the event of physical intrusion into a data centre, especially for countries that do not already have hardware-backed or platform-level disk encryption in place.

Backup server is always required for staging and production environments.

For environments with a dedicated backup server, the disk encryption key can now be stored remotely in encrypted form and retrieved during boot only when needed. For environments without a backup server, the existing local key-file flow is preserved.

Testing

Provision on existing environment: https://github.com/opencrvs/opencrvs-testland-infrastructure/actions/runs/31385870887

Provision artifacts:

Kubernetes master has backup-encryption-passphrase.txt
image

Backup server:

Reboot test (all conditions are good)

Encrypted partition successfully mounted:
image

Kubernetes is up:
image

Reboot test (backup server is not available)

No mount point for encrypted partition:
image

Kubernetes is not running:
image

Login on broken system:
image

disk_encryption_key: ${{ secrets.ENCRYPTION_KEY }}
repository: ${{ github.repository }}
backup_encryption_passphrase: ${{ secrets.BACKUP_ENCRYPTION_PASSPHRASE }}
backup_server_user: ${{ secrets.BACKUP_SERVER_USER }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adskyiproger do we need to amend the environment:init script to add / update these new secrets?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't introduce new secrets to environment:init, we will reuse existing secrets. There is no need to update anything there.

# Disk Encryption key location as an example (in production use a hardware security module)
# Disk Encryption key location:
# On single server deployments, the disk encryption key is stored on the same server as encrypted data.
disk_encryption_key_path: /root/disk-encryption-key.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adskyiproger there seems little point in encrypting any single server that doesnt have a a backup, as that would be a QA environment right? Every production or staging server has a backup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single server environments will continue to work by existing way. We are making assumption that development and QA environments don't have PII data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants