From 277fdf3ec5c402c05cd8b61f65a4fae0f4875904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Juli=C3=A1n=20Espina?= Date: Wed, 24 Jul 2024 18:02:12 -0600 Subject: [PATCH] asdf --- overlays/sbin/slurmrestd.wrapper | 12 +++++++----- snap/snapcraft.yaml | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/overlays/sbin/slurmrestd.wrapper b/overlays/sbin/slurmrestd.wrapper index 41590ca..db5fd31 100755 --- a/overlays/sbin/slurmrestd.wrapper +++ b/overlays/sbin/slurmrestd.wrapper @@ -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 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}" \ + "$(hostname -s):6820" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 9a42d44..cab98e8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -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 @@ -263,6 +266,7 @@ parts: - libsz2 - libhdf5-hl-100 - libhdf5-103-1 + - util-linux override-build: | craftctl default