Key Manager service for secrets and encryption keys
The Key Manager service (barbican) centrally manages certificates, keys, and passwords so that you can protect sensitive data used by OpenStack services.
The Key Manager Operator is installed and active by default. You can use the Key Manager API and command line to manage secrets. The RHOSO Key Manager service integrates with the Block Storage (cinder), Networking (neutron), and Compute (nova) services.
Secrets such as certificates, API keys, and passwords, are stored in the Key Manager service database or directly in a secure storage system. In RHOSO 18.0 the simple crypto plugin is available to encrypt secrets.
OpenStack Key Manager supports the following use cases:
-
Symmetric encryption keys
- Block Storage (cinder) volume encryption
- Object Storage (swift) encryption
- Ephemeral disk encryption
-
Asymmetric keys and certificates
- Image service (glance) image signing
- Image service (glance) image verification
View secrets in the Key Manager service Copy linkLink copied!
View secrets in the Key Manager service to review their properties, such as URI, name, type, and expiration, so that you can confirm they are configured correctly.
About this task Copy linkLink copied!
Procedure Copy linkLink copied!
$ openstack secret list
For example:
+------------------------------------------------------------------------------------+------+---------------------------+--------+-------------------------------------------+-----------+------------+-------------+------+------------+
| Secret href | Name | Created | Status | Content types | Algorithm | Bit length | Secret type | Mode | Expiration |
+------------------------------------------------------------------------------------+------+---------------------------+--------+-------------------------------------------+-----------+------------+-------------+------+------------+
| https://192.168.123.169:9311/v1/secrets/24845e6d-64a5-4071-ba99-0fdd1046172e | None | 2018-01-22T02:23:15+00:00 | ACTIVE | {u'default': u'application/octet-stream'} | aes | 256 | symmetric | None | None |
+------------------------------------------------------------------------------------+------+---------------------------+--------+-------------------------------------------+-----------+------------+-------------+------+------------+
Store a secret in the Key Manager service Copy linkLink copied!
Store a secret in the Key Manager service so that your OpenStack services can securely retrieve and use sensitive data such as certificates and keys.
About this task Copy linkLink copied!
You must specify the name of the secret. You can optionally specify its payload to attach the actual content to the secret metadata. If you omit the payload, you can add it later.
openstack secret update command.Procedure Copy linkLink copied!
$ openstack secret store --name testSecret --payload 'TestPayload'
For example:
+---------------+------------------------------------------------------------------------------------+
| Field | Value |
+---------------+------------------------------------------------------------------------------------+
| Secret href | https://192.168.123.163:9311/v1/secrets/ecc7b2a4-f0b0-47ba-b451-0f7d42bc1746 |
| Name | testSecret |
| Created | None |
| Status | None |
| Content types | None |
| Algorithm | aes |
| Bit length | 256 |
| Secret type | opaque |
| Mode | cbc |
| Expiration | None |
+---------------+------------------------------------------------------------------------------------+
Add a payload to a secret Copy linkLink copied!
Add a payload to an existing secret in the Key Manager service so that services can retrieve and use the stored sensitive data, such as a certificate or key.
About this task Copy linkLink copied!
If you create a secret without specifying a payload, then you can add a payload to it by using the openstack secret update command.
Procedure Copy linkLink copied!
$ openstack secret update https://192.168.123.163:9311/v1/secrets/ca34a264-fd09-44a1-8856-c6e7116c3b16 'TestPayload'
Remove a secret from the Key Manager service Copy linkLink copied!
Delete a secret from the Key Manager service (barbican) to permanently remove obsolete or compromised sensitive data and prevent unauthorized access.
Procedure Copy linkLink copied!
openstack secret list to obtain the URI of the secret.$ openstack secret delete https://192.168.123.163:9311/v1/secrets/ecc7b2a4-f0b0-47ba-b451-0f7d42bc1746
Generate a symmetric encryption key Copy linkLink copied!
Generate a symmetric encryption key in the Key Manager service (barbican) so that you can enable encryption for services such as Compute disk encryption and Object Storage encryption.
Procedure Copy linkLink copied!
Encrypt Block Storage volumes with the Key Manager service Copy linkLink copied!
Secure your storage resources with volume encryption with the Key Manager service (barbican). Volume contents remain unreadable to unauthorized users even if the physical storage is compromised.
About this task Copy linkLink copied!
You can use the Key Manager service to manage your Block Storage service (cinder) encryption keys. This configuration uses LUKS to encrypt the disks attached to your instances, including boot disks.
Block Storage volume key management is transparent to the user; when you create a new volume with luks as the encryption type, the Block Storage service generates a symmetric key secret for the volume and stores it in the Key Manager service. When booting the instance or attaching an encrypted volume, the Compute service (nova) retrieves the key from the Key Manager service and stores the secret locally as a libvirt secret on the Compute node.
luks encryption provider, the aes-xts-plain64 encryption cipher, and use a key size of 256.Procedure Copy linkLink copied!
Sign Image service images Copy linkLink copied!
Validate Image service (glance) images to ensure data integrity. Verify signatures against trusted keys to prevent the deployment of compromised images that have been modified by unauthorized users.
About this task Copy linkLink copied!
Sign Image service (glance) images before uploading them so that signature verification prevents the deployment of compromised or tampered images. Use the openssl command to sign an image with a key that is stored in the Key Manager service (barbican), and then upload the image with the accompanying signature properties. The signature is verified before each use, and the instance build process fails if the signature does not match.
- Limitations
-
- Signature verification is based on
openSSL _rsa_sig_verify(), which currently raises anInvalidSignatureexception in the Image service if the key length is not 1024. This issue occurs because of a regression in OpenSSL 3.0.7. Signature verification works correctly with key length 2048 and OpenSSL 3.0.2. - OpenSSL does not support the SHA256 algorithm. You must use SHA512 or greater to create a signed image.
- Signature verification is based on
Procedure Copy linkLink copied!
Validate snapshots Copy linkLink copied!
Validate snapshots to verify their integrity before use.
About this task Copy linkLink copied!
Snapshots are saved as Image service (glance) images. If you configure the Compute service to check for signed images, then snapshots must be signed, even if they were created from an instance with a signed image.
Procedure Copy linkLink copied!
Back up simple crypto encryption keys Copy linkLink copied!
Back up the Key Manager service (barbican) encryption keys so that you can restore access to encrypted volumes during disaster recovery.
Before you begin Copy linkLink copied!
- You have a security-hardened location for the
BarbicanSimpleCryptoKEKkey and Key Manager database.
About this task Copy linkLink copied!
To back up simple crypto encryption keys, you must back up the Key Manager database and the BarbicanSimpleCryptoKek key that encrypts and decrypts values from the database. Store the key and Key Manager database in a security-hardened location.
Procedure Copy linkLink copied!
Restore simple crypto encryption keys Copy linkLink copied!
Restore the Key Manager service (barbican) encryption keys from a backup so that you can regain access to encrypted volumes after a system failure.
About this task Copy linkLink copied!
Restore the Key Manager database and the BarbicanSimpleCryptoKek password from your backup to restore simple crypto encryption keys.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- You can use the openstackclient pod to verify that the test secrets were restored successfully:
$ oc exec -n openstack -t openstackclient -- openstack secret list +------------------------------------------------------------------------+------------+---------------------------+--------+-------------------------------------------+-----------+------------+-------------+------+------------+ | Secret href | Name | Created | Status | Content types | Algorithm | Bit length | Secret type | Mode | Expiration | +------------------------------------------------------------------------+------------+---------------------------+--------+-------------------------------------------+-----------+------------+-------------+------+------------+ | http://10.0.0.104:9311/v1/secrets/93f62cfd-e008-401f-be74-bf057c88b04a | testSecret | 2018-06-19T18:25:25+00:00 | ACTIVE | {u'default': u'text/plain'} | aes | 256 | opaque | cbc | None | | http://10.0.0.104:9311/v1/secrets/f664b5cf-5221-47e5-9887-608972a5fefb | swift_key | 2018-06-19T18:24:40+00:00 | ACTIVE | {u'default': u'application/octet-stream'} | aes | 256 | symmetric | ctr | None | +------------------------------------------------------------------------+------------+---------------------------+--------+-------------------------------------------+-----------+------------+-------------+------+------------+