Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] Filter DST X3 Root certificate part from the cluster's ingress chain #1130

Merged
merged 2 commits into from
Dec 6, 2023
Merged
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
26 changes: 25 additions & 1 deletion ibm/mas_devops/common_tasks/get_signed_ingress_cert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
cluster_ingress_secret_name: "{{ cluster_subdomain.resources[0].spec.domain | regex_search('[^.]*') }}"
cluster_ingress_tls_crt: "{{ cluster_ingress_secret.resources[0].data['tls.crt'] | b64decode }}"


# 3. Lookup for secret based on the cluster name
# -----------------------------------------------------------------------------
# ROSA, TechZone, and some IPI Installs use this convention
Expand Down Expand Up @@ -93,6 +92,31 @@
loop_control:
label: "{{ item.metadata.name }}"

# Break up the certificate into an array
- name: "Extract certificate chain into a variable"
set_fact:
cluster_ingress_tls_crt: "{{ cluster_ingress_tls_crt | regex_findall('(?s)(-----BEGIN .+?-----.+?-----END .+?-----)', multiline=True, ignorecase=True) }}"
no_log: true

# Filter DST Root CA X3 issuer certificate if present
- name: "Check if DST Root CA X3 issuer certificate is present"
vars:
dst_root_x3: "Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5" # if DST Root CA X3 issuer certificate is present, we'll filter from the MAS config
no_log: true
set_fact:
cluster_ingress_tls_crt_remove_it: "{{ cluster_ingress_tls_crt_remove_it|default([]) + [item] }}"
when:
- (dst_root_x3 in item)
with_items:
- "{{ cluster_ingress_tls_crt }}"

- name: "Filter DST Root CA X3 issuer certificate if present"
no_log: true
set_fact:
cluster_ingress_tls_crt: "{{ cluster_ingress_tls_crt | difference(cluster_ingress_tls_crt_remove_it) | list }}"
when:
- cluster_ingress_tls_crt is defined
- cluster_ingress_tls_crt | length > 0

# 4. Log which (if any) secret was found
# -----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
# is necessary :)
- name: "ocs/objectstorage : Set COS cert variable"
set_fact:
ocscos_tls_crt: "{{ cluster_ingress_tls_crt | regex_findall('(-----BEGIN .+?-----(?s).+?-----END .+?-----)', multiline=True, ignorecase=True) }}"
ocscos_tls_crt: "{{ cluster_ingress_tls_crt }}"

# Load uds_certs template to dynamically set as many uds certificates as identified
- set_fact:
Expand Down
1 change: 0 additions & 1 deletion ibm/mas_devops/roles/dro/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dro_version: "{{ lookup('env', 'DRO_VERSION') | default('', true) }}"
# -----------------------------------------------------------------------------
dro_storage_class: "{{ lookup('env', 'DRO_STORAGE_CLASS') }}"


# BASCfg generation for DRO
# -----------------------------------------------------------------------------
dro_contact:
Expand Down
2 changes: 1 addition & 1 deletion ibm/mas_devops/roles/dro/tasks/gencfg/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# Break up the certificate into an array
- name: "udscfg : Set UDS cert variable"
set_fact:
dro_tls_crt: "{{ cluster_ingress_tls_crt | regex_findall('(?s)(-----BEGIN .+?-----.+?-----END .+?-----)', multiline=True, ignorecase=True) }}"
dro_tls_crt: "{{ cluster_ingress_tls_crt }}"
no_log: true

# Load uds_certs template to dynamically set as many uds certificates as identified
Expand Down
2 changes: 1 addition & 1 deletion ibm/mas_devops/roles/uds/tasks/install/udscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# Break up the certificate into an array
- name: "udscfg : Set UDS cert variable"
set_fact:
uds_tls_crt: "{{ cluster_ingress_tls_crt | regex_findall('(?s)(-----BEGIN .+?-----.+?-----END .+?-----)', multiline=True, ignorecase=True) }}"
uds_tls_crt: "{{ cluster_ingress_tls_crt }}"

# 5. Debug
# -----------------------------------------------------------------------------
Expand Down
Loading