Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the _daemon_ user for non-privileged services #44

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions overlays/sbin/slurmrestd.wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ fi
# Export invalid Slurm JWT token to activate JWT authentication in slurmrestd.
# See for more details: https://slurm.schedmd.com/rest.html#jwt
export SLURM_JWT=
"${SNAP}"/sbin/slurmrestd \
-f "${SNAP_COMMON}/etc/slurm/slurm.conf" \
--max-connections "${SLURMRESTD_MAX_CONNECTIONS}" \
-t "${SLURMRESTD_MAX_THREAD_COUNT}" \
"$(hostname -s):6820"
# Drop to _daemon_ because slurmrestd cannot run as either root or SlurmUser.
"${SNAP}"/usr/bin/setpriv --clear-groups --reuid _daemon_ --regid _daemon_ -- \
"${SNAP}"/sbin/slurmrestd \
-f "${SNAP_COMMON}/etc/slurm/slurm.conf" \
--max-connections "${SLURMRESTD_MAX_CONNECTIONS}" \
-t "${SLURMRESTD_MAX_THREAD_COUNT}" \
"$(hostname -s):6820"
4 changes: 4 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ environment:
# yamllint disable-line rule:line-length
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$SNAP/usr/local/bin:$SNAP/usr/local/sbin:$PATH

system-usernames:
_daemon_: shared

apps:
logrotate:
command: usr/sbin/logrotate $SNAP_COMMON/etc/logrotate/logrotate.conf
Expand Down Expand Up @@ -263,6 +266,7 @@ parts:
- libsz2
- libhdf5-hl-100
- libhdf5-103-1
- util-linux # `setpriv`
override-build: |
craftctl default
Expand Down