Skip to content

Commit 365cbae

Browse files
author
Mauricio Harley
committed
Add minimal HSM support to barbican_adoption role
Extend the existing barbican_adoption role with minimal HSM support for Proteccio integration. Fixes: OSPRH-18981 Signed-off-by: Mauricio Harley <[email protected]>
1 parent b737b71 commit 365cbae

File tree

7 files changed

+84
-1
lines changed

7 files changed

+84
-1
lines changed

tests/config.env.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Minimal environment configuration for HSM adoption
2+
# Copy this to config.env and modify as needed
3+
4+
# HSM Configuration
5+
BARBICAN_HSM_ENABLED=false

tests/hsm_vars/common.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
# Common HSM variables
3+
internalapi_prefix: "172.17.0"

tests/hsm_vars/proteccio.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
# Minimal Proteccio HSM configuration
3+
barbican_hsm_enabled: true

tests/inventory.proteccio.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
all:
3+
hosts:
4+
localhost:
5+
ansible_connection: local
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- name: Barbican HSM Adoption
3+
hosts: localhost
4+
connection: local
5+
gather_facts: false
6+
vars_files:
7+
- hsm_vars/proteccio.yml
8+
roles:
9+
- barbican_adoption

tests/roles/barbican_adoption/defaults/main.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
# HSM support flag
3+
barbican_hsm_enabled: false
4+
25
barbican_patch: |
36
spec:
47
barbican:
@@ -38,3 +41,50 @@ barbican_patch: |
3841
replicas: 1
3942
barbicanKeystoneListener:
4043
replicas: 1
44+
45+
barbican_hsm_patch: |
46+
spec:
47+
barbican:
48+
enabled: true
49+
apiOverride:
50+
route: {}
51+
template:
52+
databaseInstance: openstack
53+
databaseAccount: barbican
54+
rabbitMqClusterName: rabbitmq
55+
secret: osp-secret
56+
simpleCryptoBackendSecret: osp-secret
57+
serviceAccount: barbican
58+
serviceUser: barbican
59+
passwordSelectors:
60+
database: BarbicanDatabasePassword
61+
service: BarbicanPassword
62+
simplecryptokek: BarbicanSimpleCryptoKEK
63+
customServiceConfig: |
64+
[p11_crypto_plugin]
65+
plugin_name = PKCS11
66+
library_path = {{ proteccio_library_path | default('/opt/tw_proteccio/lib/libnethsm.so') }}
67+
token_labels = {{ proteccio_hsm_tokens | default(['VHSM1']) | join(',') }}
68+
mkek_label = {{ proteccio_mkek_name | default('adoption_mkek_1') }}
69+
hmac_label = {{ proteccio_hmac_name | default('adoption_hmac_1') }}
70+
encryption_mechanism = CKM_AES_CBC
71+
hmac_key_type = CKK_GENERIC_SECRET
72+
hmac_keygen_mechanism = CKM_GENERIC_SECRET_KEY_GEN
73+
hmac_mechanism = CKM_SHA256_HMAC
74+
key_wrap_mechanism = CKM_AES_CBC_PAD
75+
key_wrap_generate_iv = true
76+
always_set_cka_sensitive = true
77+
os_locking_ok = false
78+
login = {{ proteccio_login_password | default('') }}
79+
globalDefaultSecretStore: pkcs11
80+
enabledSecretStores: ["simple_crypto", "pkcs11"]
81+
pkcs11:
82+
loginSecret: hsm-login
83+
clientDataSecret: proteccio-data
84+
clientDataPath: /etc/proteccio
85+
barbicanAPI:
86+
replicas: 1
87+
barbicanWorker:
88+
replicas: 1
89+
barbicanKeystoneListener:
90+
replicas: 1

tests/roles/barbican_adoption/tasks/main.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55
CONTROLLER1_SSH="{{ controller1_ssh }}"
66
oc set data secret/osp-secret "BarbicanSimpleCryptoKEK=$($CONTROLLER1_SSH "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'])\"")"
77
8-
- name: deploy podified Barbican
8+
- name: deploy podified Barbican (standard)
99
ansible.builtin.shell: |
1010
{{ shell_header }}
1111
{{ oc_header }}
1212
oc patch openstackcontrolplane openstack --type=merge --patch '{{ barbican_patch }}'
13+
when: not barbican_hsm_enabled|default(false)
14+
15+
- name: deploy podified Barbican (HSM)
16+
ansible.builtin.shell: |
17+
{{ shell_header }}
18+
{{ oc_header }}
19+
oc patch openstackcontrolplane openstack --type=merge --patch '{{ barbican_hsm_patch }}'
20+
when: barbican_hsm_enabled|default(false)
1321

1422
- name: wait for Barbican to start up
1523
ansible.builtin.shell: |

0 commit comments

Comments
 (0)