Skip to content

Commit

Permalink
Merge pull request #81 from wazuh/change/wazuh-packages-PR-2946
Browse files Browse the repository at this point in the history
Fixed API password change to match the user in wazuh.yml
  • Loading branch information
c-bordon authored Sep 27, 2024
2 parents 0e5b606 + fdc9cab commit a928365
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
5 changes: 3 additions & 2 deletions passwords_tool/passwordsFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]}"
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a928365

Please sign in to comment.