Chapter 7. Configuring a Proteccio HSM back end to work with the RHOSO Key Manager service
When you install Red Hat OpenStack Services on OpenShift (RHOSO), you have the option of using the Key Manager (barbican) service with either a default SimpleCrypto back end, or using it with a hardware security module (HSM). Using a hardware security module provides hardened protection for storing keys.
When you use a Trustway HSM, the Key Manager service communicates with the Trustway HSM by using a PKCS #11 interface to load libraries provided by Eviden.
7.1. Tested software versions for the Trustway hardware security module Copy linkLink copied to clipboard!
The following table details the versions of software tested by Red Hat.
| Software | Version |
|---|---|
| cryptoki | 2.20 |
| CRYPTO | 167 |
| Firmware | 147, 167 |
| FPGA | -1596587865 |
| library | 3.17 |
| MCS | 65539 |
7.2. Adding the Trustway HSM client to the Key Manager service Copy linkLink copied to clipboard!
Build a new image for the Key Manager service that integrates the required Proteccio software. You must repeat this step when you update RHOSO. Creating an Ansible Playbook to build this image simplifies the process of configuring RHOSO for your Trustway HSM. The ansible-role-rhoso-Trustway-hsm RPM, which is part of the RHOSO repository, contains roles that are required for this playbook. The following playbook automates required tasks for configuring the Trustway HSM back end to work with the RHOSO Key Manager service:
-
Downloads the
barbican-apiandbarbican-workerimages from the Red Hat source repository - Adds the Trustway client software, to the images
- Stores the resulting images in your destination repository
- Creates OpenShift secrets for the Key Manager service
The playbook uses keys, certificates, and configuration for your Trustway HSM to create two secrets. One is called login_secret, which contains your HSM password or PIN. The other secret is called proteccio_data_secret, and it contains your certificates, keys, and the proteccio.rc configuration file. These secrets are required in your Red Hat OpenShift Container Platform (RHOCP) environment to enable secure communication between the Key Manager service and your HSM. You can use an Ansible Playbook to identify the client certificates to be copied in.
Prerequisites
- The Trustway client image for Linux. For information about obtaining this software, contact Eviden.
- An available image service, such as an internally available Quay service, or an account with quay.io. For more information, see Deploying the Red Hat Quay Operator on OpenShift Container Platform.
- The client certificate and the key for your Trustway HSM.
- The Trustway HSM certificate file.
- You are running commands on a workstation on which you can run Ansible Playbooks.
Procedure
Use DNF to install
ansible-role-rhoso-proteccio-hsm:$ sudo dnf -y install ansible-role-rhoso-proteccio-hsmPlace the Trustway client image for Linux, and the client cert and the client key into the
/opt/protecciodirectory tree.$ cp <trustway_client_cert>.crt /opt/proteccio $ cp <Trustway_client_key>.key /opt/proteccio $ cp <Proteccio3.06.05.iso> /opt/protecciowhere:
<trustway_client_cert>- Specifies the file name of your client certificate.
<trustway_client_key>- Specifies the file name of your client key.
<Proteccio3.06.05.iso>- Specifies the name of your Trustway client for Linux ISO.
-
Retrieve the server certificate from the HSM device, and copy it to the
/opt/procecciodirectory. For more information on retrieving the server certificate from your Proteccio HSM, see the vendor documentation. - Optional: If you have more than one HSM for HA, get every certificate for each of the HSMs and put them altogether in the /opt/proteccio directory.
Update your
proteccio.rcfile to look similar to the following:[PROTECCIO] IPaddr=<Trustway_HSM_IP_address> SSL=1 SrvCert=<HSM_Certificate_Name>.CRT [CLIENT] Mode=0 LoggingLevel=7 LogFile=/var/log/barbican/proteccio.log StatusFile=/var/log/barbican/HSM_Status.log ClntKey=<Client_Certificate_Name>.key ClntCert=<Client_Certificate_Name>.crtwhere:
<Trustway_HSM_IP_Address>- Specifies the IP address of your Trustway HSM.
<HSM_Certificate_Name>- Specifies the name of your Trustway certificate.
Mode=0- Specifies that only a single HSM device is in place.
<Client_Certificate_Name>- Specifies your client certificate name.
Optional: If you are configuring HA, you must include additional entries for the IP addresses of each HSM. Each new HSM must be inside of a [PROTECCIO] section. Additionally, you much change the Mode parameter inside the [CLIENT] to a value of either
1or2. For more information, see the official Eviden documentation.[PROTECCIO] IPaddr=<Trustway_HSM-2_IP_address> SSL=1 SrvCert=<HSM-2_Certificate_Name>.CRT [CLIENT] Mode=2where:
<Trustway_HSM-2_IP_Address>- Specifies the IP address of your second Trustway HSM.
-
Create a new
[PROTECCIO]section with the corresponding parameters for every subsequent Trustway unit you have in your environment. Move the
proteccio.rcconfiguration file to/opt/proteccio:$ mv proteccio.rc /opt/proteccioCreate a playbook called
ansible-proteccio.yamlwith the following contents:vars: Trustway_client_name: <name> Trustway_server_cert_src: "/opt/trustway/<server.pem>" Trustway_partition_password: "<password>" Trustway_data_secret: "Trustway_data_secret" login_secret: "login_secret" barbican_dest_image_namespace: "<namespace>" proteccio_client_src: "file:///opt/proteccio/<iso_file>" proteccio_password: "{{ PIN to log into proteccio }}" kubeconfig_path: "<kubeconfig_path" oc_dir: "<directory>" roles: - rhoso_proteccio_hsmwhere:
<name>- Specifies the name of your Trustway certificate.
<server.pem>- Specifies the name of your server certificate.
<password>- Specifies your HSM partition password.
<namespace>- Specifies your account name for Quay.io or other container registry.
<iso_file>- Specifies the name of the Proteccio client ISO file.
<kubeconfig_path>- Specifies the full path to your OpenShift configuration file.
<directory>- Specifies the full path to the OpenShift Client location.
Run the playbook:
$ ansible-playbook ansible-proteccio.yaml
7.3. Modifying the OpenStackVersion CR for the Key Manager custom image Copy linkLink copied to clipboard!
Update the OpenStack version by using the OpenStackVersion custom resource (CR). The following procedure shows the CR that defines the custom container image.
Procedure
Create a CR file with the following contents:
apiVersion: core.openstack.org/v1beta1 kind: OpenStackVersion metadata: name: openstack-galera-network-isolation namespace: openstack spec: customContainerImages: barbicanAPIImage: <api_image> barbicanWorkerImage: <worker_image>where:
<api_image>-
Specifies the registry and path to the custom
barbicanAPIImage. <worker_image>-
Specifies the registry and path to the custom
barbicanWorkerImage.
Apply the
OpenStackVersionCR:$ oc apply -f <filename>where:
<filename>-
Specifies the
OpenStackVersionCR file name.
7.4. Configuring the Key Manager service for the Trustway HSM Copy linkLink copied to clipboard!
You must modify the Key Manager (barbican) service section of the OpenStackControl custom resource (CR) to fully integrate your Trustway HSM with Red Hat OpenStack Services on OpenShift (RHOSO).
Procedure
Configure the Key Manager service within your
OpenStackControlPlaneCR for use with the Trustway HSM:spec: barbican: apiOverride: route: {} enabled: true template: globalDefaultSecretStore: pkcs11 enabledSecretStores: - pkcs11 - simple_crypto apiTimeout: 90 barbicanAPI: apiTimeout: 0 customServiceConfig: | [secretstore:pkcs11] secret_store_plugin = store_crypto crypto_plugin = p11_crypto [p11_crypto_plugin] plugin_name = PKCS11 library_path = /opt/tw_proteccio/lib/libnethsm.so token_labels = <token_label> mkek_label = <mkek_label> hmac_label = <hmac_label> encryption_mechanism = CKM_AES_CBC hmac_key_type = CKK_GENERIC_SECRET hmac_keygen_mechanism = CKM_GENERIC_SECRET_KEY_GEN hmac_mechanism = CKM_SHA256_HMAC key_wrap_mechanism = CKM_AES_CBC_PAD key_wrap_generate_iv = true always_set_cka_sensitive = true os_locking_ok = false pkcs11: loginSecret: "login_secret" clientDataSecret: "proteccio-data" clientDataPath: /etc/protecciowhere:
<token_label>-
Specifies the token label of your HSM. If you are using HA, you must replace
<token_label>with the virtual token serial number. <mkek_label>- Specifies a user-defined label. If you have already defined this label, you must use the same one.
<hmac_label>- Specifies a user-defined label. If you have already set this up, you must use the same label.
NoteUse one of the following options to identify the HSM that you can use. These options are mutually exclusive and have the following order of precedence:
Expand Parameter
Value
Precedence
token_serial_number
<serial_number>
1 - Highest
token_labels
Comma-delimited lists
2 - Middle
slot-id
<slot_id>
3 - Lowest
Optional: If you have saved secrets that are using RHOSO Key Manager simple_crypto, keep those secrets available by enabling multiple back ends:
spec: barbican: apiOverride: route: {} enabled: true template: globalDefaultSecretStore: pkcs11 enabledSecretStores: - pkcs11 - simple_cryptoDeploy the
OpenStackControlPlaneCR:$ oc apply -f openstack_control_plane.yaml