Skip to content

Commit 341d133

Browse files
authored
Merge pull request #124 from andyzhangx/nonroot
fix: create nonroot user in Dockerfile
2 parents 93873a8 + e5e0558 commit 341d133

File tree

9 files changed

+17
-3
lines changed

9 files changed

+17
-3
lines changed

.github/workflows/darwin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: MacOS Unit Tests
1+
name: MacOS Build & Unit Test
22
on:
33
push:
44
branches: [ master ]

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linux Unit tests
1+
name: Ubuntu Test
22
on:
33
push:
44
branches: [ master ]

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Windows Unit Tests
1+
name: Windows Build & Unit Test
22
on:
33
push:
44
branches: [ master ]

charts/latest/csi-driver-smb/templates/csi-smb-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ spec:
9090
env:
9191
- name: CSI_ENDPOINT
9292
value: unix:///csi/csi.sock
93+
securityContext:
94+
runAsUser: 0
9395
volumeMounts:
9496
- mountPath: /csi
9597
name: socket-dir

charts/latest/csi-driver-smb/templates/csi-smb-node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ spec:
100100
fieldPath: spec.nodeName
101101
securityContext:
102102
privileged: true
103+
runAsUser: 0
103104
volumeMounts:
104105
- mountPath: /csi
105106
name: socket-dir

deploy/csi-smb-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ spec:
8686
env:
8787
- name: CSI_ENDPOINT
8888
value: unix:///csi/csi.sock
89+
securityContext:
90+
runAsUser: 0
8991
volumeMounts:
9092
- mountPath: /csi
9193
name: socket-dir

deploy/csi-smb-node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ spec:
9696
fieldPath: spec.nodeName
9797
securityContext:
9898
privileged: true
99+
runAsUser: 0
99100
volumeMounts:
100101
- mountPath: /csi
101102
name: socket-dir

pkg/smbplugin/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ RUN clean-install ca-certificates cifs-utils util-linux e2fsprogs mount udev xfs
2525
LABEL maintainers="andyzhangx"
2626
LABEL description="SMB CSI Driver"
2727

28+
# Create a nonroot user
29+
RUN useradd -u 10001 nonroot
30+
USER nonroot
31+
2832
COPY ./_output/smbplugin /smbplugin
2933
ENTRYPOINT ["/smbplugin"]

pkg/smbplugin/dev.Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ RUN apt-get update && apt-get install -y ca-certificates cifs-utils util-linux e
1717
LABEL maintainers="andyzhangx"
1818
LABEL description="SMB CSI Driver"
1919

20+
# Create a nonroot user
21+
RUN useradd -u 10001 nonroot
22+
USER nonroot
23+
2024
COPY ./_output/smbplugin /smbplugin
2125
ENTRYPOINT ["/smbplugin"]

0 commit comments

Comments
 (0)