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 committed Jul 25, 2024
1 parent de68a1e commit db12732
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 8 additions & 5 deletions overlays/sbin/slurmrestd.wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ 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 privileges for slurmrestd since running as root throws an error.
"${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}" \
# -g _daemon_ -u _daemon_ \
"$(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
override-build: |
craftctl default
Expand Down

0 comments on commit db12732

Please sign in to comment.