Hello, I just wanted to verify that the only services that have open ports on my server are the web server and SSH server. So I ran netstat -anp and I don't understand some of the listings; I read the netstat man page but it doesn't really answer my questions. I will list my netstat output interleaved with my comments here, with some IP addresses changed to protect the innocent, and with the unix sockets stuff removed because I don't think it's relevent:
Code:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
This is my SSH server listening on port 22 for all the world to connect to.
Code:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
This is my postgres server listening only on the local IP address, not routable, for all the world to connect to. I believe that only my own server can connect internally to it because it is using the localhost IP address; but I wonder why the configuration is such that the port is open to anyone. Does this mean that if someone managed to tunnel over my SSH server that they could connect remotely to my postgres server? Would it make any difference to change my postgres configuration to only listen for connections from localhost?
Code:
tcp 0 48 AAA.BBB.CCC.DDD:22 WWW.XXX.YYY.ZZZ:21796 ESTABLISHED -
This is my current SSH connection to the server on which I ran netstat (IP addresses redacted).
Code:
tcp 0 0 :::80 :::* LISTEN -
This is my Apache web server listening on port 80 for the world to connect to. But I don't understand why it is listed in this form - I don't understand this form of address (three colons and then a port). Why isn't it listed like the SSH server as 0.0.0.0:80 with remote address 0.0.0.0:*? I don't understand this way of listing addresses or why it is different than the SSH case.
Code:
tcp 0 0 ::1:5432 :::* LISTEN -
This is my postgres server again, I believe; the port number is right. But I don't understand why it's listed again here. For what it's worth, I did try connecting to port 5432 from the outside and got 'connection refused' even though this line makes it look like postgres is listening to the world. I am confused.
Code:
udp 0 0 ::1:57034 ::1:57034 ESTABLISHED -
OK what the heck is this?