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

Added support for Vulnerability detection in WIA #2777

Merged
merged 5 commits into from
Jan 18, 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
2 changes: 2 additions & 0 deletions unattended_installer/install_functions/installMain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ function main() {
if [ -n "${wazuh}" ]; then
common_logger "--- Wazuh server ---"
manager_install
manager_configure
if [ -n "${server_node_types[*]}" ]; then
manager_startCluster
fi
Expand All @@ -359,6 +360,7 @@ function main() {
indexer_initialize
common_logger "--- Wazuh server ---"
manager_install
manager_configure
installCommon_startService "wazuh-manager"
filebeat_install
filebeat_configure
Expand Down
28 changes: 27 additions & 1 deletion unattended_installer/install_functions/manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@ function manager_startCluster() {

}

function manager_configure(){

common_logger -d "Configuring Wazuh manager."

if [ -n "${AIO}" ]; then
eval "sed -i 's/<host>.*<\/host>/<host>https:\/\/localhost:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}"
else
if [ ${#indexer_node_names[@]} -eq 1 ]; then
eval "sed -i 's/<host>.*<\/host>/<host>https:\/\/${indexer_node_ips[0]}:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}"
else
lstart=$(grep -n "<hosts>" /var/ossec/etc/ossec.conf | cut -d : -f 1)
lend=$(grep -n "</hosts>" /var/ossec/etc/ossec.conf | cut -d : -f 1)
for i in "${!indexer_node_ips[@]}"; do
if [ $i -eq 0 ]; then
eval "sed -i 's/<host>.*<\/host>/<host>https:\/\/${indexer_node_ips[0]}:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}"
else
eval "sed -i '/<hosts>/a\ <host>https:\/\/${indexer_node_ips[$i]}:9200<\/host>' /var/ossec/etc/ossec.conf"
fi
done
fi
fi
eval "sed -i s/filebeat.pem/${server_node_names[0]}.pem/ /var/ossec/etc/ossec.conf ${debug}"
eval "sed -i s/filebeat-key.pem/${server_node_names[0]}-key.pem/ /var/ossec/etc/ossec.conf ${debug}"
common_logger "Wazuh manager vulnerability detection configuration finished."
}

function manager_install() {

common_logger "Starting the Wazuh manager installation."
Expand All @@ -51,7 +77,7 @@ function manager_install() {
elif [ "${sys_type}" == "apt-get" ]; then
installCommon_aptInstall "wazuh-manager" "${wazuh_version}-*"
fi

common_checkInstalled
if [ "$install_result" != 0 ] || [ -z "${wazuh_installed}" ]; then
common_logger -e "Wazuh installation failed."
Expand Down
10 changes: 6 additions & 4 deletions unattended_installer/passwords_tool/passwordsFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function passwords_changePassword() {
echo "${conf}" > /etc/filebeat/filebeat.yml
fi
passwords_restartService "filebeat"
eval "sed -i 's/<password>.*<\/password>/<password>${adminpass}<\/password>/g' /var/ossec/etc/ossec.conf ${debug}"
passwords_restartService "wazuh-manager"
fi
fi

Expand Down Expand Up @@ -587,19 +589,19 @@ function passwords_runSecurityAdmin() {

if [[ -n "${nuser}" ]] && [[ -n ${autopass} ]]; then
common_logger -nl "The password for user ${nuser} is ${password}"
common_logger -w "Password changed. Remember to update the password in the Wazuh dashboard and Filebeat nodes if necessary, and restart the services."
common_logger -w "Password changed. Remember to update the password in the Wazuh dashboard, Wazuh server, and Filebeat nodes if necessary, and restart the services."
fi

if [[ -n "${nuser}" ]] && [[ -z ${autopass} ]]; then
common_logger -w "Password changed. Remember to update the password in the Wazuh dashboard and Filebeat nodes if necessary, and restart the services."
common_logger -w "Password changed. Remember to update the password in the Wazuh dashboard, Wazuh server, and Filebeat nodes if necessary, and restart the services."
fi

if [ -n "${changeall}" ]; then
if [ -z "${AIO}" ] && [ -z "${indexer}" ] && [ -z "${dashboard}" ] && [ -z "${wazuh}" ] && [ -z "${start_indexer_cluster}" ]; then
for i in "${!users[@]}"; do
common_logger -nl "The password for user ${users[i]} is ${passwords[i]}"
done
common_logger -w "Wazuh indexer passwords changed. Remember to update the password in the Wazuh dashboard and Filebeat nodes if necessary, and restart the services."
common_logger -w "Wazuh indexer passwords changed. Remember to update the password in the Wazuh dashboard, Wazuh server, and Filebeat nodes if necessary, and restart the services."
else
common_logger -d "Passwords changed."
fi
Expand All @@ -608,7 +610,7 @@ function passwords_runSecurityAdmin() {
}

function passwords_updateInternalUsers() {

common_logger "Updating the internal users."
backup_datetime=$(date +"%Y%m%d_%H%M%S")
internal_users_backup_path="/etc/wazuh-indexer/internalusers-backup"
Expand Down
Loading