From 9deea7a9830bb1457c1f051ca5f1e7c7d6d127e7 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 17 Jul 2024 13:32:26 -0400 Subject: [PATCH] Update vaultwarden.sh add Admin Token to `/opt/vaultwarden/data/config.json` --- ct/vaultwarden.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ct/vaultwarden.sh b/ct/vaultwarden.sh index b5cb6fa5..413cd5fa 100644 --- a/ct/vaultwarden.sh +++ b/ct/vaultwarden.sh @@ -127,7 +127,9 @@ function update_script() { if [[ -z "$NEWTOKEN" ]]; then exit; fi if ! command -v argon2 >/dev/null 2>&1; then apt-get install -y argon2 &>/dev/null; fi TOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -t 2 -m 16 -p 4 -l 64 -e) - sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" /opt/vaultwarden/.env + for file in /opt/vaultwarden/.env /opt/vaultwarden/data/config.json; do + sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" "$file" + done systemctl restart vaultwarden fi exit