diff --git a/CHANGELOG.md b/CHANGELOG.md index 299a556..6c6b504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. ### Changed -- None +- Fixed API password change to match the user in wazuh.yml. ([#81](https://github.com/wazuh/wazuh-installation-assistant/pull/81)) ## [4.10.0] diff --git a/passwords_tool/passwordsFunctions.sh b/passwords_tool/passwordsFunctions.sh index 2316640..b1c884f 100644 --- a/passwords_tool/passwordsFunctions.sh +++ b/passwords_tool/passwordsFunctions.sh @@ -85,6 +85,7 @@ function passwords_changePassword() { function passwords_changePasswordApi() { #Change API password tool if [ -n "${changeall}" ]; then + wazuh_yml_user=$(awk '/- default:/ {found=1} found && /username:/ {print $2}' /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml) for i in "${!api_passwords[@]}"; do if [ -n "${wazuh_installed}" ]; then passwords_getApiUserId "${api_users[i]}" @@ -99,7 +100,7 @@ function passwords_changePasswordApi() { common_logger -nl $"The password for Wazuh API user ${api_users[i]} is ${api_passwords[i]}" fi fi - if [ "${api_users[i]}" == "wazuh-wui" ] && [ -n "${dashboard_installed}" ]; then + if [ "${api_users[i]}" == "${wazuh_yml_user}" ] && [ -n "${dashboard_installed}" ]; then passwords_changeDashboardApiPassword "${api_passwords[i]}" fi done @@ -112,7 +113,7 @@ function passwords_changePasswordApi() { common_logger -nl $"The password for Wazuh API user ${nuser} is ${password}" fi fi - if [ "${nuser}" == "wazuh-wui" ] && [ -n "${dashboard_installed}" ]; then + if [ "${nuser}" == "${wazuh_yml_user}" ] && [ -n "${dashboard_installed}" ]; then passwords_changeDashboardApiPassword "${password}" fi fi