|
| 1 | +# Key management and cryptographic primitives |
| 2 | + |
| 3 | +Constellation protects and isolates your cluster and workloads. |
| 4 | +To that end, cryptography is the foundation that ensures the confidentiality and integrity of all components. |
| 5 | +Evaluating the security and compliance of Constellation requires a precise understanding of the cryptographic primitives and keys used. |
| 6 | +The following gives an overview of the architecture and explains the technical details. |
| 7 | + |
| 8 | +## Confidential VMs |
| 9 | + |
| 10 | +Confidential VM (CVM) technology comes with hardware and software components for memory encryption, isolation, and remote attestation. |
| 11 | +For details on the implementations and cryptographic soundness, refer to the hardware vendors' documentation and advisories. |
| 12 | + |
| 13 | +## Master secret |
| 14 | + |
| 15 | +The master secret is the cryptographic material used for deriving the [*clusterID*](#cluster-identity) and the *key encryption key (KEK)* for [storage encryption](#storage-encryption). |
| 16 | +It's generated during the bootstrapping of a Constellation cluster. |
| 17 | +It can either be managed by [Constellation](#constellation-managed-key-management) or an [external key management system](#user-managed-key-management). |
| 18 | +In case of [recovery](#recovery-and-migration), the master secret allows to decrypt the state and recover a Constellation cluster. |
| 19 | + |
| 20 | +## Cluster identity |
| 21 | + |
| 22 | +The identity of a Constellation cluster is represented by cryptographic [measurements](attestation.md#runtime-measurements): |
| 23 | + |
| 24 | +The **base measurements** represent the identity of a valid, uninitialized Constellation node. |
| 25 | +They depend on the node image, but are otherwise the same for every Constellation cluster. |
| 26 | +On node boot, they're determined using the CVM's attestation mechanism and [measured boot up to the read-only root filesystem](images.md). |
| 27 | + |
| 28 | +The **clusterID** represents the identity of a single initialized Constellation cluster. |
| 29 | +It's derived from the master secret and a cryptographically random salt and unique for every Constellation cluster. |
| 30 | +The [Bootstrapper](microservices.md#bootstrapper) measures the *clusterID* into its own PCR before executing any code not measured as part of the *base measurements*. |
| 31 | +See [Node attestation](attestation.md#node-attestation) for details. |
| 32 | + |
| 33 | +The remote attestation statement of a Constellation cluster combines the *base measurements* and the *clusterID* for a verifiable, unspoofable, unique identity. |
| 34 | + |
| 35 | +## Network encryption |
| 36 | + |
| 37 | +Constellation encrypts all cluster network communication using the [container network interface (CNI)](https://github.com/containernetworking/cni). |
| 38 | +See [network encryption](networking.md) for more details. |
| 39 | + |
| 40 | +The Cilium agent running on each node establishes a secure [WireGuard](https://www.wireguard.com/) tunnel between it and all other known nodes in the cluster. |
| 41 | +Each node creates its own [Curve25519](http://cr.yp.to/ecdh.html) encryption key pair and distributes its public key via Kubernetes. |
| 42 | +A node uses another node's public key to decrypt and encrypt traffic from and to Cilium-managed endpoints running on that node. |
| 43 | +Connections are always encrypted peer-to-peer using [ChaCha20](http://cr.yp.to/chacha.html) with [Poly1305](http://cr.yp.to/mac.html). |
| 44 | +WireGuard implements [forward secrecy with key rotation every 2 minutes](https://lists.zx2c4.com/pipermail/wireguard/2017-December/002141.html). |
| 45 | + |
| 46 | +## Storage encryption |
| 47 | + |
| 48 | +Constellation supports transparent encryption of persistent storage. |
| 49 | +The Linux kernel's device mapper-based encryption features are used to encrypt the data on the block storage level. |
| 50 | +Currently, the following primitives are used for block storage encryption: |
| 51 | + |
| 52 | +* [dm-crypt](https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/dm-crypt.html) |
| 53 | +* [dm-integrity](https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/dm-integrity.html) |
| 54 | + |
| 55 | +Adding primitives for integrity protection in the CVM attacker model are under active development and will be available in a future version of Constellation. |
| 56 | +See [encrypted storage](encrypted-storage.md) for more details. |
| 57 | + |
| 58 | +As a cluster administrator, when creating a cluster, you can use the Constellation [installation program](orchestration.md) to select one of the following methods for key management: |
| 59 | + |
| 60 | +* Constellation-managed key management |
| 61 | +* User-managed key management |
| 62 | + |
| 63 | +### Constellation-managed key management |
| 64 | + |
| 65 | +#### Key material and key derivation |
| 66 | + |
| 67 | +During the creation of a Constellation cluster, the cluster's master secret is used to derive a KEK. |
| 68 | +This means creating two clusters with the same master secret will yield the same KEK. |
| 69 | +Any data encryption key (DEK) is derived from the KEK via HKDF. |
| 70 | +Note that the master secret is recommended to be unique for every cluster and shouldn't be reused (except in case of [recovering](../workflows/recovery.md) a cluster). |
| 71 | + |
| 72 | +#### State and storage |
| 73 | + |
| 74 | +The KEK is derived from the master secret during the initialization. |
| 75 | +Subsequently, all other key material is derived from the KEK. |
| 76 | +Given the same KEK, any DEK can be derived deterministically from a given identifier. |
| 77 | +Hence, there is no need to store DEKs. They can be derived on demand. |
| 78 | +After the KEK was derived, it's stored in memory only and never leaves the CVM context. |
| 79 | + |
| 80 | +#### Availability |
| 81 | + |
| 82 | +Constellation-managed key management has the same availability as the underlying Kubernetes cluster. |
| 83 | +Therefore, the KEK is stored in the [distributed Kubernetes etcd storage](https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/) to allow for unexpected but non-fatal (control-plane) node failure. |
| 84 | +The etcd storage is backed by the encrypted and integrity protected [state disk](images.md#state-disk) of the nodes. |
| 85 | + |
| 86 | +#### Recovery |
| 87 | + |
| 88 | +Constellation clusters can be recovered in the event of a disaster, even when all node machines have been stopped and need to be rebooted. |
| 89 | +For details on the process see the [recovery workflow](../workflows/recovery.md). |
| 90 | + |
| 91 | +### User-managed key management |
| 92 | + |
| 93 | +User-managed key management is under active development and will be available soon. |
| 94 | +In scenarios where constellation-managed key management isn't an option, this mode allows you to keep full control of your keys. |
| 95 | +For example, compliance requirements may force you to keep your KEKs in an on-prem key management system (KMS). |
| 96 | + |
| 97 | +During the creation of a Constellation cluster, you specify a KEK present in a remote KMS. |
| 98 | +This follows the common scheme of "bring your own key" (BYOK). |
| 99 | +Constellation will support several KMSs for managing the storage and access of your KEK. |
| 100 | +Initially, it will support the following KMSs: |
| 101 | + |
| 102 | +* [AWS KMS](https://aws.amazon.com/kms/) |
| 103 | +* [GCP KMS](https://cloud.google.com/security-key-management) |
| 104 | +* [Azure Key Vault](https://azure.microsoft.com/en-us/services/key-vault/#product-overview) |
| 105 | +* [KMIP-compatible KMS](https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=kmip) |
| 106 | + |
| 107 | +Storing the keys in Cloud KMS of AWS, Azure, or GCP binds the key usage to the particular cloud identity access management (IAM). |
| 108 | +In the future, Constellation will support remote attestation-based access policies for Cloud KMS once available. |
| 109 | +Note that using a Cloud KMS limits the isolation and protection to the guarantees of the particular offering. |
| 110 | + |
| 111 | +KMIP support allows you to use your KMIP-compatible on-prem KMS and keep full control over your keys. |
| 112 | +This follows the common scheme of "hold your own key" (HYOK). |
| 113 | + |
| 114 | +The KEK is used to encrypt per-data "data encryption keys" (DEKs). |
| 115 | +DEKs are generated to encrypt your data before storing it on persistent storage. |
| 116 | +After being encrypted by the KEK, the DEKs are stored on dedicated cloud storage for persistence. |
| 117 | +Currently, Constellation supports the following cloud storage options: |
| 118 | + |
| 119 | +* [AWS S3](https://aws.amazon.com/s3/) |
| 120 | +* [GCP Cloud Storage](https://cloud.google.com/storage) |
| 121 | +* [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/#overview) |
| 122 | + |
| 123 | +The DEKs are only present in plaintext form in the encrypted main memory of the CVMs. |
| 124 | +Similarly, the cryptographic operations for encrypting data before writing it to persistent storage are performed in the context of the CVMs. |
| 125 | + |
| 126 | +#### Recovery and migration |
| 127 | + |
| 128 | +In the case of a disaster, the KEK can be used to decrypt the DEKs locally and subsequently use them to decrypt and retrieve the data. |
| 129 | +In case of migration, configuring the same KEK will provide seamless migration of data. |
| 130 | +Thus, only the DEK storage needs to be transferred to the new cluster alongside the encrypted data for seamless migration. |
0 commit comments