Skip to content

Commit 629af8b

Browse files
committed
Feature: Key Management Service (KMS)
1 parent 17a549c commit 629af8b

File tree

7 files changed

+237
-2
lines changed

7 files changed

+237
-2
lines changed
71.9 KB
Loading
45.9 KB
Loading
61.4 KB
Loading
21.9 KB
Loading

source/adminguide/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Managing the Cloud
160160
:maxdepth: 4
161161

162162
management
163-
163+
kms
164164

165165
System Reliability and Availability
166166
-----------------------------------

source/adminguide/kms.rst

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
.. Licensed to the Apache Software Foundation (ASF) under one
2+
or more contributor license agreements. See the NOTICE file
3+
distributed with this work for additional information
4+
regarding copyright ownership. The ASF licenses this file
5+
to you under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing,
10+
software distributed under the License is distributed on an
11+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12+
KIND, either express or implied. See the License for the
13+
specific language governing permissions and limitations
14+
under the License.
15+
16+
.. _key-management-system:
17+
18+
Key Management System (KMS)
19+
============================
20+
21+
Introduced in Apache CloudStack 4.23, the Key Management System (KMS) lets you encrypt
22+
storage volumes using keys stored in a hardware security module (HSM).
23+
Previously, volume passphrases were encrypted with a single key stored in the
24+
database. If no KMS key is provided, CloudStack falls back to this legacy behavior.
25+
26+
.. _kms-architecture:
27+
28+
Architecture and Design
29+
-----------------------
30+
31+
KMS is built around a two-tier key hierarchy to protect data at rest:
32+
33+
- **KEK (Key Encryption Key)** — The master key that never leaves the secure backend. KEKs
34+
are stored in and managed by the configured KMS provider.
35+
- **DEK (Data Encryption Key)** — The key that encrypts the actual data (e.g., Volumes).
36+
DEKs are stored wrapped by the KEK and are only decrypted in memory when needed.
37+
38+
.. image:: /_static/images/kms-architecture.png
39+
:align: center
40+
:alt: KMS architecture diagram showing providers, KEK, DEK, and Volume Data layers
41+
42+
43+
Pluggable Provider Framework
44+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45+
46+
The KMS architecture is designed to be extensible. CloudStack currently ships two providers:
47+
48+
- **Database Provider** — A built-in fallback provider that stores
49+
wrapped keys in the CloudStack database. Suitable for environments without dedicated HSM
50+
hardware.
51+
- **PKCS#11 HSM Provider** — Integrates with dedicated Hardware
52+
Security Module devices via the PKCS#11 standard allowing integration with
53+
various HSM providers.
54+
55+
HSM Profiles
56+
^^^^^^^^^^^^
57+
Each KMS Key is stored in a Hardware Security Module. The root admin registers
58+
**HSM Profiles** that capture the connection configuration for a specific HSM device
59+
(e.g., PKCS#11 library path, slot, PIN). Sensitive fields such as
60+
PINs and passwords are automatically encrypted at rest and masked in responses.
61+
62+
.. note::
63+
HSM Profiles can be created only by root administrators and can be scoped to a zone,
64+
account, or can be made global (available to all zones).
65+
66+
.. _kms-hsm-profiles:
67+
68+
Managing HSM Profiles
69+
---------------------
70+
71+
Before creating a KMS key, an administrator must register an HSM
72+
Profile.
73+
74+
Adding an HSM Profile
75+
^^^^^^^^^^^^^^^^^^^^^
76+
77+
#. Log in to the CloudStack UI as a root administrator.
78+
79+
#. In the left navigation bar, click **HSM Profile** under **Key Management**.
80+
81+
#. Click on **Add HSM Profile +**.
82+
83+
#. Provide the following details:
84+
85+
- **Name** — A unique name for the profile.
86+
- **Zone** — The zone this profile is scoped to. Leave blank to make it available to all zones.
87+
- **Vendor Name** — The HSM device vendor.
88+
- **System** — Check this to make the profile globally available. Uncheck to scope it to an account or zone.
89+
- **Details** — Protocol-specific key-value pairs such as ``library``, ``slot``, and
90+
``pin`` for PKCS#11.
91+
92+
.. image:: /_static/images/kms-add-hsm-profile.png
93+
:align: center
94+
:alt: Add HSM Profile dialog
95+
96+
#. Click **OK**.
97+
98+
99+
.. note::
100+
If access to the HSM is lost, CloudStack will be unable to access
101+
volumes encrypted with the keys managed by this HSM profile and the
102+
volumes will be inaccessible.
103+
104+
.. note::
105+
Sensitive fields (PINs, passwords) are automatically masked in the UI and API responses
106+
after the profile is created.
107+
108+
.. note::
109+
The operator has to ensure that the required HSM libraries are installed on
110+
all the management servers and depending on the HSM provider, there might be
111+
some additional configuration required on each of the management servers.
112+
113+
.. _kms-key-lifecycle:
114+
115+
Managing KMS Keys
116+
-----------------
117+
118+
KMS Keys (Key Encryption Keys / KEKs) are **zone-scoped**: a key created in one zone
119+
cannot be used in another. Keys can be created by users and administrators.
120+
121+
Creating a KMS Key
122+
^^^^^^^^^^^^^^^^^^
123+
124+
#. Log in to the CloudStack UI.
125+
126+
#. In the left navigation bar, click **KMS Keys** under **Key Management**.
127+
128+
#. Click **Create KMS Key +**.
129+
130+
#. Provide the following details:
131+
132+
- **Name** — A name for the key.
133+
- **Description** — An optional description.
134+
- **Zone** — The zone in which the key will be valid.
135+
- **HSM Profile** — The HSM profile to use as the backend for this key.
136+
- **Key Size** — Bits for the KEK: ``128``, ``192``, or ``256`` (default).
137+
138+
.. image:: /_static/images/kms-create-key.png
139+
:align: center
140+
:alt: Create KMS Key dialog
141+
142+
#. Click **OK**. The key is created in the specified HSM and becomes available for
143+
encrypting volumes in the selected zone.
144+
145+
.. _kms-key-rotation:
146+
147+
Rotating a KMS Key
148+
^^^^^^^^^^^^^^^^^^
149+
150+
Key rotation generates a new version of the KEK and automatically schedules background
151+
re-encryption of all DEKs protected by the old version. This is an asynchronous operation.
152+
153+
154+
#. In the left navigation bar, click **KMS Keys** under **Key Management**.
155+
156+
#. Open the Details page for the key you want to rotate.
157+
158+
#. Click the **Rotate KMS Key** button.
159+
160+
.. image:: /_static/images/kms-rotate-key.png
161+
:align: center
162+
:alt: Rotate Key option in KMS Keys list
163+
164+
#. Confirm the rotation. A background job is created that progressively rewraps all DEKs
165+
to the new KEK version without ever exposing the plaintext DEKs.
166+
167+
.. note::
168+
The rewrapping job runs in batches. The ``kms.rewrap.batch.size`` and
169+
``kms.rewrap.interval.ms`` settings control how quickly DEKs are re-encrypted
170+
after rotation (see :ref:`kms-configuration`).
171+
172+
.. _kms-volume-migration:
173+
174+
Migrating Existing Volumes to KMS
175+
----------------------------------
176+
177+
Existing volumes that use older passphrase-based encryption can be migrated to KMS-managed
178+
envelope encryption without data loss. This is an administrator-only operation and is
179+
performed using the ``migrateVolumesToKMS`` API. The migration runs as an asynchronous
180+
background job.
181+
182+
.. note::
183+
Migrated volumes will be re-encrypted under the KMS envelope encryption model, removing
184+
the dependency on a static passphrase. Scope the migration by zone, account, or domain,
185+
or provide specific volume IDs for selective migration.
186+
187+
For full API parameter details, see the
188+
`CloudStack API Reference <https://cloudstack.apache.org/api/>`_.
189+
190+
.. _kms-configuration:
191+
192+
KMS Configuration Settings
193+
--------------------------
194+
195+
The following global configuration settings are available to tune KMS behaviour. They can
196+
be found under **Global Settings** in the CloudStack UI.
197+
198+
.. cssclass:: table-striped table-bordered table-hover
199+
200+
=============================== ============= =================================================
201+
Configuration Default Description
202+
=============================== ============= =================================================
203+
``kms.dek.size.bits`` ``256`` Size of generated DEKs in bits. Valid values
204+
are ``128``, ``192``, and ``256``.
205+
``kms.retry.count`` ``3`` Number of retry attempts on transient KMS
206+
operation failures.
207+
``kms.retry.delay.ms`` ``1000`` Base delay in milliseconds for exponential
208+
back-off between retry attempts.
209+
``kms.operation.timeout.sec`` ``30`` Timeout in seconds for a single KMS
210+
cryptographic operation.
211+
``kms.rewrap.batch.size`` ``50`` Number of DEKs to rewrap per background job
212+
iteration during KEK rotation.
213+
``kms.rewrap.interval.ms`` ``300000`` Interval in milliseconds between background
214+
DEK rewrapping runs (default: 5 minutes).
215+
=============================== ============= =================================================

source/adminguide/storage.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ can be attached to Instances, detached, re-attached, and deleted
602602
just as with the other types of data volume.
603603

604604
Local storage is ideal for scenarios where persistence of data volumes
605-
and HA is not required. Some of the benefits include reduced disk I/O
605+
and HA is not required. Some of the benefits include reduced disk I/O
606606
latency and cost reduction from using inexpensive local disks.
607607

608608
In order for local volumes to be used, the feature must be enabled for
@@ -618,9 +618,25 @@ If you want to put a host into maintenance mode, you must first stop any
618618
Instances with local data volumes on that host.
619619

620620

621+
Volume Encryption
622+
^^^^^^^^^^^^^^^^^
623+
624+
CloudStack supports LUKS-based volume encryption on KVM. Encrypted volumes are managed
625+
through the :ref:`key-management-system`, where you can create and manage the encryption
626+
keys used to protect your data.
627+
628+
To create an encrypted volume, select a **KMS Key** from the UI when creating the volume,
629+
or supply the key ID via the API. The key must belong to the same zone as the volume.
630+
631+
.. warning::
632+
Deleting the KMS key used to encrypt a volume will render that volume permanently
633+
unrecoverable.
634+
635+
621636
To Create a New Volume
622637
^^^^^^^^^^^^^^^^^^^^^^
623638

639+
624640
#. Log in to the CloudStack UI as a User or admin.
625641

626642
#. In the left navigation bar, click Storage.
@@ -637,6 +653,10 @@ To Create a New Volume
637653

638654
- Disk Offering. Choose the characteristics of the storage.
639655

656+
- KMS Key. (Optional) Select a KMS key to enable envelope-based
657+
encryption for the volume. Requires KMS to be configured in the zone.
658+
See :ref:`key-management-system`.
659+
640660
The new volume appears in the list of volumes with the state
641661
“Allocated.” The volume data is stored in CloudStack, but the volume
642662
is not yet ready for use

0 commit comments

Comments
 (0)