Skip to content

Commit

Permalink
feat: add the _daemon_ user for non-privileged services
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 authored and NucciTheBoss committed Jul 25, 2024
1 parent de68a1e commit f4567b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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

0 comments on commit f4567b4

Please sign in to comment.