Skip to content

Commit

Permalink
Fix ndt-virtual's permission issue (#804)
Browse files Browse the repository at this point in the history
* Set data dir permissions to 2755 recursively.

This means that the setgid bit is applied to datatype folders that already exist
when the initContainer is started, such as those mounted separately from the
main /var/spool/<experiment> folder.

For example, /var/spool/ndt/ndt7 is mounted as a separate volume in the
ndt-server container. Kubernetes will create this folder as owned by root/root
and with 0755 permissions. Then, the set-data-dir-perms initContainer sets the
owner to nobody/nogroup. This would not allow any other user to write to this
folder.

* Revert "Do not drop privileges in ndt-virtual's ndt containers (#802)"

This reverts commit 079be28.

* Run as group 'nogroup'.

* Do not chmod recursively, the top-level folders are enough.

* Do not overwrite pod-level runAsGroup
  • Loading branch information
robertodauria authored May 24, 2023
1 parent b25e9c6 commit 4778526
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions k8s/daemonsets/experiments/ndt-virtual.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ exp.ExperimentNoIndex(expName, 'pusher-' + std.extVar('PROJECT_ID'), 'none', dat
add: [
'NET_BIND_SERVICE',
],
drop: [
'all',
],
},
runAsUser: 0,
},
Expand Down
2 changes: 1 addition & 1 deletion k8s/daemonsets/templates.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ local setDataDirOwnership(name) = {
command: [
'/bin/sh',
'-c',
'cd ' + dataDir + ' && chown -R 65534:65534 . && chmod 2775 .',
'cd ' + dataDir + ' && chown -R 65534:65534 . && chmod 2775 . && chmod 2775 *',
],
securityContext: {
runAsUser: 0,
Expand Down

0 comments on commit 4778526

Please sign in to comment.