|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | +[id="adopting-key-manager-service-with-hsm-integration_{context}"] |
| 3 | + |
| 4 | += Adopting the {key_manager} with HSM integration |
| 5 | + |
| 6 | +[role="_abstract"] |
| 7 | +When your source {OpenStackPreviousInstaller} environment includes hardware security module (HSM) integration, you must use the HSM-enabled adoption approach to preserve HSM functionality and maintain access to HSM-backed secrets. |
| 8 | + |
| 9 | +.Prerequisites |
| 10 | + |
| 11 | +* The source {OpenStackPreviousInstaller} environment with HSM integration is configured. |
| 12 | +* HSM client software and certificates are available from accessible URLs. |
| 13 | +* The target {rhos_long} environment with HSM infrastructure is accessible. |
| 14 | +* HSM-enabled {key_manager_first_ref} container images are built and available in your registry. |
| 15 | + |
| 16 | +[NOTE] |
| 17 | +==== |
| 18 | +If you use the automated adoption process by setting `barbican_hsm_enabled: true`, the required HSM secrets (`hsm-login` and `proteccio-data`) are created automatically. You only need to manually create the secret when you perform the manual adoption steps. |
| 19 | +==== |
| 20 | + |
| 21 | +.Procedure |
| 22 | + |
| 23 | +. Confirm that your source environment configuration includes HSM integration: |
| 24 | ++ |
| 25 | +[source,bash] |
| 26 | +---- |
| 27 | +$ ssh tripleo-admin@controller-0.ctlplane \ |
| 28 | + "sudo cat /var/lib/config-data/puppet-generated/barbican/etc/barbican/barbican.conf | grep -A5 '\[.*plugin\]'" |
| 29 | +---- |
| 30 | ++ |
| 31 | +If you see `[p11_crypto_plugin]` or other HSM-specific sections, continue with the HSM adoption. |
| 32 | + |
| 33 | +. Extract the simple crypto key encryption keys (KEK) from your source environment: |
| 34 | ++ |
| 35 | +[source,bash] |
| 36 | +---- |
| 37 | +$ SIMPLE_CRYPTO_KEK=$(ssh tripleo-admin@controller-0.ctlplane \ |
| 38 | + "sudo python3 -c \"import configparser; c = configparser.ConfigParser(); c.read('/var/lib/config-data/puppet-generated/barbican/etc/barbican/barbican.conf'); print(c['simple_crypto_plugin']['kek'])\"") |
| 39 | +---- |
| 40 | + |
| 41 | +. Add the KEK to the target environment: |
| 42 | ++ |
| 43 | +[source,bash] |
| 44 | +---- |
| 45 | +$ oc set data secret/osp-secret "BarbicanSimpleCryptoKEK=${SIMPLE_CRYPTO_KEK}" |
| 46 | +---- |
| 47 | + |
| 48 | +. If you are not using the automated adoption, create HSM-specific secrets in the target environment: |
| 49 | ++ |
| 50 | +[source,bash] |
| 51 | +---- |
| 52 | +# Create HSM login credentials secret |
| 53 | +$ oc create secret generic hsm-login \ |
| 54 | + --from-literal=PKCS11Pin=<your_hsm_password> \ |
| 55 | + -n openstack |
| 56 | +
|
| 57 | +# Create HSM client configuration and certificates secret |
| 58 | +$ oc create secret generic proteccio-data \ |
| 59 | + --from-file=client.crt=<path_to_client_cert> \ |
| 60 | + --from-file=client.key=<path_to_client_key> \ |
| 61 | + --from-file=10_8_60_93.CRT=<path_to_server_cert> \ |
| 62 | + --from-file=proteccio.rc=<path_to_hsm_config> \ |
| 63 | + -n openstack |
| 64 | +---- |
| 65 | ++ |
| 66 | +where: |
| 67 | + |
| 68 | + |
| 69 | +<your_hsm_password>:: |
| 70 | +Specifies the HSM password for your {rhos_acro} environment. |
| 71 | +<path_to_client_cert>:: |
| 72 | +Specifies the path to the HSM client certificate. |
| 73 | +<path_to_client_key>:: |
| 74 | +Specifies the path to the client key. |
| 75 | +<path_to_server_cert>:: |
| 76 | +Specifies the path to the server certificate. |
| 77 | +<path_to_hsm_config>:: |
| 78 | +Specifies the path to your HSM configuration in your {rhos_acro} environment. |
| 79 | ++ |
| 80 | +[NOTE] |
| 81 | +==== |
| 82 | +When you use the automated adoption by setting `barbican_hsm_enabled: true`, the `barbican_adoption` role creates these secrets automatically. The secret names default to `hsm-login` and `proteccio-data`. |
| 83 | +==== |
| 84 | + |
| 85 | +. Patch the `OpenStackControlPlane` custom resource to deploy {key_manager} with HSM support: |
| 86 | ++ |
| 87 | +---- |
| 88 | +$ oc patch openstackcontrolplane openstack --type=merge --patch ' |
| 89 | +spec: |
| 90 | + barbican: |
| 91 | + enabled: true |
| 92 | + apiOverride: |
| 93 | + route: {} |
| 94 | + template: |
| 95 | + databaseInstance: openstack |
| 96 | + databaseAccount: barbican |
| 97 | + rabbitMqClusterName: rabbitmq |
| 98 | + secret: osp-secret |
| 99 | + simpleCryptoBackendSecret: osp-secret |
| 100 | + serviceAccount: barbican |
| 101 | + serviceUser: barbican |
| 102 | + passwordSelectors: |
| 103 | + database: BarbicanDatabasePassword |
| 104 | + service: BarbicanPassword |
| 105 | + simplecryptokek: BarbicanSimpleCryptoKEK |
| 106 | + customServiceConfig: | |
| 107 | + [p11_crypto_plugin] |
| 108 | + plugin_name = PKCS11 |
| 109 | + library_path = /usr/lib64/libnethsm.so |
| 110 | + token_labels = VHSM1 |
| 111 | + mkek_label = adoption_mkek_1 |
| 112 | + hmac_label = adoption_hmac_1 |
| 113 | + encryption_mechanism = CKM_AES_CBC |
| 114 | + hmac_key_type = CKK_GENERIC_SECRET |
| 115 | + hmac_keygen_mechanism = CKM_GENERIC_SECRET_KEY_GEN |
| 116 | + hmac_mechanism = CKM_SHA256_HMAC |
| 117 | + key_wrap_mechanism = CKM_AES_CBC_PAD |
| 118 | + key_wrap_generate_iv = true |
| 119 | + always_set_cka_sensitive = true |
| 120 | + os_locking_ok = false |
| 121 | + globalDefaultSecretStore: pkcs11 |
| 122 | + enabledSecretStores: ["simple_crypto", "pkcs11"] |
| 123 | + pkcs11: |
| 124 | + loginSecret: hsm-login |
| 125 | + clientDataSecret: proteccio-data |
| 126 | + clientDataPath: /etc/proteccio |
| 127 | + barbicanAPI: |
| 128 | + replicas: 1 |
| 129 | + override: |
| 130 | + service: |
| 131 | + internal: |
| 132 | + metadata: |
| 133 | + annotations: |
| 134 | + metallb.universe.tf/address-pool: internalapi |
| 135 | + metallb.universe.tf/allow-shared-ip: internalapi |
| 136 | + metallb.universe.tf/loadBalancerIPs: 172.17.0.80 |
| 137 | + spec: |
| 138 | + type: LoadBalancer |
| 139 | + barbicanWorker: |
| 140 | + replicas: 1 |
| 141 | + barbicanKeystoneListener: |
| 142 | + replicas: 1 |
| 143 | +' |
| 144 | +---- |
| 145 | ++ |
| 146 | +* `library_path` specifies the path to the PKCS#11 library, for example, `/usr/lib64/libnethsm.so` for Proteccio). |
| 147 | +* `token_labels` specifies the HSM partition name, for example, `VHSM1`. |
| 148 | +* `mkek_label` and `hmac_label` specify key labels that are configured in the HSM. |
| 149 | +* `loginSecret` specifies the name of the Kubernetes secret that contains the HSM PIN. |
| 150 | +* `clientDataSecret` specifies the name of the Kubernetes secret that contains the HSM certificates and configuration. |
| 151 | + |
| 152 | +.Verification |
| 153 | + |
| 154 | +. Verify that both secret stores are available: |
| 155 | ++ |
| 156 | +[source,bash] |
| 157 | +---- |
| 158 | +$ openstack secret store list |
| 159 | +---- |
| 160 | + |
| 161 | +. Test the HSM back-end functionality: |
| 162 | ++ |
| 163 | +[source,bash] |
| 164 | +---- |
| 165 | +$ openstack secret store --name "hsm-test-$(date +%s)" \ |
| 166 | + --payload "test-payload" \ |
| 167 | + --algorithm aes --mode cbc --bit-length 256 |
| 168 | +---- |
| 169 | + |
| 170 | +. Verify that the migrated secrets are accessible: |
| 171 | ++ |
| 172 | +[source,bash] |
| 173 | +---- |
| 174 | +$ openstack secret list |
| 175 | +---- |
| 176 | + |
| 177 | +. Check that the {key_manager} services are operational: |
| 178 | ++ |
| 179 | +[source,bash] |
| 180 | +---- |
| 181 | +$ oc get pods -l service=barbican |
| 182 | +NAME READY STATUS RESTARTS AGE |
| 183 | +barbican-api-5d65949b4-xhkd7 2/2 Running 7 (10m ago) 29d |
| 184 | +barbican-keystone-listener-687cbdc77d-4kjnk 2/2 Running 3 (11m ago) 29d |
| 185 | +barbican-worker-5c4b947d5c-l9jdh 2/2 Running 3 (11m ago) 29d |
| 186 | +---- |
| 187 | + |
| 188 | +[NOTE] |
| 189 | +==== |
| 190 | +HSM adoption preserves both simple crypto and HSM-backed secrets. The migration process maintains HSM metadata and secret references, ensuring continued access to existing secrets while enabling new secrets to use either back-end. |
| 191 | +==== |
0 commit comments