Wednesday, May 3, 2017

CentOS server refusing all connections except for ssh telnet and http





For some reason my CentOS VPS refuses all connections except for HTTP, SSH and Telnet. Whenever I try to connect to a port such as 25 (SMTP) or even a random port such as 225 I get a connection refused error :S
netstat -ap shows that the server is listening and iptables is turned off.



However I can interface with the same ports on the server through telnet...



# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

# netstat -an | fgrep LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:225 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 :::80 :::* LISTEN

unix 2 [ ACC ] STREAM LISTENING 169786017 /tmp/.font-unix/fs7100
unix 2 [ ACC ] STREAM LISTENING 169786045 /var/run/saslauthd/mux


This is the error message i'm getting from my php script. My PHP script works fine with every other SMTP server I've come across
Warning: fsockopen() [function.fsockopen]: unable to connect to :25 (Connection refused)


Answer



It looks like there is something upstream of your VPS that is blocking access except for the ports noted. You should contact your VPS provider and ask them about it.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...