ND-0012 / LINUX OPERATIONS
Which Services Are Actually Reachable?
An inventory tells you which services are supposed to run. To check exposure, write down the destination IP, port, protocol, and client network you care about. A listening socket answers one question. A request from the intended client answers a different one. 1. See where the service is listening On the server, start with the […]
An inventory tells you which services are supposed to run. To check exposure, write down the destination IP, port, protocol, and client network you care about. A listening socket answers one question. A request from the intended client answers a different one.
1. See where the service is listening
On the server, start with the local socket table. The flags below select listening sockets, use numeric addresses and ports, and show TCP or UDP separately. Process ownership can require elevated privileges, and these commands only see the current network namespace.
ss -lnt
ss -lnu
sudo ss -lntp
A TCP service bound to 127.0.0.1 is local to that namespace. 0.0.0.0 means all local IPv4 addresses, not all networks; routing and filtering still matter. Review IPv6 separately, and verify the exact address your client uses. A proxy or container port mapping may put the real listener somewhere else. ss manual
2. Reproduce the difference without opening a network port
Use a disposable Linux machine. This exercise binds only to loopback and serves one disposable file. Do not substitute a public interface, change a firewall rule, or serve your working directory. If port 18080 is already in use, pick another unused unprivileged port. Python’s test HTTP server is not for production. Python http.server documentation
Terminal A: start the server in the foreground. Ctrl+C stops it. Exit the lab shell after the comparison to remove its temporary directory.
lab_dir=$(mktemp -d)
trap 'rm -rf -- "$lab_dir"' EXIT
printf "field-guide-ok\n" > "$lab_dir/check.txt"
python3 -m http.server 18080 --bind 127.0.0.1 --directory "$lab_dir"
Terminal B: check the listener, then request the same local file at two loopback addresses. The proxy exclusion keeps both requests on the machine.
ss -lnt 'sport = :18080'
curl --noproxy '*' --silent --show-error --fail --max-time 2 http://127.0.0.1:18080/check.txt
curl --noproxy '*' --silent --show-error --fail --max-time 2 http://127.0.0.2:18080/check.txt
Stop the server in Terminal A and repeat the server command with --bind 127.0.0.2. Rerun both requests. If the second bind is unavailable in your lab, stop rather than using a non-loopback address. curl option reference
3. Verify the path the operator cares about
On a network you administer, use one approved test client in the intended segment, one known service endpoint, and one non-mutating request. Record the client segment, destination address and family, protocol, time, and outcome. Run through the real DNS name and TLS path when those are part of the service. Test from another approved segment only when policy says that segment should see a different result.
A returned application response proves that specific client reached a responding endpoint. Check the response body and expected status before calling the app healthy. A refusal does not identify which device or rule caused it. A timeout does not prove a firewall dropped the request. For either failure, compare listener state, route and policy, then check logs or counters along the authorized path.
What we verified
On Debian 13 with Python 3.12.14, iproute2 6.15.0, and curl 8.14.1, the socket table showed only the chosen loopback address. A request to the matching address printed field-guide-ok and exited 0; the other address returned curl exit 7. Swapping the bind address reversed the results. We did not test a second machine, external exposure, UDP, IPv6, a proxy, or firewall attribution.