diff --git a/unattended_installer/install_functions/manager.sh b/unattended_installer/install_functions/manager.sh index 3d94272aed..f4514a57ef 100644 --- a/unattended_installer/install_functions/manager.sh +++ b/unattended_installer/install_functions/manager.sh @@ -46,22 +46,18 @@ function manager_configure(){ common_logger -d "Configuring Wazuh manager." - if [ -n "${AIO}" ]; then - eval "sed -i 's/.*<\/host>/https:\/\/localhost:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}" + if [ ${#indexer_node_names[@]} -eq 1 ]; then + eval "sed -i 's/.*<\/host>/https:\/\/${indexer_node_ips[0]}:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}" else - if [ ${#indexer_node_names[@]} -eq 1 ]; then - eval "sed -i 's/.*<\/host>/https:\/\/${indexer_node_ips[0]}:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}" - else - lstart=$(grep -n "" /var/ossec/etc/ossec.conf | cut -d : -f 1) - lend=$(grep -n "" /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>/https:\/\/${indexer_node_ips[0]}:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}" - else - eval "sed -i '//a\ https:\/\/${indexer_node_ips[$i]}:9200<\/host>' /var/ossec/etc/ossec.conf" - fi - done - fi + lstart=$(grep -n "" /var/ossec/etc/ossec.conf | cut -d : -f 1) + lend=$(grep -n "" /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>/https:\/\/${indexer_node_ips[0]}:9200<\/host>/g' /var/ossec/etc/ossec.conf ${debug}" + else + eval "sed -i '//a\ https:\/\/${indexer_node_ips[$i]}:9200<\/host>' /var/ossec/etc/ossec.conf" + fi + done 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}"