Skip to content

Commit 7e876e5

Browse files
committed
fix: Replace hardcoded password with dynamic value
1 parent a4d30b2 commit 7e876e5

File tree

10 files changed

+40
-12
lines changed

10 files changed

+40
-12
lines changed

.github/TEMPLATES/secret-mapping-opencrvs.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@ smtp-config:
5454
# This string is supplied to the clients and nginx config and ensures that the format of your domain above can be configurable for CORS purposes.
5555

5656
# NOTIFICATION_TRANSPORT
57-
# A prop which can be used to configure either Email or SMS for staff and beneficiary comms or potentially both.
57+
# A prop which can be used to configure either Email or SMS for staff and beneficiary comms or potentially both.
58+
59+
# One time password while installation
60+
opencrvs-superuser:
61+
type: Opaque
62+
data:
63+
- SUPER_USER_PASSWORD

.github/workflows/deploy-opencrvs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
- name: Deploy with Helm
119119
id: deploy
120120
run: |
121-
helm upgrade --install opencrvs oci://ghcr.io/opencrvs/opencrvs-services \
121+
helm upgrade --install opencrvs oci://ghcr.io/opencrvs/opencrvs-services:0.1.26 \
122122
--timeout 15m \
123123
--namespace "opencrvs-${ENV}" \
124124
-f environments/${ENV}/opencrvs-services/values.yaml \
@@ -130,6 +130,7 @@ jobs:
130130
--set image.tag="$CORE_IMAGE_TAG" \
131131
--set countryconfig.image.tag="$COUNTRYCONFIG_IMAGE_TAG" \
132132
--set countryconfig.image.name="$COUNTRYCONFIG_IMAGE_NAME" \
133+
--set data_seed.env.ACTIVATE_USERS="${{ vars.ACTIVATE_USERS || 'false' }}" \
133134
--set hostname=${{ vars.DOMAIN }} 2>&1 | sed '/USER-SUPPLIED VALUES:/,$d'; exit ${PIPESTATUS[0]};
134135
- name: Cleanup Helm Locks
135136
if: failure() || cancelled()

.github/workflows/k8s-reindex.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
helm template -f ${namespace}.json \
4747
--namespace ${namespace} \
4848
-s templates/elasticsearch-reindex-job.yaml \
49-
oci://ghcr.io/opencrvs/opencrvs-services | kubectl apply --wait -n ${namespace} -f -
49+
oci://ghcr.io/opencrvs/opencrvs-services:0.1.26 | kubectl apply --wait -n ${namespace} -f -
5050
- name: Checking elasticsearch-reindex job status
5151
run: |
5252
while true; do

.github/workflows/k8s-reset-data.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
--set data_seed.enabled=true \
102102
--namespace ${namespace} \
103103
-s templates/${{ matrix.job-name }}-job.yaml \
104-
oci://ghcr.io/opencrvs/opencrvs-services | kubectl apply -n ${namespace} --wait=true -f -
104+
oci://ghcr.io/opencrvs/opencrvs-services:0.1.26 | kubectl apply -n ${namespace} --wait=true -f -
105105
- name: Checking ${{ matrix.job-name }} job status
106106
run: |
107107
while true; do

.github/workflows/k8s-seed-data.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
--set data_seed.env.ACTIVATE_USERS=${{ vars.ACTIVATE_USERS || 'false' }} \
101101
--namespace ${namespace} \
102102
-s templates/${{ matrix.job-name }}-job.yaml \
103-
oci://ghcr.io/opencrvs/opencrvs-services | kubectl apply -n ${namespace} --wait=true -f -
103+
oci://ghcr.io/opencrvs/opencrvs-services:0.1.26 | kubectl apply -n ${namespace} --wait=true -f -
104104
- name: Checking ${{ matrix.job-name }} job status
105105
run: |
106106
while true; do

charts/opencrvs-services/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: opencrvs-services
33
description: OpenCRVS Services
44
type: application
5-
version: 0.1.23
6-
appVersion: 1.9.0
5+
version: 0.1.26
6+
appVersion: 1.9.6

charts/opencrvs-services/templates/data-migration-job.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ spec:
2121
- name: migration
2222
image: "ghcr.io/opencrvs/ocrvs-migration:{{ .Values.image.tag }}"
2323
env:
24+
- name: SUPER_USER_PASSWORD
25+
valueFrom:
26+
secretKeyRef:
27+
key: SUPER_USER_PASSWORD
28+
name: opencrvs-superuser
2429
{{- if eq .Values.elasticsearch.auth_mode "disabled" }}
2530
- name: ES_HOST
2631
value: "{{ .Values.elasticsearch.host }}:{{ .Values.elasticsearch.port }}"

charts/opencrvs-services/templates/data-seed-job.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ spec:
2525
value: "http://gateway.{{ .Release.Namespace }}.svc.cluster.local:7070"
2626
- name: COUNTRY_CONFIG_HOST
2727
value: http://countryconfig.{{ .Release.Namespace }}.svc.cluster.local:3040
28+
- name: SUPER_USER_PASSWORD
29+
valueFrom:
30+
secretKeyRef:
31+
key: SUPER_USER_PASSWORD
32+
name: opencrvs-superuser
2833
{{- if or (eq .Values.minio.auth_mode "auto") (eq .Values.minio.auth_mode "use_secret") }}
2934
- name: MINIO_ROOT_USER
3035
valueFrom:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- $secret_name := "opencrvs-superuser" }}
2+
{{- $secret := lookup "v1" "Secret" .Release.Namespace $secret_name }}
3+
{{- if not $secret }}
4+
apiVersion: v1
5+
kind: Secret
6+
metadata:
7+
name: {{ $secret_name }}
8+
annotations:
9+
"helm.sh/resource-policy": keep
10+
"helm.sh/hook": pre-install
11+
"helm.sh/hook-weight": "0"
12+
type: Opaque
13+
data:
14+
SUPER_USER_PASSWORD: {{ randAlphaNum 32 | b64enc }}
15+
{{- end }}

charts/opencrvs-services/values.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,7 @@ scheduler: {}
319319
# One time jobs:
320320

321321
# data_migration: Job to migrate datastores while deployment
322-
data_migration:
323-
env:
324-
SUPER_USER_PASSWORD: "password"
322+
data_migration: {}
325323

326324

327325
# data_cleanup: Wipe all persistent data from datastores including users
@@ -335,8 +333,6 @@ data_cleanup:
335333
data_seed:
336334
enabled: true
337335
env:
338-
# Default password for admin user for initial data seed
339-
SUPER_USER_PASSWORD: "password"
340336
# When users are seeded, are they immediately active using a test password and
341337
# six zeros as a 2-Factor auth code. Always set to false in production and staging.
342338
ACTIVATE_USERS: "true"

0 commit comments

Comments
 (0)