Skip to content

Commit

Permalink
Feat: 771 remove unnecessary security concerns (#926)
Browse files Browse the repository at this point in the history
* feat: reduce privileges granted through SCC for OpenShift

Signed-off-by: Bastien Grasnick <bastien.grasnick@deutschebahn.com>

* feat: set mounted volumes as read only as much as possible

Signed-off-by: Bastien Grasnick <bastien.grasnick@deutschebahn.com>

* feat: set pod hostPID to true to avoid collisions/unwanted behavior in host PID namespace

Signed-off-by: Bastien Grasnick <bastien.grasnick@deutschebahn.com>

* feat: remove unnecessary mount of /sys/kernel/debug

Signed-off-by: Bastien Grasnick <bastien.grasnick@deutschebahn.com>

---------

Signed-off-by: Bastien Grasnick <bastien.grasnick@deutschebahn.com>
  • Loading branch information
BGrasnick authored Nov 1, 2023
1 parent d8a48f4 commit 877a59a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 3 additions & 0 deletions manifests/config/exporter/exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
key: node-role.kubernetes.io/master
dnsPolicy: ClusterFirstWithHostNet
serviceAccountName: kepler-sa
hostPID: true
containers:
- name: kepler-exporter
image: kepler:latest
Expand Down Expand Up @@ -86,8 +87,10 @@ spec:
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
readOnly: true
- mountPath: /sys
name: tracing
readOnly: true
- mountPath: /proc
name: proc
- mountPath: /var/run
Expand Down
6 changes: 3 additions & 3 deletions manifests/config/exporter/openshift_scc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ metadata:
# To allow running privilegedContainers
allowPrivilegedContainer: true
allowHostDirVolumePlugin: true
allowHostNetwork: true
allowHostPorts: true
allowHostIPC: true
allowHostNetwork: false
allowHostPorts: false
allowHostIPC: false
allowHostPID: true
readOnlyRootFilesystem: true
defaultAddCapabilities:
Expand Down
9 changes: 2 additions & 7 deletions manifests/config/exporter/patch/patch-openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@ spec:
volumeMounts:
- name: kernel-src
mountPath: /usr/src/kernels
- name: kernel-debug
mountPath: /sys/kernel/debug
readOnly: true
securityContext:
privileged: true
volumes:
- name: kernel-debug
hostPath:
path: /sys/kernel/debug
type: Directory
volumes:
- name: kernel-src
hostPath:
path: /usr/src/kernels
Expand Down

0 comments on commit 877a59a

Please sign in to comment.