此内容没有您所选择的语言版本。
Chapter 1. Using Fernet Tokens in the Overcloud
Fernet is now the default token provider, replacing uuid. This guide describes how to review your Fernet deployment, and how to rotate the Fernet keys.
1.1. Review the Fernet Deployment 复制链接链接已复制到粘贴板!
This procedure reviews your configuration to confirm that Fernet tokens are working correctly.
Retrieve the IP address of the controller node.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow SSH to the controller.
ssh heat-admin@192.0.2.16
[heat-admin@overcloud-controller-0 ~]$ ssh heat-admin@192.0.2.16Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the values of the token driver and provider settings.
sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf token driver sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf token provider
[heat-admin@overcloud-controller-0 ~]$ sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf token driver sql [heat-admin@overcloud-controller-0 ~]$ sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf token provider fernetCopy to Clipboard Copied! Toggle word wrap Toggle overflow Test the Fernet provider.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The result should include the long Fernet token.
1.2. Rotate the Fernet keys 复制链接链接已复制到粘贴板!
Red Hat recommends erring on the side of security when considering the length of rotation cycles, as the rotation process can be performed with relative ease. If you don’t have any guidance from your security posture, a monthly rotation cycle is a good starting point.
Fernet uses three types of keys, which are stored in /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys. The highest-numbered directory contains the primary key, which is used to generate new tokens and decrypt existing ones.
During the key rotation process, the primary key is relegated to secondary key status, and a new primary key is issued, thereby reducing the value of a compromised primary key. Secondary keys can only be used to decrypt tokens that were created with previous primary keys, and cannot issue new ones.
Confirm that all overcloud nodes are online before you perform the Fernet key rotation. Otherwise, the process will fail at the deploy_ssh_key task.
1.2.1. Rotate the Fernet Keys Using Mistral 复制链接链接已复制到粘贴板!
By default, director is configured to manage the overcloud’s Fernet keys; this setting is managed in the environment file using ManageKeystoneFernetKeys. As a result, the Fernet keys are stored in Mistral (under KeystoneFernetKeys). This approach means that you can rotate the Fernet keys with Mistral, and they will still persist after stack updates.
Review the existing Fernet keys.
Identify the Fernet key location.
SSH back to the controller
# SSH back to the controller [heat-admin@overcloud-controller-0 ~]$ sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf fernet_tokens key_repository /etc/keystone/fernet-keysCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
/etc/keystone/directory refers to the container file system path.Review the current Fernet key directories.
sudo ls /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys
[heat-admin@overcloud-controller-0 ~]$ sudo ls /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys 0 1 2Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
0- Contains the staged key, (which becomes the next primary key) and will always be numbered0. -
1- Contains the secondary key. 2- Contains the primary key. This number will increment each time the keys are rotated, with the highest number always serving as the primary key.Note- The maximum number of keys is determined by the max_active_keys property, by default 5 keys.
- The keys are propagated across all controllers.
-
Rotate the Fernet keys using the Mistral workflow.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the ID and ensure that the workflow was executed successfully.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the controller, review the number of Fernet keys, and compare with the previous result.
sudo ls /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys
[heat-admin@overcloud-controller-0 ~]$ sudo ls /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys 0 1 2 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
0- Contains the staged key, and will always be numbered0. This key will be promoted to a primary key during the next rotation. -
1 & 2- Contain the secondary keys. 3- Contains the primary key. This number will increment each time the keys are rotated, with the highest number always serving as the primary key.Note- The maximum number of keys is determined by the max_active_keys property, by default 5 keys.
- The keys are propagated across all controllers.
-