Hi team,
To launch tests that ensure the correct operation of the script in different operating systems, we need it to work in Docker.
While executing unattended_installation script I have found some issues:
health_check method not working as expeted:
Method:
## Health check
healthCheck() {
cores=$(cat /proc/cpuinfo | grep processor | wc -l)
ram_gb=$(free -m | awk '/^Mem:/{print $2}')
if [[ ${cores} < "2" ]] || [[ ${ram_gb} < "3700" ]]; then
echo "Your system does not meet the recommended minimum hardware requirements of 4Gb of RAM and 2 CPU cores. If you want to proceed with the installation use the -i option to ignore these requirements."
exit 1;
elif [[ -f /etc/elasticsearch/elasticsearch.yml ]] && [[ -f /etc/kibana/kibana.yml ]] && [[ -f /etc/filebeat/filebeat.yml ]]; then
echo "All the componets have already been installed."
exit 1;
else
echo "Starting the installation..."
fi
}
Execution in CentOS 6 container:
[root@8bf09bdfc2e9 ~]# bash all-in-one-installation.sh
Your system does not meet the recommended minimum hardware requirements of 4Gb of RAM and 2 CPU cores. If you want to proceed with the installation use the -i option to ignore these requirements.
[root@8bf09bdfc2e9 ~]# free -m | awk '/^Mem:/{print $2}'
31393
[root@8bf09bdfc2e9 ~]# cat /proc/cpuinfo | grep processor | wc -l
16
If we execute the script with -i option to ignore health check:
CentOS 8:
~ ❯ docker run -i -t --memory=6192MB --cpus=2 centos:8
[root@6db49b42eeb9 /]# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh- documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one- installation.sh -i
Health-check ignored.
Installing all necessary utilities for the installation...
Done
Adding the Wazuh repository...
Done
Installing the Wazuh manager...
Done
Wazuh-manager could not be started.
b4c617e60805:/ # curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i
Health-check ignored.
Installing all necessary utilities for the installation...
Done
Adding the Wazuh repository...
Done
Installing the Wazuh manager...
Done
Wazuh-manager could not be started.
b4c617e60805:/ # /etc/rc.d/init.d/wazuh-manager start
/etc/rc.d/init.d/wazuh-manager: line 16: /etc/init.d/functions: No such file or directory
Hi team, To launch tests that ensure the correct operation of the script in different operating systems, we need it to work in Docker.
While executing unattended_installation script I have found some issues:
health_check method not working as expeted:
Method:
Execution in CentOS 6 container:
If we execute the script with -i option to ignore health check:
[root@6db49b42eeb9 /]# /etc/init.d/wazuh-manager start Starting Wazuh: 2020/11/10 10:34:27 ossec-integratord: INFO: Remote integrations not configured. Clean exit. [FAILED]
[root@8bf09bdfc2e9 ~]# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh- documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one- installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... Done Adding the Wazuh repository... Done Installing the Wazuh manager... Done Wazuh-manager started Installing Open Distro for Elasticsearch... Error: Elasticsearch installation failed
root@6568fcb84647:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... JDK installation falied.
root@b9e6974087ac:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one- installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... Done Adding the Wazuh repository... (23) Failed writing body Done Installing the Wazuh manager... Error: Wazuh installation failed
root@ba8506beacc8:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation...
root@ba8506beacc8:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation...
[1]+ Stopped bash ~/all-in-one-installation.sh -i root@ba8506beacc8:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh- documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... JDK installation falied.
root@68a0af4c778c:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... Done Adding the Wazuh repository... (23) Failed writing body Done Installing the Wazuh manager... Error: Wazuh installation failed
root@01dcfd0665c4:/# curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... JDK installation falied.
b4c617e60805:/ # curl -so ~/all-in-one-installation.sh https://raw.githubusercontent.com/wazuh/wazuh-documentation/4.0/resources/open-distro/unattended-installation/all-in-one-installation.sh && bash ~/all-in-one-installation.sh -i Health-check ignored. Installing all necessary utilities for the installation... Done Adding the Wazuh repository... Done Installing the Wazuh manager... Done Wazuh-manager could not be started. b4c617e60805:/ # /etc/rc.d/init.d/wazuh-manager start /etc/rc.d/init.d/wazuh-manager: line 16: /etc/init.d/functions: No such file or directory
Thanks team.