rename pass_mgr to secret-mgr #1

Merged
hzhang merged 1 commits from rename-pass-mgr-to-secret-mgr into main 2026-03-24 19:01:04 +00:00
13 changed files with 39 additions and 39 deletions

View File

@@ -73,7 +73,7 @@ Enable or disable local login on Gitea.
### Reset Password
Reset password for the current user (reads username from pass_mgr).
Reset password for the current user (reads username from secret-mgr).
```bash
{baseDir}/scripts/git/git-ctrl reset-password

View File

@@ -3,11 +3,11 @@ set -euo pipefail
GIT_URL="https://git.hangman-lab.top"
USER="$(pass_mgr get-username --key git)"
PASS="$(pass_mgr get-secret --key git)"
USER="$(secret-mgr get-username --key git)"
PASS="$(secret-mgr get-secret --key git)"
if [[ -z "$USER" || -z "$PASS" ]]; then
echo "Missing credentials from pass_mgr (key: git)"
echo "Missing credentials from secret-mgr (key: git)"
exit 2
fi

View File

@@ -28,11 +28,11 @@ if [[ -z "$username" || -z "$email" ]]; then
fi
# Generate git credentials (do not print secret)
pass_mgr generate --username "$username" --key git >/dev/null
secret-mgr generate --username "$username" --key git >/dev/null
# Create gitea user
"$SCRIPT_DIR/gitea" admin user create \
--username "$(pass_mgr get-username --key git)" \
--password "$(pass_mgr get-secret --key git)" \
--username "$(secret-mgr get-username --key git)" \
--password "$(secret-mgr get-secret --key git)" \
--email "$email" \
--must-change-password=false

View File

@@ -6,9 +6,9 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Verify git credentials first
"$SCRIPT_DIR/check-git-cred"
username=$(pass_mgr get-username --key git)
username=$(secret-mgr get-username --key git)
token=$("$SCRIPT_DIR/gitea" admin user generate-access-token --username "$username" --token-name "$username")
pass_mgr set --key git-access-token --username "$username" --secret "$token"
secret-mgr set --key git-access-token --username "$username" --secret "$token"
echo "Access token generated and stored successfully"

View File

@@ -4,12 +4,12 @@ set -euo pipefail
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
USERNAME=$(pass_mgr get-username --key git)
KC_PASS=$(pass_mgr get-secret --key keycloak)
GITEA_PASS=$(pass_mgr get-secret --key git)
USERNAME=$(secret-mgr get-username --key git)
KC_PASS=$(secret-mgr get-secret --key keycloak)
GITEA_PASS=$(secret-mgr get-secret --key git)
if [[ -z "$USERNAME" || -z "$KC_PASS" || -z "$GITEA_PASS" ]]; then
echo "[ERROR] Missing required credentials in pass_mgr" >&2
echo "[ERROR] Missing required credentials in secret-mgr" >&2
exit 1
fi

View File

@@ -39,12 +39,12 @@ if [[ "$roster" == "true" ]]; then
repo=".roster"
# Check if git-adm key exists
if ! pass_mgr list | grep -q "git-adm"; then
if ! secret-mgr list | grep -q "git-adm"; then
echo "you dont have permission to run this script"
exit 1
fi
token=$(pass_mgr get-secret --key git-adm)
token=$(secret-mgr get-secret --key git-adm)
else
# Check if repo and git-access-token are provided
if [[ -z "$repo" ]]; then
@@ -52,13 +52,13 @@ else
exit 1
fi
if ! pass_mgr list | grep -q "git-access-token"; then
if ! secret-mgr list | grep -q "git-access-token"; then
echo "generate your access token first"
exit 1
fi
owner=$(pass_mgr get-username --key git)
token=$(pass_mgr get-secret --key git-access-token)
owner=$(secret-mgr get-username --key git)
token=$(secret-mgr get-secret --key git-access-token)
fi
# Execute

View File

@@ -57,11 +57,11 @@ if ! is_git_repo "$REPO_PATH"; then
exit 1
fi
USER="$(pass_mgr get-username --key git)"
PASS="$(pass_mgr get-secret --key git)"
USER="$(secret-mgr get-username --key git)"
PASS="$(secret-mgr get-secret --key git)"
if [[ -z "$USER" || -z "$PASS" ]]; then
echo "Missing credentials from pass_mgr (key: git)"
echo "Missing credentials from secret-mgr (key: git)"
exit 2
fi

View File

@@ -3,15 +3,15 @@
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Get username from pass_mgr
username=$(pass_mgr get-username --key git)
# Get username from secret-mgr
username=$(secret-mgr get-username --key git)
if [[ -z "$username" ]]; then
echo "Error: No username found in pass_mgr for key 'git'"
echo "Error: No username found in secret-mgr for key 'git'"
exit 1
fi
# Generate new password
password=$(pass_mgr generate --key git --username "$username")
password=$(secret-mgr generate --key git --username "$username")
# Update password via gitea admin
"$SCRIPT_DIR/gitea" admin user change-password --username "$username" --password "$password" --must-change-password=false

View File

@@ -35,7 +35,7 @@ Set user firstName and lastName in Keycloak.
### Reset Password
Reset password for the current user (reads username from pass_mgr).
Reset password for the current user (reads username from secret-mgr).
```bash
{baseDir}/scripts/keycloak/kc-ctrl reset-password

View File

@@ -28,11 +28,11 @@ if [[ -z "$username" || -z "$email" ]]; then
fi
# Generate keycloak credentials (do not print secret)
pass_mgr generate --username "$username" --key keycloak >/dev/null
secret-mgr generate --username "$username" --key keycloak >/dev/null
# Get the generated username and password
user=$(pass_mgr get-username --key keycloak)
pass=$(pass_mgr get-secret --key keycloak)
user=$(secret-mgr get-username --key keycloak)
pass=$(secret-mgr get-secret --key keycloak)
realm="Hangman-Lab"

View File

@@ -3,17 +3,17 @@
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Get username from pass_mgr
username=$(pass_mgr get-username --key keycloak)
# Get username from secret-mgr
username=$(secret-mgr get-username --key keycloak)
if [[ -z "$username" ]]; then
echo "Error: No username found in pass_mgr for key 'keycloak'"
echo "Error: No username found in secret-mgr for key 'keycloak'"
exit 1
fi
realm="Hangman-Lab"
# Generate new password
password=$(pass_mgr generate --key keycloak --username "$username")
password=$(secret-mgr generate --key keycloak --username "$username")
# Update password via kcadm
"$SCRIPT_DIR/kcadm" set-password -r "$realm" --username "$username" --new-password "$password"

View File

@@ -19,13 +19,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Default to pass_mgr if not provided
# Default to secret-mgr if not provided
if [[ -z "$username" ]]; then
username=$(pass_mgr get-username --key keycloak)
username=$(secret-mgr get-username --key keycloak)
fi
if [[ -z "$username" ]]; then
echo "Error: No keycloak username found in pass_mgr"
echo "Error: No keycloak username found in secret-mgr"
exit 1
fi

View File

@@ -3,11 +3,11 @@
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Get username from pass_mgr
username=$(pass_mgr get-username --key keycloak)
# Get username from secret-mgr
username=$(secret-mgr get-username --key keycloak)
if [[ -z "$username" ]]; then
echo "Error: No keycloak username found in pass_mgr"
echo "Error: No keycloak username found in secret-mgr"
exit 1
fi