Commit e3b98641 authored by Lukas Werner's avatar Lukas Werner
Browse files

Removed unnecessary auth in

parent 519d38c0
......@@ -2,42 +2,6 @@
set -euf -o pipefail
shopt -s inherit_errexit
hash id
hash diff
hash ssh-keygen
hash runuser
function error {
echo "$1" >&2
return "$RV"
## User authentication
: "${CUSTOM_ENV_AUTH_USER:?"AUTH_USER CI/CD variable has not been set."}"
: "${CUSTOM_ENV_AUTH_KEY:?"AUTH_KEY CI/CD variable has not been set."}"
## Check if the user exists and the validity of its ID
id -u "$AUTH_USER" >/dev/null 2>&1 || error "User $AUTH_USER does not exist"
(( $(id -u "$AUTH_USER") >= 1000 )) || error "User $AUTH_USER ID within system reserved range."
## Use a key pair to authenticate the user (private key has to be set as a GitLab CI/CD variable)
while read -r PUB
diff --color=never <(ssh-keygen -y -e -f /dev/stdin <<< "$AUTH_KEY") <(ssh-keygen -y -e -f /dev/stdin <<< "$PUB") > /dev/null && exit 0
done < "$AUTH_PUB"
exit 1
) || error "Authentication failed."
### Env setup
AUTH_USER_WORK=$(runuser "$AUTH_USER" --login --command "echo \$WORK")
: "${AUTH_USER_WORK:?"Could not determine $AUTH_USER's \$WORK directory."}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment