Skip to content

Commit

Permalink
Make all certs 8yr expiry (#387) (#389)
Browse files Browse the repository at this point in the history
* Make all certs 8yr expiry
* Use certificate_duration and test against generated cert
* Better messages during CI cloning

(cherry picked from commit 4b5d7a1)
  • Loading branch information
csibbitt authored Nov 14, 2022
1 parent 9c5b82a commit 907dbc4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build/stf-run-ci/tasks/clone_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# of these separately rather than using a loop.
- name: Get Smart Gateway Operator
block:
- name: Try cloning same-named branch or override branch from specified repository
- name: Try cloning same-named branch or override branch from SGO repository
git:
repo: "{{ sgo_repository }}"
dest: working/smart-gateway-operator
Expand All @@ -19,7 +19,7 @@

- name: Get sg-core
block:
- name: Try cloning same-named branch or override branch from specified repository
- name: Try cloning same-named branch or override branch from sg-core repository
git:
repo: "{{ sg_core_repository }}"
dest: working/sg-core
Expand All @@ -33,7 +33,7 @@

- name: Get sg-bridge
block:
- name: Try cloning same-named branch or override branch from specified repository
- name: Try cloning same-named branch or override branch from sg-bridge repository
git:
repo: "{{ sg_bridge_repository }}"
dest: working/sg-bridge
Expand All @@ -47,7 +47,7 @@

- name: Get prometheus-webhook-snmp
block:
- name: Try cloning same-named branch or override branch from specified repository
- name: Try cloning same-named branch or override branch from prometheus-webhook-snmp repository
git:
repo: "{{ prometheus_webhook_snmp_repository }}"
dest: working/prometheus-webhook-snmp
Expand All @@ -64,7 +64,7 @@
# branches there.
- name: Get Loki Operator
block:
- name: Try cloning same-named branch or override branch from specified repository
- name: Try cloning same-named branch or override branch from loki repository
git:
repo: "{{ loki_operator_repository }}"
dest: working/loki
Expand Down
2 changes: 2 additions & 0 deletions roles/servicetelemetry/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ clouds_remove_on_missing: false
# default observability strategy (compatible with STF 1.3)
observability_strategy: use_community

certificate_duration: 70080h

servicetelemetry_defaults:
high_availability:
enabled: false
Expand Down
4 changes: 4 additions & 0 deletions roles/servicetelemetry/tasks/_local_signing_authority.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
name: '{{ ansible_operator_meta.namespace }}-selfsigned'
namespace: '{{ ansible_operator_meta.namespace }}'
spec:
duration: '{{ certificate_duration }}'
selfSigned: {}

- name: Create CA certificate
Expand All @@ -19,6 +20,7 @@
name: '{{ ansible_operator_meta.namespace }}-ca'
namespace: '{{ ansible_operator_meta.namespace }}'
spec:
duration: '{{ certificate_duration }}'
secretName: '{{ ansible_operator_meta.namespace }}-ca'
commonName: '{{ ansible_operator_meta.namespace }}-ca'
isCA: true
Expand All @@ -34,6 +36,7 @@
name: '{{ ansible_operator_meta.namespace }}-ca'
namespace: '{{ ansible_operator_meta.namespace }}'
spec:
duration: '{{ certificate_duration }}'
ca:
secretName: '{{ ansible_operator_meta.namespace }}-ca'

Expand All @@ -47,6 +50,7 @@
name: elasticsearch-es-http
namespace: '{{ ansible_operator_meta.namespace }}'
spec:
duration: '{{ certificate_duration }}'
commonName: elasticsearch-es-http
secretName: 'elasticsearch-es-cert'
dnsNames:
Expand Down
8 changes: 8 additions & 0 deletions roles/servicetelemetry/tasks/component_qdr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-selfsigned"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
selfSigned: {}

- name: Create self-signed interconnect certificate
Expand All @@ -25,6 +26,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-selfsigned"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
commonName: "{{ ansible_operator_meta.name }}-interconnect.{{ ansible_operator_meta.namespace }}.svc.cluster.local"
isCA: true
issuerRef:
Expand All @@ -42,6 +44,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-ca"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
ca:
secretName: "{{ ansible_operator_meta.name }}-interconnect-selfsigned"

Expand All @@ -55,6 +58,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-openstack-ca"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
commonName: "{{ ansible_operator_meta.name }}-interconnect-openstack-ca"
isCA: true
issuerRef:
Expand All @@ -71,6 +75,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-openstack-credentials"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
commonName: "{{ ansible_operator_meta.name }}-interconnect"
dnsNames:
- "{{ ansible_operator_meta.name }}-interconnect.{{ ansible_operator_meta.namespace }}.svc.cluster.local"
Expand All @@ -88,6 +93,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-inter-router-ca"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
ca:
secretName: "{{ ansible_operator_meta.name }}-interconnect-inter-router-ca"

Expand All @@ -101,6 +107,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-inter-router-ca"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
commonName: "{{ ansible_operator_meta.name }}-interconnect-inter-router-ca"
isCA: true
issuerRef:
Expand All @@ -117,6 +124,7 @@
name: "{{ ansible_operator_meta.name }}-interconnect-inter-router-credentials"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
duration: '{{ certificate_duration }}'
commonName: "{{ ansible_operator_meta.name }}-interconnect"
dnsNames:
- "{{ ansible_operator_meta.name }}-interconnect.{{ ansible_operator_meta.namespace }}.svc.cluster.local"
Expand Down
9 changes: 9 additions & 0 deletions tests/smoketest/smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ for NAME in "${CLOUDNAMES[@]}"; do
RET=$((RET || $?)) # Accumulate exit codes
done

echo "*** [INFO] Checking that the qdr certificate has a long expiry"
EXPIRETIME=$(oc get secret default-interconnect-openstack-ca -o json | grep \"tls.crt\"\: | awk -F '": "' '{print $2}' | rev | cut -c3- | rev | base64 -d | openssl x509 -in - -text | grep "Not After" | awk -F " : " '{print $2}')
EXPIRETIME_UNIX=$(date -d "${EXPIRETIME}" "+%s")
TARGET_UNIX=$(date -d "now + 7 years" "+%s")
if [ ${EXPIRETIME_UNIX} -lt ${TARGET_UNIX} ]; then
echo "[FAILURE] Certificate expire time (${EXPIRETIME}) less than 7 years from now"
fi

echo "*** [INFO] Waiting to see SNMP trap message in webhook pod"
oc delete pod curl
SNMP_WEBHOOK_POD=$(oc get pod -l "app=default-snmp-webhook" -ojsonpath='{.items[0].metadata.name}')
SNMP_WEBHOOK_CHECK_MAX_TRIES=5
Expand Down

0 comments on commit 907dbc4

Please sign in to comment.