The shop server goes on the internet soon. From outside it should show two entrances: SSH for the administrator and the site on port 80. Look at the server the way anyone on the network will see it.
The outside machine here is a network namespace, lab-outside, with the address 192.0.2.20; to it the server is 192.0.2.1. Its commands start with sudo ip netns exec lab-outside. The port scanner nmap tries to connect to the thousand most common ports and prints the open ones.
Scan the server from outside
From the outside machine, scan the server 192.0.2.1, then request the page on its port 8080.
First, predict
Only SSH (22) and the site (80) should be visible from outside. Which open ports will the scanner find?
Now start the exercise, run the command and compare your prediction with the output.
The scanner found 5432 and 8080 open, and the admin panel gave its page to the outside machine. What do you know for sure from this?
-
nmap only tries to connect. On 5432 and 8080 the server answered, and on the other 996 ports it refused:
closed. -
There are no rules on the server:
sudo nft list rulesetprints nothing. The ports are open because programs listen on them. -
An open port means connections are accepted. Logging in to the database still goes through the password and
pg_hba.conf, and the scanner only connected and left.
Programs listen on ports 5432 and 8080, and they accept connections from the network.