wazuh-packages icon indicating copy to clipboard operation
wazuh-packages copied to clipboard

Check ports function could avoid the installation although none of the required ports are used

Open alberpilot opened this issue 2 years ago • 0 comments

We noticed in a fresh Ubuntu 22.04 deployment a case where the unattended installer doesn't complete the installation.

Detected problem

The installation assistant output shows the following message: Port 443 is being used by another process. Please, check it before installing Wazuh.

Rationale

The command used to detect if a port is used or not contains a grep. If randomly, a PID of a process with opened port (detected by ss or lsof have the same PID of one required port, it will be detected. It's not too common, but it's possible.

root@ip-172-31-94-168:/home/ubuntu# ss -lntup | grep 443
udp   UNCONN 0      0           127.0.0.53%lo:53        0.0.0.0:*    users:(("systemd-resolve",pid=443,fd=13))
tcp   LISTEN 0      4096        127.0.0.53%lo:53        0.0.0.0:*    users:(("systemd-resolve",pid=443,fd=14))

Solution

We need to find an ss or lsof option/flag that filters only by used port, avoiding the grep use.

alberpilot avatar Sep 22 '22 16:09 alberpilot