From 0d619d4780cafebacd663a37dd560b428ce5871b Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Thu, 5 Feb 2026 13:10:18 +0100 Subject: [PATCH] feat(domoticz): Add password reset via RPCD New RPCD method: reset_password - Resets Domoticz admin password via SQLite - Accessible from LuCI dashboard - MD5 hashes the password before storing Co-Authored-By: Claude Opus 4.5 --- .../root/usr/libexec/rpcd/luci.domoticz | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/package/secubox/luci-app-domoticz/root/usr/libexec/rpcd/luci.domoticz b/package/secubox/luci-app-domoticz/root/usr/libexec/rpcd/luci.domoticz index 428ce6bf..d4b7f9b5 100644 --- a/package/secubox/luci-app-domoticz/root/usr/libexec/rpcd/luci.domoticz +++ b/package/secubox/luci-app-domoticz/root/usr/libexec/rpcd/luci.domoticz @@ -19,7 +19,7 @@ lxc_exists() { case "$1" in list) - echo '{"status":{},"start":{},"stop":{},"restart":{},"install":{},"uninstall":{},"update":{},"configure_mqtt":{},"configure_haproxy":{},"backup":{},"restore":{"path":"str"},"logs":{"lines":"int"}}' + echo '{"status":{},"start":{},"stop":{},"restart":{},"install":{},"uninstall":{},"update":{},"configure_mqtt":{},"configure_haproxy":{},"backup":{},"restore":{"path":"str"},"logs":{"lines":"int"},"reset_password":{"password":"str"}}' ;; call) case "$2" in @@ -251,6 +251,35 @@ case "$1" in json_add_string "logs" "$logs" json_dump ;; + + reset_password) + read -r input + password=$(echo "$input" | jsonfilter -e '@.password' 2>/dev/null) + [ -z "$password" ] && password="password" + + # MD5 hash the password + md5hash=$(echo -n "$password" | md5sum | cut -d' ' -f1) + + # Update in Domoticz database (username is base64 encoded 'admin') + if lxc_running; then + lxc-attach -n "$LXC_NAME" -- sqlite3 /opt/domoticz/db/domoticz.db \ + "UPDATE Users SET Password='$md5hash' WHERE Username='YWRtaW4=';" 2>/dev/null + code=$? + else + echo '{"success":false,"error":"Container not running"}' + exit 0 + fi + + json_init + if [ "$code" = "0" ]; then + json_add_boolean "success" 1 + json_add_string "message" "Password reset successfully" + else + json_add_boolean "success" 0 + json_add_string "error" "Failed to reset password" + fi + json_dump + ;; esac ;; esac