Skip to content

Commit ed31eea

Browse files
misba7moabu
andauthored
fix(cloud-native): fix sql-ssl secret volume permissions (#2308)
Signed-off-by: Amro Misbah <amromisba7@gmail.com> Co-authored-by: Mohammad Abudayyeh <47318409+moabu@users.noreply.github.com>
1 parent 4d8342e commit ed31eea

File tree

9 files changed

+45
-22
lines changed

9 files changed

+45
-22
lines changed

charts/gluu-all-in-one/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ Kubernetes: `>=v1.22.0-0`
238238
| configmap.cnSqlDbUser | string | `"gluu"` | SQL database username. |
239239
| configmap.cnSqlSslCaCert | string | `""` | Base64-encoded string of CA certificate used to sign client/server certificate of MySQL/PostgreSQL server. Required if using client cert authentication. |
240240
| configmap.cnSqlSslClientCert | string | `""` | Base64-encoded string of client certificate signed by CA. Required if using client cert authentication. |
241-
| configmap.cnSqlSslClientKey | string | `""` | Base64-encoded string of client key signed by CA. Required if using client cert authentication. |
242-
| configmap.cnSqlSslEnabled | bool | `false` | Enforce connection to SQL database using SSL. |
243-
| configmap.cnSqlSslMode | string | `""` | Mode when connecting to SQL database using SSL. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`. |
241+
| configmap.cnSqlSslClientKey | string | `""` | Base64-encoded client private key corresponding to the client certificate. Required if using client cert authentication. We advise to not commit real private keys in values.yaml. |
242+
| configmap.cnSqlSslEnabled | bool | `false` | Enable SSL connection to SQL database. |
243+
| configmap.cnSqlSslMode | string | `""` | Mode used to connect to SQL database using SSL if cnSqlSslEnabled is set to true. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`. |
244244
| configmap.cnSqldbUserPassword | string | `"Test1234#"` | SQL password injected the secrets . |
245245
| configmap.cnVaultAddr | string | `"http://localhost:8200"` | Base URL of Vault. |
246246
| configmap.cnVaultAppRolePath | string | `"approle"` | Path to Vault AppRole. |

charts/gluu-all-in-one/templates/deployment.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ spec:
3939
{{- end }}
4040
{{- end }}
4141
spec:
42+
securityContext:
43+
fsGroup: 1000
44+
fsGroupChangePolicy: OnRootMismatch
4245
{{- with .Values.image.pullSecrets }}
4346
imagePullSecrets:
4447
{{- toYaml . | nindent 8 }}
@@ -136,12 +139,15 @@ spec:
136139
- name: {{ .Release.Name }}-sql-ssl-ca-cert
137140
mountPath: /etc/certs/sql_cacert.pem
138141
subPath: sql_cacert.pem
142+
readOnly: true
139143
- name: {{ .Release.Name }}-sql-ssl-client-cert
140144
mountPath: /etc/certs/sql_client_cert.pem
141145
subPath: sql_client_cert.pem
146+
readOnly: true
142147
- name: {{ .Release.Name }}-sql-ssl-client-key
143148
mountPath: /etc/certs/sql_client_key.pem
144149
subPath: sql_client_key.pem
150+
readOnly: true
145151
{{- end }}
146152
livenessProbe:
147153
{{- toYaml .Values.livenessProbe | nindent 10 }}
@@ -178,19 +184,22 @@ spec:
178184
- name: {{ .Release.Name }}-sql-ssl-ca-cert
179185
secret:
180186
secretName: {{ .Release.Name }}-sql-ssl
187+
optional: true
181188
items:
182189
- key: sql_cacert.pem
183190
path: sql_cacert.pem
184191
- name: {{ .Release.Name }}-sql-ssl-client-cert
185192
secret:
186193
secretName: {{ .Release.Name }}-sql-ssl
194+
optional: true
187195
items:
188196
- key: sql_client_cert.pem
189197
path: sql_client_cert.pem
190198
- name: {{ .Release.Name }}-sql-ssl-client-key
191199
secret:
192200
secretName: {{ .Release.Name }}-sql-ssl
193-
defaultMode: 0640
201+
optional: true
202+
defaultMode: 0440
194203
items:
195204
- key: sql_client_key.pem
196205
path: sql_client_key.pem

charts/gluu-all-in-one/templates/secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ metadata:
7373
{{- if .Values.additionalAnnotations }}
7474
{{ toYaml .Values.additionalAnnotations | indent 4 }}
7575
{{- end }}
76-
{{- if .Values.config.customAnnotations.secret }}
76+
{{- if .Values.customAnnotations.secret }}
7777
{{ toYaml .Values.customAnnotations.secret | indent 4 }}
7878
{{- end }}
7979
{{- end }}

charts/gluu-all-in-one/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ configmap:
5353
cnSqlDbTimezone: UTC
5454
# -- SQL password injected the secrets .
5555
cnSqldbUserPassword: Test1234#
56-
# -- Enforce connection to SQL database using SSL.
56+
# -- Enable SSL connection to SQL database.
5757
cnSqlSslEnabled: false
58-
# -- Mode when connecting to SQL database using SSL. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`.
58+
# -- Mode used to connect to SQL database using SSL if cnSqlSslEnabled is set to true. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`.
5959
cnSqlSslMode: ""
6060
# -- Base64-encoded string of CA certificate used to sign client/server certificate of MySQL/PostgreSQL server. Required if using client cert authentication.
6161
cnSqlSslCaCert: ""
6262
# -- Base64-encoded string of client certificate signed by CA. Required if using client cert authentication.
6363
cnSqlSslClientCert: ""
64-
# -- Base64-encoded string of client key signed by CA. Required if using client cert authentication.
64+
# -- Base64-encoded client private key corresponding to the client certificate. Required if using client cert authentication. We advise to not commit real private keys in values.yaml.
6565
cnSqlSslClientKey: ""
6666
# -- Cache type. `NATIVE_PERSISTENCE`, `REDIS`. or `IN_MEMORY`. Defaults to `NATIVE_PERSISTENCE` .
6767
cnCacheType: NATIVE_PERSISTENCE

charts/gluu/README.md

Lines changed: 8 additions & 3 deletions
Large diffs are not rendered by default.

charts/gluu/charts/config/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ Kubernetes: `>=v1.21.0-0`
6161
| configmap.cnSqlDbUser | string | `"gluu"` | SQL database username. |
6262
| configmap.cnSqlSslCaCert | string | `""` | Base64-encoded string of CA certificate used to sign client/server certificate of MySQL/PostgreSQL server. Required if using client cert authentication. |
6363
| configmap.cnSqlSslClientCert | string | `""` | Base64-encoded string of client certificate signed by CA. Required if using client cert authentication. |
64-
| configmap.cnSqlSslClientKey | string | `""` | Base64-encoded string of client key signed by CA. Required if using client cert authentication. |
65-
| configmap.cnSqlSslEnabled | bool | `false` | Enforce connection to SQL database using SSL. |
66-
| configmap.cnSqlSslMode | string | `""` | Mode when connecting to SQL database using SSL. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`. |
64+
| configmap.cnSqlSslClientKey | string | `""` | Base64-encoded client private key corresponding to the client certificate. Required if using client cert authentication. We advise to not commit real private keys in values.yaml. |
65+
| configmap.cnSqlSslEnabled | bool | `false` | Enable SSL connection to SQL database. |
66+
| configmap.cnSqlSslMode | string | `""` | Mode used to connect to SQL database using SSL if cnSqlSslEnabled is set to true. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`. |
6767
| configmap.cnSqldbUserPassword | string | `"Test1234#"` | SQL password injected in the secrets. |
6868
| configmap.cnVaultAddr | string | `"http://localhost:8200"` | Base URL of Vault. |
6969
| configmap.cnVaultAppRolePath | string | `"approle"` | Path to Vault AppRole. |

charts/gluu/charts/config/templates/load-init-config.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ spec:
2727
APP_NAME: configurator
2828
app: {{ .Release.Name }}-{{ include "config.name" . }}-init-load
2929
spec:
30+
securityContext:
31+
fsGroup: 1000
32+
fsGroupChangePolicy: OnRootMismatch
3033
{{- with .Values.image.pullSecrets }}
3134
imagePullSecrets:
3235
{{- toYaml . | nindent 8 }}
@@ -54,19 +57,22 @@ spec:
5457
- name: {{ .Release.Name }}-sql-ssl-ca-cert
5558
secret:
5659
secretName: {{ .Release.Name }}-sql-ssl
60+
optional: true
5761
items:
5862
- key: sql_cacert.pem
5963
path: sql_cacert.pem
6064
- name: {{ .Release.Name }}-sql-ssl-client-cert
6165
secret:
6266
secretName: {{ .Release.Name }}-sql-ssl
67+
optional: true
6368
items:
6469
- key: sql_client_cert.pem
6570
path: sql_client_cert.pem
6671
- name: {{ .Release.Name }}-sql-ssl-client-key
6772
secret:
6873
secretName: {{ .Release.Name }}-sql-ssl
69-
defaultMode: 0640
74+
optional: true
75+
defaultMode: 0440
7076
items:
7177
- key: sql_client_key.pem
7278
path: sql_client_key.pem
@@ -97,12 +103,15 @@ spec:
97103
- name: {{ .Release.Name }}-sql-ssl-ca-cert
98104
mountPath: /etc/certs/sql_cacert.pem
99105
subPath: sql_cacert.pem
106+
readOnly: true
100107
- name: {{ .Release.Name }}-sql-ssl-client-cert
101108
mountPath: /etc/certs/sql_client_cert.pem
102109
subPath: sql_client_cert.pem
110+
readOnly: true
103111
- name: {{ .Release.Name }}-sql-ssl-client-key
104112
mountPath: /etc/certs/sql_client_key.pem
105113
subPath: sql_client_key.pem
114+
readOnly: true
106115
{{- end }}
107116
envFrom:
108117
- configMapRef:

charts/gluu/charts/config/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ configmap:
3131
cnSqlDbTimezone: UTC
3232
# -- SQL password injected in the secrets.
3333
cnSqldbUserPassword: Test1234#
34-
# -- Enforce connection to SQL database using SSL.
34+
# -- Enable SSL connection to SQL database.
3535
cnSqlSslEnabled: false
36-
# -- Mode when connecting to SQL database using SSL. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`.
36+
# -- Mode used to connect to SQL database using SSL if cnSqlSslEnabled is set to true. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`.
3737
cnSqlSslMode: ""
3838
# -- Base64-encoded string of CA certificate used to sign client/server certificate of MySQL/PostgreSQL server. Required if using client cert authentication.
3939
cnSqlSslCaCert: ""
4040
# -- Base64-encoded string of client certificate signed by CA. Required if using client cert authentication.
4141
cnSqlSslClientCert: ""
42-
# -- Base64-encoded string of client key signed by CA. Required if using client cert authentication.
42+
# -- Base64-encoded client private key corresponding to the client certificate. Required if using client cert authentication. We advise to not commit real private keys in values.yaml.
4343
cnSqlSslClientKey: ""
4444
# -- Cache type. `NATIVE_PERSISTENCE`, `REDIS`. or `IN_MEMORY`. Defaults to `NATIVE_PERSISTENCE` .
4545
cnCacheType: NATIVE_PERSISTENCE

charts/gluu/values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,15 @@ config:
363363
cnSqlDbTimezone: UTC
364364
# -- SQL password injected the secrets .
365365
cnSqldbUserPassword: Test1234#
366-
# -- Enforce connection to SQL database using SSL.
366+
# -- Enable SSL connection to SQL database.
367367
cnSqlSslEnabled: false
368-
# -- Mode when connecting to SQL database using SSL. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`.
368+
# -- Mode used to connect to SQL database using SSL if cnSqlSslEnabled is set to true. If using MySQL, choose one of `PREFERRED`, `REQUIRED`, `VERIFY_CA`, or `VERIFY_IDENTITY`. If using PostgreSQL, choose one of `allow`, `prefer`, `require`, `verify-ca`, or `verify-full`.
369369
cnSqlSslMode: ""
370370
# -- Base64-encoded string of CA certificate used to sign client/server certificate of MySQL/PostgreSQL server. Required if using client cert authentication.
371371
cnSqlSslCaCert: ""
372372
# -- Base64-encoded string of client certificate signed by CA. Required if using client cert authentication.
373373
cnSqlSslClientCert: ""
374-
# -- Base64-encoded string of client key signed by CA. Required if using client cert authentication.
374+
# -- Base64-encoded client private key corresponding to the client certificate. Required if using client cert authentication. We advise to not commit real private keys in values.yaml.
375375
cnSqlSslClientKey: ""
376376
# -- Cache type. `NATIVE_PERSISTENCE`, `REDIS`. or `IN_MEMORY`. Defaults to `NATIVE_PERSISTENCE` .
377377
cnCacheType: NATIVE_PERSISTENCE
@@ -913,7 +913,7 @@ global:
913913
adminUiServiceName: admin-ui
914914
ingress:
915915
# -- Enable Admin UI endpoints in either istio or nginx ingress depending on users choice
916-
adminUiEnabled: false
916+
adminUiEnabled: true
917917
# -- Admin UI ingress resource labels. key app is taken.
918918
adminUiLabels: { }
919919
# -- Admin UI ingress resource additional annotations.

0 commit comments

Comments
 (0)