wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
104 stars 94 forks source link

ERROR: Port 443 is being used by another process... #2888

Closed wq9 closed 6 months ago

wq9 commented 6 months ago
Wazuh version Install type Action performed Platform
4.7.3 Wazuh installation assistant Install Debian 10

I install Dashboard using the installation assistant to port 8444 and get the following error:

bash wazuh-install.sh --wazuh-dashboard seedbox --port 8444 -i
22/03/2024 00:14:52 INFO: Starting Wazuh installation assistant. Wazuh version: 4.7.3
22/03/2024 00:14:52 INFO: Verbose logging redirected to /var/log/wazuh-install.log
22/03/2024 00:15:05 WARNING: Hardware and system checks ignored.
22/03/2024 00:15:06 INFO: Wazuh web interface port will be 8444.
22/03/2024 00:15:06 ERROR: Port 443 is being used by another process. Please, check it before installing Wazuh.
22/03/2024 00:15:06 INFO: The installation can not continue due to port usage by other processes.
22/03/2024 00:15:06 INFO: --- Removing existing Wazuh installation ---
22/03/2024 00:15:06 INFO: Wazuh GPG key not found in the system
22/03/2024 00:15:08 INFO: Installation cleaned. Check the /var/log/wazuh-install.log file to learn more about the issue.

Port 443 is used by nginx and I need it. Port 8444 is unused.

Why is it checking for port 443 when I already specify port to be 8444?

rauldpm commented 6 months ago

Hello @wq9, indeed, I have been able to reproduce it, and below I show the cause and solution:

root@debian10:/home/vagrant# netstat -tuln | grep 44
tcp        0      0 192.168.56.43:443       0.0.0.0:*               LISTEN     
root@debian10:/home/vagrant# bash wazuh-install.sh --wazuh-dashboard dashboard -i
26/03/2024 20:33:27 INFO: Starting Wazuh installation assistant. Wazuh version: 4.7.3
26/03/2024 20:33:27 INFO: Verbose logging redirected to /var/log/wazuh-install.log
26/03/2024 20:33:29 WARNING: Hardware and system checks ignored.
26/03/2024 20:33:29 INFO: Wazuh web interface port will be 443.
26/03/2024 20:33:30 ERROR: Port 443 is being used by another process. Please, check it before installing Wazuh.
26/03/2024 20:33:30 INFO: The installation can not continue due to port usage by other processes.
26/03/2024 20:33:30 INFO: --- Removing existing Wazuh installation ---
26/03/2024 20:33:30 INFO: Installation cleaned. Check the /var/log/wazuh-install.log file to learn more about the issue.
root@debian10:/home/vagrant# netstat -tuln | grep 8444
root@debian10:/home/vagrant# bash wazuh-install.sh --wazuh-dashboard dashboard -i --port 8444
26/03/2024 20:33:55 INFO: Starting Wazuh installation assistant. Wazuh version: 4.7.3
26/03/2024 20:33:55 INFO: Verbose logging redirected to /var/log/wazuh-install.log
26/03/2024 20:33:58 WARNING: Hardware and system checks ignored.
26/03/2024 20:33:58 INFO: Wazuh web interface port will be 8444.
26/03/2024 20:33:58 ERROR: Port 443 is being used by another process. Please, check it before installing Wazuh.
26/03/2024 20:33:58 INFO: The installation can not continue due to port usage by other processes.
26/03/2024 20:33:58 INFO: --- Removing existing Wazuh installation ---
26/03/2024 20:33:58 INFO: Wazuh GPG key not found in the system
26/03/2024 20:33:58 INFO: Installation cleaned. Check the /var/log/wazuh-install.log file to learn more about the issue.

The port that is passed as a parameter is assigned to this variable:

https://github.com/wazuh/wazuh-packages/blob/b90e03f731178c6e24c76d83484e23404af3f299/unattended_installer/install_functions/dashboard.sh#L13

But this variable is not being used anywhere, since the check is done at:

https://github.com/wazuh/wazuh-packages/blob/b90e03f731178c6e24c76d83484e23404af3f299/unattended_installer/install_functions/installMain.sh#L268

As you can see, the variable that contains the ports is not the same, the latter being the correct one wazuh_dashboard_port, which is initialized with 443

I'm going to assign the issue to the @wazuh/devel-devops team so they can fix this behavior. In the meantime, you can modify the script to change the following line:

wazuh_dashboard_ports=( "${http_port}" )

to:

wazuh_dashboard_port=( "${http_port}" )

After this, the installation should be functional.

root@debian10:/home/vagrant# bash wazuh-install.sh --wazuh-dashboard dashboard -i --port 8444
26/03/2024 20:46:18 INFO: Starting Wazuh installation assistant. Wazuh version: 4.7.3
26/03/2024 20:46:18 INFO: Verbose logging redirected to /var/log/wazuh-install.log
26/03/2024 20:46:21 WARNING: Hardware and system checks ignored.
26/03/2024 20:46:21 INFO: Wazuh web interface port will be 8444.
26/03/2024 20:46:28 INFO: Wazuh repository added.
26/03/2024 20:46:28 INFO: --- Wazuh dashboard ----
26/03/2024 20:46:28 INFO: Starting Wazuh dashboard installation.
26/03/2024 20:46:52 INFO: Wazuh dashboard installation finished.
26/03/2024 20:46:52 INFO: Wazuh dashboard post-install configuration finished.
26/03/2024 20:46:52 INFO: Starting service wazuh-dashboard.
26/03/2024 20:46:53 INFO: wazuh-dashboard service started.
26/03/2024 20:47:04 INFO: Initializing Wazuh dashboard web application.
26/03/2024 20:47:05 INFO: Wazuh dashboard web application initialized.
26/03/2024 20:47:05 INFO: --- Summary ---
26/03/2024 20:47:05 INFO: You can access the web interface https://192.168.56.43:8444
    User: admin
    Password: y.mwe7JBxwwqPyJ?X0InnUnt1jzM6eLG
26/03/2024 20:47:05 INFO: Installation finished.
root@debian10:/home/vagrant# netstat -tuln | grep 8444
tcp        0      0 192.168.56.43:8444      0.0.0.0:*               LISTEN
teddytpc1 commented 6 months ago

Update

The change has been made and here are the results:

Debian 11

Ubuntu