Checks / Network

Services listen on public addresses

Check
net.public_listeners
Severity
info
Runs
on the server, in the daily run of the agent
Looks at
TCP/UDP sockets on non-loopback addresses with the process name
Updated 26 Nov 2026

What the check looks at

The agent lists TCP and UDP sockets that listen on an address other than loopback (127.0.0.0/8 and ::1), with the port and the name of the process. 0.0.0.0 and :: mean "every address of the server". The check is information only: it gives you the list to review, and the service shows what changed since the last report.

Why it matters

Every listening socket on a public address is reachable from the internet unless a firewall drops the traffic. SSH, HTTP and HTTPS are meant to be reachable. Databases, caches, message queues, metrics endpoints and admin panels usually are not. Internet-wide scanners such as Shodan and Censys index open database and Redis ports, so an internal service on a public address gets found.

How to fix it

List the sockets first:

sudo ss -tulpn

-t and -u select TCP and UDP, -l listening sockets, -p the process (root needed), -n numbers instead of service names. Read the column Local Address:Port:

Local address Reachable from
127.0.0.1:5432, [::1]:5432 this server only
10.0.0.5:5432 (a private address) the private network
0.0.0.0:5432, *:5432, [::]:5432 every network the server is on, including the internet

For each service that should not be public, pick one fix:

  • Bind it to loopback in its configuration and restart it. PostgreSQL: listen_addresses = 'localhost' in postgresql.conf. MySQL and MariaDB: bind-address = 127.0.0.1. Redis: bind 127.0.0.1 -::1.
  • Bind it to the private interface when other servers in the same private network need it, and allow only their addresses in the firewall.
  • Docker containers: publish the port on loopback with -p 127.0.0.1:5432:5432 (or "127.0.0.1:5432:5432" in Compose). A port published on 0.0.0.0 is not filtered by ufw rules; see Docker bypasses ufw.
  • Stop the service if nothing uses it: sudo systemctl disable --now <service> (Debian, Ubuntu, RHEL, Rocky, Alma) or sudo rc-update del <service> && sudo rc-service <service> stop (Alpine).

A firewall in front (see the firewall guide) is the second layer: when a package update or a configuration change puts a service back on 0.0.0.0, the firewall still drops the traffic.

How to check the fix

sudo ss -tlpn 'sport = :5432'

The local address should be 127.0.0.1 or the private address. From another machine outside the network, nc -vz <server-ip> 5432 should time out or be refused.

When a warning is fine

Services that are meant to be public stay on the list: sshd on port 22, the web server on 80 and 443, a VPN such as WireGuard (often UDP 51820), a mail server. A DHCP client listening on UDP port 68 is normal on servers that get their address by DHCP. Review the list once, and look again when it changes.

Sources