Skip to content

Commit 6bc62fc

Browse files
authored
some ssecurity update (#1248)
https://streamnative.slack.com/archives/C0395H6FYE9/p1761266465891989?thread_ts=1760576774.500249&cid=C0395H6FYE9 - [x] Toolset needs to add liveness and readiness checks, runAsGroup cannot be set to 0, secret volume should be 400 or 440 - [x] proxy statefulset runAsGroup cannot be set to 0, secret volume should be 400 or 440 ### Documentation Check the box below. Need to update docs? - [ ] `doc-required` (If you need help on updating docs, create a doc issue) - [x] `no-need-doc` (Please explain why) - [ ] `doc` (If this PR contains doc changes) --------- Signed-off-by: lili <lli@streamnative.io>
1 parent a7bfc7f commit 6bc62fc

8 files changed

Lines changed: 90 additions & 0 deletions

File tree

charts/sn-platform-slim/templates/proxy/_proxy.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ Define proxy certs volumes
4848
secret:
4949
{{- if and .Values.certs.public_issuer.enabled (eq .Values.certs.public_issuer.type "acme") }}
5050
secretName: {{ .Values.certs.lets_encrypt.ca_ref.secretName }}
51+
defaultMode: 0400
5152
items:
5253
- key: {{ .Values.certs.lets_encrypt.ca_ref.keyName }}
5354
path: ca.crt
5455
{{- else }}
5556
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
57+
defaultMode: 0400
5658
items:
5759
- key: ca.crt
5860
path: ca.crt
@@ -61,6 +63,7 @@ Define proxy certs volumes
6163
- name: proxy-certs
6264
secret:
6365
secretName: "{{ template "pulsar.proxy.tls.secret.name" . }}"
66+
defaultMode: 0400
6467
items:
6568
- key: tls.crt
6669
path: tls.crt
@@ -71,6 +74,7 @@ Define proxy certs volumes
7174
- name: broker-ca
7275
secret:
7376
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
77+
defaultMode: 0400
7478
items:
7579
- key: ca.crt
7680
path: ca.crt

charts/sn-platform-slim/templates/toolset/_toolset.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Define toolset token volumes
4343
- name: client-token
4444
secret:
4545
secretName: "{{ .Release.Name }}-token-{{ .Values.auth.superUsers.client }}"
46+
defaultMode: 0400
4647
items:
4748
- key: TOKEN
4849
path: client/token
@@ -79,6 +80,7 @@ Define toolset tls certs volumes
7980
- name: toolset-certs
8081
secret:
8182
secretName: "{{ template "pulsar.toolset.tls.secret.name" . }}"
83+
defaultMode: 0400
8284
items:
8385
- key: tls.crt
8486
path: tls.crt
@@ -87,6 +89,7 @@ Define toolset tls certs volumes
8789
- name: ca
8890
secret:
8991
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
92+
defaultMode: 0400
9093
items:
9194
- key: ca.crt
9295
path: ca.crt
@@ -97,11 +100,13 @@ Define toolset tls certs volumes
97100
secret:
98101
{{- if and .Values.certs.public_issuer.enabled (eq .Values.certs.public_issuer.type "acme") }}
99102
secretName: {{ .Values.certs.lets_encrypt.ca_ref.secretName }}
103+
defaultMode: 0400
100104
items:
101105
- key: {{ .Values.certs.lets_encrypt.ca_ref.keyName }}
102106
path: ca.crt
103107
{{- else }}
104108
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
109+
defaultMode: 0400
105110
items:
106111
- key: ca.crt
107112
path: ca.crt

charts/sn-platform-slim/templates/toolset/toolset-statefulset.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,26 @@ spec:
118118
bin/apply-config-from-env.py conf/bookkeeper.conf;
119119
{{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 10 }}
120120
sleep 10000000000
121+
livenessProbe:
122+
exec:
123+
command:
124+
- sh
125+
- -c
126+
- "ps aux | grep -v grep | grep sleep"
127+
initialDelaySeconds: 10
128+
periodSeconds: 30
129+
timeoutSeconds: 5
130+
failureThreshold: 3
131+
readinessProbe:
132+
exec:
133+
command:
134+
- sh
135+
- -c
136+
- "ps aux | grep -v grep | grep sleep"
137+
initialDelaySeconds: 5
138+
periodSeconds: 10
139+
timeoutSeconds: 5
140+
failureThreshold: 3
121141
envFrom:
122142
- configMapRef:
123143
name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"

charts/sn-platform-slim/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,9 @@ proxy:
16691669
annotations: {}
16701670
securityContext:
16711671
runAsNonRoot: true
1672+
runAsUser: 10000
1673+
runAsGroup: 10000
1674+
fsGroup: 10000
16721675
tolerations: []
16731676
gracePeriod: 30
16741677
resources:
@@ -1811,6 +1814,9 @@ toolset:
18111814
-XX:MaxDirectMemorySize=128M
18121815
securityContext:
18131816
runAsNonRoot: true
1817+
runAsUser: 10000
1818+
runAsGroup: 10000
1819+
fsGroup: 10000
18141820
serviceAccount:
18151821
# Specifies whether to use a service account to run this component
18161822
use: true

charts/sn-platform/templates/proxy/_proxy.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ Define proxy certs volumes
4848
secret:
4949
{{- if and .Values.certs.public_issuer.enabled (eq .Values.certs.public_issuer.type "acme") }}
5050
secretName: {{ .Values.certs.lets_encrypt.ca_ref.secretName }}
51+
defaultMode: 0400
5152
items:
5253
- key: {{ .Values.certs.lets_encrypt.ca_ref.keyName }}
5354
path: ca.crt
5455
{{- else }}
5556
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
57+
defaultMode: 0400
5658
items:
5759
- key: ca.crt
5860
path: ca.crt
@@ -61,6 +63,7 @@ Define proxy certs volumes
6163
- name: proxy-certs
6264
secret:
6365
secretName: "{{ template "pulsar.proxy.tls.secret.name" . }}"
66+
defaultMode: 0400
6467
items:
6568
- key: tls.crt
6669
path: tls.crt
@@ -71,6 +74,7 @@ Define proxy certs volumes
7174
- name: broker-ca
7275
secret:
7376
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
77+
defaultMode: 0400
7478
items:
7579
- key: ca.crt
7680
path: ca.crt

charts/sn-platform/templates/toolset/_toolset.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Define toolset token volumes
5858
- name: client-token
5959
secret:
6060
secretName: "{{ .Release.Name }}-token-{{ .Values.auth.superUsers.client }}"
61+
defaultMode: 0400
6162
items:
6263
- key: TOKEN
6364
path: client/token
@@ -99,6 +100,7 @@ Define toolset tls certs volumes
99100
- name: toolset-certs
100101
secret:
101102
secretName: "{{ template "pulsar.toolset.tls.secret.name" . }}"
103+
defaultMode: 0400
102104
items:
103105
- key: tls.crt
104106
path: tls.crt
@@ -107,6 +109,7 @@ Define toolset tls certs volumes
107109
- name: ca
108110
secret:
109111
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
112+
defaultMode: 0400
110113
items:
111114
- key: ca.crt
112115
path: ca.crt
@@ -123,11 +126,13 @@ Define toolset tls certs volumes
123126
secret:
124127
{{- if and .Values.certs.public_issuer.enabled (eq .Values.certs.public_issuer.type "acme") }}
125128
secretName: {{ .Values.certs.lets_encrypt.ca_ref.secretName }}
129+
defaultMode: 0400
126130
items:
127131
- key: {{ .Values.certs.lets_encrypt.ca_ref.keyName }}
128132
path: ca.crt
129133
{{- else }}
130134
secretName: "{{ template "pulsar.tls.ca.secret.name" . }}"
135+
defaultMode: 0400
131136
items:
132137
- key: ca.crt
133138
path: ca.crt

charts/sn-platform/templates/toolset/toolset-statefulset.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,26 @@ spec:
118118
bin/apply-config-from-env.py conf/bookkeeper.conf;
119119
{{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 10 }}
120120
sleep 10000000000
121+
livenessProbe:
122+
exec:
123+
command:
124+
- sh
125+
- -c
126+
- "ps aux | grep -v grep | grep sleep"
127+
initialDelaySeconds: 10
128+
periodSeconds: 30
129+
timeoutSeconds: 5
130+
failureThreshold: 3
131+
readinessProbe:
132+
exec:
133+
command:
134+
- sh
135+
- -c
136+
- "ps aux | grep -v grep | grep sleep"
137+
initialDelaySeconds: 5
138+
periodSeconds: 10
139+
timeoutSeconds: 5
140+
failureThreshold: 3
121141
envFrom:
122142
- configMapRef:
123143
name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
@@ -162,6 +182,26 @@ spec:
162182
{{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 10 }}
163183
{{- include "pulsar.toolset.kafka.settings" . | nindent 10 }}
164184
sleep 10000000000
185+
livenessProbe:
186+
exec:
187+
command:
188+
- sh
189+
- -c
190+
- "ps aux | grep -v grep | grep sleep"
191+
initialDelaySeconds: 10
192+
periodSeconds: 30
193+
timeoutSeconds: 5
194+
failureThreshold: 3
195+
readinessProbe:
196+
exec:
197+
command:
198+
- sh
199+
- -c
200+
- "ps aux | grep -v grep | grep sleep"
201+
initialDelaySeconds: 5
202+
periodSeconds: 10
203+
timeoutSeconds: 5
204+
failureThreshold: 3
165205
envFrom:
166206
- configMapRef:
167207
name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"

charts/sn-platform/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,9 @@ proxy:
17451745
annotations: {}
17461746
securityContext:
17471747
runAsNonRoot: true
1748+
runAsUser: 10000
1749+
runAsGroup: 10000
1750+
fsGroup: 10000
17481751
tolerations: []
17491752
gracePeriod: 30
17501753
resources:
@@ -1891,6 +1894,9 @@ toolset:
18911894
-XX:MaxDirectMemorySize=128M
18921895
securityContext:
18931896
runAsNonRoot: true
1897+
runAsUser: 10000
1898+
runAsGroup: 10000
1899+
fsGroup: 10000
18941900
serviceAccount:
18951901
# Specifies whether to use a service account to run this component
18961902
use: true

0 commit comments

Comments
 (0)