此内容没有您所选择的语言版本。
Chapter 4. Managing secrets in barbican
4.1. Listing secrets 复制链接链接已复制到粘贴板!
Secrets are identified by their URI, indicated as a href value. This example shows the secret you created in the previous step:
4.2. Adding new secrets 复制链接链接已复制到粘贴板!
Create a test secret. For example:
4.3. Updating secrets 复制链接链接已复制到粘贴板!
You cannot change the payload of a secret (other than deleting the secret), but if you initially created a secret without specifying a payload, you can later add a payload to it by using the update function. For example:
openstack secret update https://192.168.123.163:9311/v1/secrets/ca34a264-fd09-44a1-8856-c6e7116c3b16 'TestPayload-updated'
$ openstack secret update https://192.168.123.163:9311/v1/secrets/ca34a264-fd09-44a1-8856-c6e7116c3b16 'TestPayload-updated'
$
4.4. Deleting secrets 复制链接链接已复制到粘贴板!
You can delete a secret by specifying its URI. For example:
openstack secret delete https://192.168.123.163:9311/v1/secrets/ecc7b2a4-f0b0-47ba-b451-0f7d42bc1746
$ openstack secret delete https://192.168.123.163:9311/v1/secrets/ecc7b2a4-f0b0-47ba-b451-0f7d42bc1746
$
4.5. Generate a symmetric key 复制链接链接已复制到粘贴板!
Symmetric keys are suitable for certain tasks, such as nova disk encryption and swift object encryption.
Generate a new 256-bit key using
order createand store it in barbican. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
--mode- Generated keys can be configured to use a particular mode, such asctrorcbc. For more information, see NIST SP 800-38A.
-
View the details of the order to identify the location of the generated key, shown here as the
Secret hrefvalue:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the details of the secret:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.6. Backup and Restore Keys 复制链接链接已复制到粘贴板!
The process for backup and restore of encryption keys will vary depending on the type of back end:
4.6.1. Backup and restore the simple crypto back end 复制链接链接已复制到粘贴板!
Two separate components need to be backed up for simple crypto back end: the KEK and the database. It is recommended that you regularly test your backup and restore process.
4.6.1.1. Backup and restore the KEK 复制链接链接已复制到粘贴板!
For the simple crypto back end, you need to backup the barbican.conf file that contains the master KEK is written. This file must be backed up to a security hardened location. The actual data is stored in the Barbican database in an encrypted state, described in the next section.
-
To restore the key from a backup, you need to copy the restored
barbican.confover the existingbarbican.conf.
4.6.1.2. Backup and restore the back end database 复制链接链接已复制到粘贴板!
This procedure describes how to backup and restore a barbican database for the simple crypto back end. To demonstrate this, you will generate a key and upload the secrets to barbican. You will then backup the barbican database, and delete the secrets you created. You will then restore the database and confirm that the secrets you created earlier have been recovered.
Be sure you are also backing up the KEK, as this is also an important requirement. This is described in the previous section.
4.6.1.2.1. Create the test secret 复制链接链接已复制到粘贴板!
On the overcloud, generate a new 256-bit key using
order createand store it in barbican. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a test secret:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm that the secrets were created:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.6.1.2.2. Backup the barbican database 复制链接链接已复制到粘贴板!
Run these steps while logged in to the controller-0 node.
Only the user barbican has access to the barbican database. So the barbican user password is required to backup or restore the database.
Retrieve barbican user password. For example:
sudo grep -r "barbican::db::mysql::password" /etc/puppet/hieradata
[heat-admin@controller-0 ~]$ sudo grep -r "barbican::db::mysql::password" /etc/puppet/hieradata /etc/puppet/hieradata/service_configs.json: "barbican::db::mysql::password": "seDJRsMNRrBdFryCmNUEFPPev",Copy to Clipboard Copied! Toggle word wrap Toggle overflow Backup the barbican database:
mysqldump -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican > barbican_db_backup.sql
[heat-admin@controller-0 ~]$ mysqldump -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican > barbican_db_backup.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Database backup is stored in /home/heat-admin
ll
[heat-admin@controller-0 ~]$ ll total 36 -rw-rw-r--. 1 heat-admin heat-admin 36715 Jun 19 18:31 barbican_db_backup.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
4.6.1.2.3. Delete the test secrets 复制链接链接已复制到粘贴板!
On the overcloud, delete the secrets you created previously, and verify they no longer exist. For example:
openstack secret delete http://10.0.0.104:9311/v1/secrets/93f62cfd-e008-401f-be74-bf057c88b04a openstack secret delete http://10.0.0.104:9311/v1/secrets/f664b5cf-5221-47e5-9887-608972a5fefb openstack secret list
(overcloud) [stack@undercloud-0 ~]$ openstack secret delete http://10.0.0.104:9311/v1/secrets/93f62cfd-e008-401f-be74-bf057c88b04a (overcloud) [stack@undercloud-0 ~]$ openstack secret delete http://10.0.0.104:9311/v1/secrets/f664b5cf-5221-47e5-9887-608972a5fefb (overcloud) [stack@undercloud-0 ~]$ openstack secret list (overcloud) [stack@undercloud-0 ~]$Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.6.1.2.4. Restore the databases 复制链接链接已复制到粘贴板!
Run these steps while logged in to the controller-0 node.
Make sure you have the barbican database on the controller which grants access to the
barbicanuser for database restoration:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9) Restore the backup file to the barbican database:
+
sudo mysql -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican < barbican_db_backup.sql
[heat-admin@controller-0 ~]$ sudo mysql -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican < barbican_db_backup.sql
[heat-admin@controller-0 ~]$
4.6.1.2.5. Verify the restore process 复制链接链接已复制到粘贴板!
On the overcloud, verify that the test secrets were restored successfully:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow