Skip to content

Commit

Permalink
Merge pull request #2808 from wazuh/change/2794-fix-indexer-configura…
Browse files Browse the repository at this point in the history
…tion

Fixed VD-indexer configuration in AIO deployment
  • Loading branch information
teddytpc1 authored Feb 2, 2024
2 parents 6a954de + 4059ebb commit 4b91cef
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions unattended_installer/install_functions/manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,18 @@ 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}"
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
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
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
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}"
Expand Down

0 comments on commit 4b91cef

Please sign in to comment.