Centos iptables configuration for Wordpress and Gmail smtp
Posted
by
Fabrizio
on Server Fault
See other posts from Server Fault
or by Fabrizio
Published on 2014-06-01T10:47:35Z
Indexed on
2014/06/02
9:31 UTC
Read the original article
Hit count: 261
Let me start off by saying that I'm a Centos newby, so all info, links and suggestions are very welcome!
I recently set up a hosted server with Centos 6 and configured it as a webserver. The websites running on it are nothing special, just some low traffic projects. I tried to configure the server as default as possible, but I like it to be secure as well (no ftp, custom ssh port).
Getting my Wordpress to run as desired, I'm running into some connection problems. 2 things are not working:
- installing plugins and updates through ssh2 (failed to connect to localhost:sshportnumber)
- sending emails from my site using the Gmail smtp (Failed to connect to server: Permission denied (13))
I have the feeling that these are both related to the iptables configuration, because I've tried everything else (I think). I tried opening up the firewall to accept traffic for ports 465 (gmail smtp) and ssh port (lets say this port is 8000), but both the issues remain. Ssh connections from the terminal are working fine though. After each change I tried implementing I restarted the iptables service.
This is my iptables configuration (using vim):
# Generated by iptables-save v1.4.7 on Sun Jun 1 13:20:20 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 465 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 465 -j ACCEPT
COMMIT
# Completed on Sun Jun 1 13:20:20 2014
Are there any (obvious) issues with my iptables setup considering the above mentioned issues? Saying that the firewall is doing exactly nothing in this state is also an answer...
And again, if you have any other suggestions for me to increase security (considering the basic things I do with this box), I would love hear it, also the obvious ones!
Thanks!
© Server Fault or respective owner