Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset-pass with freshly generated pass #34

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions actions/reset-pass.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
set -e

SUPERUSER_ACCOUNT_ID=$(sqlite3 ./data/database.sqlite3 'select super_user from settings;')
DEFAULT_PASS=$(cat /app/data/start9/admin_password.txt)
ADMIN_PASS=$(cat /dev/urandom | base64 | head -c 24)
echo "$ADMIN_PASS" > /app/data/start9/admin_password.txt
CURRENT_DATETIME=$(date +%s)
PASS_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('$DEFAULT_PASS'.encode('utf-8'), bcrypt.gensalt()).decode('utf-8'))")
PASS_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('$ADMIN_PASS'.encode('utf-8'), bcrypt.gensalt()).decode('utf-8'))")

sqlite3 ./data/database.sqlite3 <<EOF
UPDATE accounts
Expand All @@ -17,7 +18,7 @@ EOF

action_result_complete=" {
\"version\": \"0\",
\"message\": \"Superuser Password has been reset to the default password. You can find this password within Properties.\",
\"message\": \"Superuser Password has been reset to a newly generated random password available in Properties.\",
\"value\": null,
\"copyable\": false,
\"qr\": false
Expand Down
3 changes: 1 addition & 2 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ configurator() {
SUPERUSER_ACCOUNT=$(sqlite3 ./data/database.sqlite3 'select super_user from settings;')
SUPERUSER_ACCOUNT_URL_PROP="https://$LAN_ADDRESS/wallet?usr=$SUPERUSER_ACCOUNT"
SUPERUSER_ACCOUNT_URL_TOR="http://$TOR_ADDRESS/wallet?usr=$SUPERUSER_ACCOUNT"
ADMIN_PASS=$(cat /app/data/start9/admin_password.txt)
LNBITS_SETTINGS=$(sqlite3 ./data/database.sqlite3 'select editable_settings from settings;')
PUBLIC_UI=$(echo "$LNBITS_SETTINGS" | jq ".lnbits_public_node_ui")

Expand Down Expand Up @@ -222,8 +223,6 @@ EOF
tini -s 2>/dev/null
fi

ADMIN_PASS=$(cat /app/data/start9/admin_password.txt)

configurator &

# Set up a signal trap and wait for processes to finish
Expand Down
6 changes: 3 additions & 3 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: lnbits
title: "LNBits"
version: 0.12.2
version: 0.12.2.1
release-notes: |
* Update upstream to 0.12.2 - Full release notes available [here](https://github.com/lnbits/lnbits/releases/tag/0.12.2).
* Create and save default Superuser username and password in Properties
Expand Down Expand Up @@ -132,8 +132,8 @@ migrations:
args: ["to"]
actions:
reset-pass:
name: "Restore Default Superuser Password"
description: "Resets the Superuser password to the default password in Properties."
name: "Reset Superuser Password"
description: "Resets a forgotten or compromised Superuser password to a freshly generated random password available in Properties."
warning: ~
allowed-statuses:
- running
Expand Down
2 changes: 1 addition & 1 deletion scripts/services/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export const migration: T.ExpectedExports.migration = compat.migrations
),
},
},
"0.12.2",
"0.12.2.1",
);
Loading