wazuh / wazuh-cloudformation

Wazuh - Amazon AWS Cloudformation
https://wazuh.com
39 stars 22 forks source link

Add unattended installation #83

Closed sergiogp98 closed 1 year ago

sergiogp98 commented 3 years ago

Hi team,

This issue try to add to types of environments following this two unattended installation methods described in the documentation:

One node with:

Distributed

Five nodes:

SG

sergiogp98 commented 3 years ago

Update

All-in-one

image

Image: functional all-in-one installation

Distributed

sergiogp98 commented 3 years ago

Update

Distributed

  1. Permission denied: privilege 443 port is not linked to Kibana socket
  2. chown: cannot access '/usr/share/kibana/optimize': No such file or directory

image

sergiogp98 commented 3 years ago

Update

eval "setcap cap_net_bind_service=+ep /usr/share/kibana/node/bin/node"
if [ "$?" != 0 ]; then 
    echo "Error: setcap 443 port"
else
    echo "Success: setcap 443 port"
fi

image

sergiogp98 commented 3 years ago

Update

Description: check installation process in distributed environment

image

image

image

[root@ip-10-0-1-101 ~]# curl -XGET https://10.0.1.101:9200/_cluster/health?pretty -k -u admin:admin
{
  "cluster_name" : "elastic_cluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 6,
  "active_shards" : 13,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}
sergiogp98 commented 3 years ago

Update

  1. Add _initializekibana.sh script to force link 443 port to kibana socket:
#!/bin/bash

echo "Linking 443 port to Kibana socket..."
setcap 'cap_net_bind_service=+ep' /usr/share/kibana/node/bin/node
echo "Starting kibana service..."
systemctl daemon-reload
systemctl enable kibana.service
systemctl restart kibana.service
echo "Initializing Kibana (this may take a while)"
until [[ "$(curl -XGET https://{{kibana_ip}}/status -I -uadmin:admin -k -s --max-time 300 | grep "200 OK")" ]]; do
    sleep 10
done
conf="$(awk '{sub("url: https://localhost", "url: https://{{wazuh_master_ip}}")}1' /usr/share/kibana/data/wazuh/config/wazuh.yml)"
echo "${conf}" > /usr/share/kibana/data/wazuh/config/wazuh.yml  
echo "You can access the web interface https://{{kibana_ip}}. The credentials are admin:admin"  

Varialbes between {} are formatted as as Mustache templates (see documentation) with variables declared in template.yml

  1. Bump to Wazuh v4.1.1