From 4707d391430ebacd08d00bfcf36360fe982b195a Mon Sep 17 00:00:00 2001 From: steering7253 Date: Mon, 18 May 2026 06:12:21 -0600 Subject: add gpg auth --- new_user_created.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'new_user_created.sh') diff --git a/new_user_created.sh b/new_user_created.sh index e00a3bb..802d424 100755 --- a/new_user_created.sh +++ b/new_user_created.sh @@ -1,7 +1,12 @@ #!/bin/sh -read method type key <$SSH_USER_AUTH -user="$(grep -l -s -r -P '^\s*auth:\s*\Q'"$type"'\E\s+\Q'"$key"'\E(\s|$)' /opt/autopeer/dn42-registry/data/mntner/ | perl -ne 's@^.*/@@; s@-MNT$@@; print lc;' | head -1)" +if [ -z "$NEW_USER" ]; then # ssh auth + read method type key <$SSH_USER_AUTH + user="$(grep -l -s -r -P '^\s*auth:\s*\Q'"$type"'\E\s+\Q'"$key"'\E(\s|$)' /opt/autopeer/dn42-registry/data/mntner/ | perl -ne 's@^.*/@@; s@-MNT$@@; print lc;' | head -1)" +else # pgp auth + fpr="$(curl -s "$NEW_USER" | gpg --show-keys --with-colons | grep -Po 'fpr:*\K[^:]+' | head -1)" + user="$(grep -l -s -r -P '^\s*auth:\s*pgp-fingerprint\s+\Q'"$fpr"'\E(\s|$)' /opt/autopeer/dn42-registry/data/mntner/ | perl -ne 's@^.*/@@; s@-MNT$@@; print lc;' | head -1)" +fi if getent passwd "$user" >/dev/null 2>&1; then echo "Your account has been created, go ahead and log in:" -- cgit v1.3.1-10-gc9f91