Skip to content

Commit c5f25e8

Browse files
authored
set proper security contexts for main.sdlc, move Geth dir from root (#2229)
* set proper security contexts for main.sdlc, move Geth dir from root * bump versions
1 parent 41190d9 commit c5f25e8

File tree

6 files changed

+36
-16
lines changed

6 files changed

+36
-16
lines changed

lib/charts/chainlink/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: A Helm chart for Kubernetes
55
# This is the chart version. This version number should be incremented each time you make changes
66
# to the chart and its templates, including the app version.
77
# Versions are expected to follow Semantic Versioning (https://semver.org/)
8-
version: 0.2.14
8+
version: 0.2.15
99

1010
# This is the version number of the application being deployed. This version number should be
1111
# incremented each time you make changes to the application. Versions are not expected to

lib/charts/chainlink/templates/chainlink-cm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ data:
1414
init.sql: |
1515
CREATE EXTENSION pg_stat_statements;
1616
default.toml: |
17-
RootDir = './clroot'
17+
RootDir = '/home/chainlink'
1818
1919
[Log]
2020
JSONConsole = true

lib/charts/chainlink/templates/chainlink-deployment.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ spec:
103103
initialDelaySeconds: 15
104104
periodSeconds: 5
105105
failureThreshold: 20
106+
securityContext:
107+
allowPrivilegeEscalation: false
108+
runAsNonRoot: true
109+
runAsUser: 14933
110+
runAsGroup: 14933
111+
capabilities:
112+
drop:
113+
- ALL
106114
resources:
107115
requests:
108116
memory: {{ $.Values.chainlink.resources.requests.memory }}
@@ -123,4 +131,4 @@ spec:
123131
{{ toYaml . | indent 8 }}
124132
{{- end }}
125133
---
126-
{{- end }}
134+
{{- end }}

lib/charts/chainlink/templates/pg-deployment.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ spec:
5050
name: {{ $.Release.Name }}-{{ $cfg.name }}-cm
5151
containers:
5252
- name: chainlink-db
53+
securityContext:
54+
allowPrivilegeEscalation: false
55+
readOnlyRootFilesystem: false
56+
runAsNonRoot: true
57+
runAsUser: 999
5358
{{- $image := $.Values.db.image.image }}
5459
{{- $tag := $.Values.db.image.version }}
5560
{{- if $cfg.db }}
@@ -127,13 +132,17 @@ spec:
127132
name: {{ $.Release.Name }}-{{ $cfg.name }}-config-map
128133
subPath: init.sql
129134
{{ if $.Values.db.stateful }}
130-
volumeMounts:
131135
- mountPath: /var/lib/postgresql/data
132136
name: postgres
133137
subPath: postgres-db
134138
{{ end }}
135139
{{- if $.Values.db.enablePrometheusPostgresExporter }}
136140
- name: prometheus-postgres-exporter
141+
securityContext:
142+
allowPrivilegeEscalation: false
143+
readOnlyRootFilesystem: false
144+
runAsNonRoot: true
145+
runAsUser: 999
137146
image: {{ $.Values.prometheusPostgresExporter.image.image }}
138147
args: ["--collector.statio_user_indexes"]
139148
resources:
@@ -163,4 +172,4 @@ spec:
163172
{{ toYaml . | indent 8 }}
164173
{{- end }}
165174
---
166-
{{- end }}
175+
{{- end }}

lib/charts/geth/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v1
22
name: geth
33
description: A simulated go-ethereum network
4-
version: 0.4.6
4+
version: 0.4.7
55
appVersion: '1.13.8'

lib/charts/geth/templates/geth-deployment.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ spec:
2828
{{ $key }}: {{ $value | quote }}
2929
{{- end }}
3030
spec:
31+
securityContext:
32+
runAsUser: 999
33+
fsGroup: 999
3134
restartPolicy: Always
3235
enableServiceLinks: false
3336
volumes:
@@ -37,30 +40,30 @@ spec:
3740
containers:
3841
- name: geth-network
3942
image: "{{ .Values.geth.image.image }}:{{ .Values.geth.image.version }}"
40-
command: [ "sh", "./root/init.sh" ]
43+
command: [ "sh", "./chain/init.sh" ]
4144
volumeMounts:
4245
- name: geth
43-
mountPath: /root/.ethereum/devchain/
46+
mountPath: /chain/.ethereum/devchain/
4447
- name : configmap-volume
45-
mountPath: /root/init.sh
48+
mountPath: /chain/init.sh
4649
subPath: init.sh
4750
- name: configmap-volume
48-
mountPath: /root/config
51+
mountPath: /chain/config
4952
- name: configmap-volume
50-
mountPath: /root/.ethereum/devchain/keystore/key1
53+
mountPath: /chain/.ethereum/devchain/keystore/key1
5154
subPath: key1
5255
- name: configmap-volume
53-
mountPath: /root/.ethereum/devchain/keystore/key2
56+
mountPath: /chain/.ethereum/devchain/keystore/key2
5457
subPath: key2
5558
- name: configmap-volume
56-
mountPath: /root/.ethereum/devchain/keystore/key3
59+
mountPath: /chain/.ethereum/devchain/keystore/key3
5760
subPath: key3
5861
args:
5962
- '--dev'
6063
- '--password'
61-
- '/root/config/password.txt'
64+
- '/chain/config/password.txt'
6265
- '--datadir'
63-
- '/root/.ethereum/devchain'
66+
- '/chain/.ethereum/devchain'
6467
- '--unlock'
6568
- '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
6669
- '--mine'
@@ -121,4 +124,4 @@ spec:
121124
{{- with .Values.tolerations }}
122125
tolerations:
123126
{{ toYaml . | indent 8 }}
124-
{{- end }}
127+
{{- end }}

0 commit comments

Comments
 (0)