Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/config.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Minimal environment configuration for HSM adoption
# Copy this to config.env and modify as needed

# HSM Configuration
BARBICAN_HSM_ENABLED=false
3 changes: 3 additions & 0 deletions tests/hsm_vars/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# Common HSM variables
internalapi_prefix: "172.17.0"
3 changes: 3 additions & 0 deletions tests/hsm_vars/proteccio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# Minimal Proteccio HSM configuration
barbican_hsm_enabled: true
5 changes: 5 additions & 0 deletions tests/inventory.proteccio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
all:
hosts:
localhost:
ansible_connection: local
9 changes: 9 additions & 0 deletions tests/playbooks/barbican_hsm_adoption.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Barbican HSM Adoption
hosts: localhost
connection: local
gather_facts: false
vars_files:
- hsm_vars/proteccio.yml
roles:
- barbican_adoption
50 changes: 50 additions & 0 deletions tests/roles/barbican_adoption/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
# HSM support flag
barbican_hsm_enabled: false

barbican_patch: |
spec:
barbican:
Expand Down Expand Up @@ -38,3 +41,50 @@ barbican_patch: |
replicas: 1
barbicanKeystoneListener:
replicas: 1

barbican_hsm_patch: |
spec:
barbican:
enabled: true
apiOverride:
route: {}
template:
databaseInstance: openstack
databaseAccount: barbican
rabbitMqClusterName: rabbitmq
secret: osp-secret
simpleCryptoBackendSecret: osp-secret
serviceAccount: barbican
serviceUser: barbican
passwordSelectors:
database: BarbicanDatabasePassword
service: BarbicanPassword
simplecryptokek: BarbicanSimpleCryptoKEK
customServiceConfig: |
[p11_crypto_plugin]
plugin_name = PKCS11
library_path = {{ proteccio_library_path | default('/opt/tw_proteccio/lib/libnethsm.so') }}
token_labels = {{ proteccio_hsm_tokens | default(['VHSM1']) | join(',') }}
mkek_label = {{ proteccio_mkek_name | default('adoption_mkek_1') }}
hmac_label = {{ proteccio_hmac_name | default('adoption_hmac_1') }}
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
login = {{ proteccio_login_password | default('') }}
globalDefaultSecretStore: pkcs11
enabledSecretStores: ["simple_crypto", "pkcs11"]
pkcs11:
loginSecret: hsm-login
clientDataSecret: proteccio-data
clientDataPath: /etc/proteccio
barbicanAPI:
replicas: 1
barbicanWorker:
replicas: 1
barbicanKeystoneListener:
replicas: 1
10 changes: 9 additions & 1 deletion tests/roles/barbican_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
CONTROLLER1_SSH="{{ controller1_ssh }}"
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'])\"")"

- name: deploy podified Barbican
- name: deploy podified Barbican (standard)
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc patch openstackcontrolplane openstack --type=merge --patch '{{ barbican_patch }}'
when: not barbican_hsm_enabled|default(false)

- name: deploy podified Barbican (HSM)
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc patch openstackcontrolplane openstack --type=merge --patch '{{ barbican_hsm_patch }}'
when: barbican_hsm_enabled|default(false)

- name: wait for Barbican to start up
ansible.builtin.shell: |
Expand Down