Exporting Secrets
The export command creates a backup archive of your project’s encrypted secrets. This is useful for disaster recovery, migration, and archival purposes.
What gets exported
Section titled “What gets exported”The export includes only encrypted data:
.kanuka/config.toml- Project configuration.kanuka/public_keys/*.pub- All user public keys.kanuka/secrets/*.kanuka- Encrypted symmetric keys for each user- All
*.kanukafiles - Encrypted secret files throughout the project
The export does not include:
- Private keys (these are stored locally, not in the project)
- Plaintext
.envfiles (only encrypted versions are included)
Creating an export
Section titled “Creating an export”To export your encrypted secrets:
kanuka secrets exportThis creates an archive with a date-stamped filename:
Exported secrets to kanuka-secrets-2024-01-15.tar.gz
Archive contents: .kanuka/config.toml .kanuka/public_keys/ (3 files) .kanuka/secrets/ (3 user keys) 5 encrypted secret files
Note: This archive contains encrypted data only. Private keys are NOT included.Custom output path
Section titled “Custom output path”Use the -o or --output flag to specify a custom output path:
kanuka secrets export -o /backups/project-secrets.tar.gzArchive format
Section titled “Archive format”The export creates a gzip-compressed tar archive (.tar.gz) with this structure:
kanuka-secrets-2024-01-15.tar.gz├── .kanuka/│ ├── config.toml│ ├── public_keys/│ │ ├── user1-uuid.pub│ │ └── user2-uuid.pub│ └── secrets/│ ├── user1-uuid.kanuka│ └── user2-uuid.kanuka├── .env.kanuka├── .env.local.kanuka└── config/.env.production.kanukaExport examples
Section titled “Export examples”# Export with default filename (includes date)kanuka secrets export
# Export to specific pathkanuka secrets export -o ~/backups/myproject-secrets.tar.gz
# Export to a shared backup locationkanuka secrets export -o /shared/backups/$(date +%Y%m%d)-secrets.tar.gzStoring exports safely
Section titled “Storing exports safely”Since exports contain encrypted data, they are safe to store in most locations. However, for best practices:
- Store in a secure location - Use encrypted storage if available
- Maintain access control - Limit who can access backup files
- Consider retention policy - Old backups may contain outdated encryption
- Test restoration - Periodically verify backups can be restored
Using exports for disaster recovery
Section titled “Using exports for disaster recovery”To restore from an export:
- Clone or set up a fresh project repository
- Use
kanuka secrets importto restore the encrypted files - Ensure you have your private key available
- Run
kanuka secrets decryptto access the secrets
See the Import guide for detailed restoration instructions.
Next steps
Section titled “Next steps”- Import guide - Restore secrets from an export
- Sync command - Rotate encryption keys
- Status command - Check encryption status