From 71c2fd8eeb3a08f2f9fff085703edb77495b5de5 Mon Sep 17 00:00:00 2001 From: knoflook Date: Wed, 12 Jul 2023 14:41:46 +0200 Subject: [PATCH] don't break if hashed uid starts with 0 --- abra.sh | 2 +- pam_script_auth.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/abra.sh b/abra.sh index 0049efa..c1ad7e2 100644 --- a/abra.sh +++ b/abra.sh @@ -1,4 +1,4 @@ export CUSTOM_ENTRYPOINT_VERSION=v14 export OIDC_CONF_VERSION=v1 export PAM_EXEC_OAUTH2_YAML_VERSION=v1 -export PAM_SCRIPT_AUTH_VERSION=v4 +export PAM_SCRIPT_AUTH_VERSION=v5 diff --git a/pam_script_auth.sh b/pam_script_auth.sh index 35c8ca0..0b93c50 100755 --- a/pam_script_auth.sh +++ b/pam_script_auth.sh @@ -10,7 +10,7 @@ if ! id "$PAM_USER" &>/dev/null; then # without it, UID→username mapping changes on every container restart, which # creates file ownership issues and prevents RStudio from working. # See https://github.com/WASHNote/washnote-apps/issues/67 - uid=$(echo "$PAM_USER" | md5sum | grep -Eo "[[:digit:]]{3}" | head -n1) + uid=$(echo "$PAM_USER" | md5sum | grep -Eo "[[:digit:]]{3}" | head -n1 | sed -E 's/^0+//') uid=$((1000+uid)) adduser --uid="$uid" "$PAM_USER" --disabled-password --quiet --gecos "" fi