Compare commits

..

2 Commits

Author SHA1 Message Date
tteckster cfa1b2e04d
Update vaultwarden.sh
tweak
2024-07-17 13:48:42 -04:00
tteckster 9deea7a983
Update vaultwarden.sh
add Admin Token to `/opt/vaultwarden/data/config.json`
2024-07-17 13:32:26 -04:00
1 changed files with 3 additions and 0 deletions

View File

@ -128,6 +128,9 @@ function update_script() {
if ! command -v argon2 >/dev/null 2>&1; then apt-get install -y argon2 &>/dev/null; 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) 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 sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" /opt/vaultwarden/.env
if [[ -f /opt/vaultwarden/data/config.json ]]; then
sed -i "s|\"admin_token\":.*|\"admin_token\": \"${TOKEN}\"|" /opt/vaultwarden/data/config.json
fi
systemctl restart vaultwarden systemctl restart vaultwarden
fi fi
exit exit