Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Managing secrets and keys with OpenStack Key Manager (barbican)
You use OpenStack Key Manager to create, update, and delete secrets and encryption keys. You can also back up and restore the encryption keys and the barbican database. It is recommended that you regularly back up your encryption keys and barbican database.
2.1. Viewing secrets Copiar o linkLink copiado para a área de transferência!
To view the list of secrets, run the openstack secret list
command. The list includes the URI, name, type, and other information about the secrets.
Procedure
View the list of secrets:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2. Creating a secret Copiar o linkLink copiado para a área de transferência!
To create a secret, run the openstack secret store
command and specify the name of the secret and optionally the payload for the secret.
Procedure
Create a secret. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Adding a payload to a secret Copiar o linkLink copiado para a área de transferência!
You cannot change the payload of a secret (other than deleting the secret), but if you created a secret without specifying a payload, you can later add a payload to it by using the openstack secret update
command.
Procedure
Add a payload to a secret:
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' $
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.4. Deleting a secret Copiar o linkLink copiado para a área de transferência!
To delete a secret, run the openstack secret delete
command and specify the secret URI.
Procedure
Delete a secret with the specified URI:
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 $
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5. Generating a symmetric key Copiar o linkLink copiado para a área de transferência!
To generate a symmetric key, use the order create
command and then store the key in barbican. You can then use symmetric keys for certain tasks, such as nova disk encryption and swift object encryption.
Prerequisites
- OpenStack Key Manager is installed and running
Procedure
Generate a new 256-bit key using
order create
and store it in barbican. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also use the
--mode
option to configure generated keys to use a particular mode, such asctr
orcbc
. 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 href
value:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the details of the secret:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6. Backing up simple crypto encryption keys Copiar o linkLink copiado para a área de transferência!
To backup simple crypto encryption keys, back up the barbican.conf
file that contains the main KEK to a security hardened location, and then back up the barbican database.
The procedure includes steps to generate a test secret and key. If you already generated a key for your secrets, skip the test key steps and use the key that you generated.
Prerequisites
- OpenStack Key Manager is installed and running
- You have a security hardened location for the KEK backup
Procedure
On the overcloud, generate a new 256-bit key and store it in barbican:
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 test secret is created:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Copy the
barbican.conf
file that contains the main KEK to a security hardened location. Log in to the
controller-0
node and retrieve barbican user password:sudo grep -r "barbican::db::mysql::password" /etc/puppet/hieradata
[tripleo-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 NoteOnly the user barbican has access to the barbican database. So the barbican user password is required to backup or restore the database.
Back up the barbican database:
mysqldump -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican > barbican_db_backup.sql
[tripleo-admin@controller-0 ~]$ mysqldump -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican > barbican_db_backup.sql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check that the database backup is stored in
/home/tripleo-admin
:ll
[tripleo-admin@controller-0 ~]$ ll total 36 -rw-rw-r--. 1 tripleo-admin tripleo-admin 36715 Jun 19 18:31 barbican_db_backup.sql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the overcloud, delete the secrets you created previously and verify that they no longer exist:
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
2.7. Restoring simple crypto encryption keys from a backup Copiar o linkLink copiado para a área de transferência!
To restore the barbican database from a backup, log in to the Controller node with barbican permissions and restore the barbican database. To restore the KEK from a backup, override the barbican.conf
file with the backup file.
Prerequisites
- OpenStack Key Manager is installed and running
-
You have an existing backup of the
barbican.conf
file and the barbican database
Procedure
Log in to the
controller-0
node and check that you have thebarbican
database on the controller that grants access to thebarbican
user to restore the database:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the backup file to the
barbican
database:sudo mysql -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican < barbican_db_backup.sql
[tripleo-admin@controller-0 ~]$ sudo mysql -u barbican -p"seDJRsMNRrBdFryCmNUEFPPev" barbican < barbican_db_backup.sql [tripleo-admin@controller-0 ~]$
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Override the
barbican.conf
file with the file that you previously backed up.
Verification
On the overcloud, verify that the test secrets were restored successfully:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow