I have an AWS server running linux. When I do an netstat -lntp from the machine itself, it shows me a few ports open (as expected), but it does not show 445 or 139. This makes sense, since I have never setup samba on this machine. Furthermore, when I list the running processes and grep for smb or samba, it shows nothing running.
Looking at the firewall rules for the server, I see that it only allows inbound traffic on port 80 and 22. It allows outbound traffic on all ports to all destinations, but I don't think this is relevant.
The problem is that when I do an nmap from outside the network, it shows that port 139 and 445 are closed. Why is that? My understanding is that 'closed' means the firewall is letting the packets through to the server, but there is nothing listening on the port. Why is the firewall letting the traffic through?