Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

Kcrypt challenger
Kcrypt TPM challenger
With Kairos you can build immutable, bootable Kubernetes and OS images for your edge devices as easily as writing a Dockerfile. Optional P2P mesh with distributed ledger automates node bootstrapping and coordination. Updating nodes is as easy as CI/CD: push a new image to your container registry and let secure, risk-free A/B atomic upgrades do the rest.
Documentation |
Contribute |
---|---|
📚 Getting started with Kairos |
❗ | This is experimental! |
---|
This is the Kairos kcrypt-challenger Kubernetes Native Extension.
Usage
See the documentation in our website: https://kairos.io/docs/advanced/partition_encryption/.
TPM NV Memory Cleanup
⚠️ DANGER: This command removes encryption passphrases from TPM memory! ⚠️ If you delete the wrong index, your encrypted disk may become UNBOOTABLE!
During development and testing, the kcrypt-challenger may store passphrases in TPM non-volatile (NV) memory. These passphrases persist across reboots and can accumulate over time, taking up space in the TPM.
To clean up TPM NV memory used by the challenger:
# Clean up the default NV index (respects config or defaults to 0x1500000)
kcrypt-discovery-challenger cleanup
# Clean up a specific NV index
kcrypt-discovery-challenger cleanup --nv-index=0x1500001
# Clean up with specific TPM device
kcrypt-discovery-challenger cleanup --tpm-device=/dev/tpmrm0
Safety Features:
- By default, the command shows warnings and prompts for confirmation
- You must type "yes" to proceed with deletion
- Use
--i-know-what-i-am-doing
flag to skip the prompt (not recommended)
Note: This command uses native Go TPM libraries and requires appropriate permissions to access the TPM device.
Installation
To install, use helm:
# Adds the kairos repo to helm
$ helm repo add kairos https://kairos-io.github.io/helm-charts
"kairos" has been added to your repositories
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "kairos" chart repository
Update Complete. ⎈Happy Helming!⎈
# Install the CRD chart
$ helm install kairos-crd kairos/kairos-crds
NAME: kairos-crd
LAST DEPLOYED: Tue Sep 6 20:35:34 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
# Installs challenger
$ helm install kairos-challenger kairos/kcrypt-challenger
TODO: Implement Selective Enrollment Mode for Attestation Data
Problem Statement
Currently, the TPM attestation system faces operational challenges in real-world deployments:
- Test Complexity: Tests require manually creating SealedVolumes with complex mock attestation data (EK, AK, PCR values)
- Upgrade Compatibility: Kernel upgrades change PCR values, causing TPM quarantine and disk inaccessibility
- Operational Flexibility: No mechanism for operators to reset/update attestation data after TPM replacement, firmware upgrades, or key rotation
Proposed Solution: Selective Enrollment Mode
Implement a "selective enrollment mode" where operators can set specific attestation fields to empty/null values in SealedVolume specs, indicating that the server should:
- Accept any value for that field during attestation
- Store the received value for future verification
- Update the SealedVolume with the learned value
Required Implementation Changes
1. SealedVolume API Enhancement
spec:
TPMHash: "required-tpm-hash" # MUST be set for client matching
attestation:
ekPublicKey: "" # Empty = enrollment mode
akPublicKey: "" # Empty = enrollment mode
pcrValues:
pcrs:
"0": "" # Empty = enrollment mode for this PCR
"7": "fixed-value" # Set = enforce this value
# "11": omitted # Omitted = skip verification entirely
2. Server Logic Updates
- Modify
verifyAKMatch()
to handle empty AK fields as enrollment mode - Modify
verifyPCRValues()
to handle empty PCR values as enrollment mode - Add logic to update SealedVolume specs when learning new values
- Ensure TPM hash is always required and validated for client matching
3. Test Simplification
Replace complex mock attestation data in tests with simple enrollment mode:
# tests/encryption_test.go - remote-static test
spec:
TPMHash: "computed-from-vm" # Get from /system/discovery/kcrypt-discovery-challenger
partitions:
- label: COS_PERSISTENT
secret: {name: "static-passphrase", path: "pass"}
attestation: {} # Full enrollment mode
Use Cases Solved
- Static Passphrase Tests: Create Secret + minimal SealedVolume, let TOFU handle attestation
- Production Manual Setup: Operators set known passphrases + TPM hashes, system learns security data
- Firmware Upgrades: Set PCR fields to empty to re-learn after BIOS updates
- TPM Replacement: Set AK field to empty to re-learn after hardware changes
- Kernel Updates: Omit PCR 11 entirely to avoid quarantine on upgrades
Critical Implementation Notes
- TPM Hash MUST remain mandatory - without it, multiple clients would match the same SealedVolume
- EK verification should remain strict - only AK and PCRs should support enrollment mode
- Add proper logging for enrollment events for audit trails
- Consider rate limiting to prevent abuse of enrollment mode
- Update documentation with operational procedures for each use case
Priority: High
This blocks current test failures and addresses fundamental operational challenges for production deployments.