I've installed postgre on a CentOS server.
I basically followed this guide here: PostgreSQL
On the last step it says I need Open TCP port 5432 and to do so I need to add the following line to my /etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
restarting iptables yields an error on the new line, it seems it doesn't like the RH-Firewall-1-INPUT part. The problem is that, even if i STOP the iptables service the port 5432 seems to remain closed.
Any help will be appreciated.
Edit:
iptables -L -nv
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
2331 187K RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 2080 packets, 490K bytes)
pkts bytes target prot opt in out source destination
Chain RH-Firewall-1-INPUT (2 references)
pkts bytes target prot opt in out source destination
1 29 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0.4 * 0.0.0.0/0 0.0.0.0/0
2330 187K ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0.1 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0.2 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0.3 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth1 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 255
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT udp -- * * 0.0.0.0/0 224.0.0.251 udp dpt:5353
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:631
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5432
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:23
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:25
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:443
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
ps aux | grep postgre
postgres 20132 0.0 0.0 120692 3336 ? S 15:41 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data
postgres 20134 0.0 0.0 109872 704 ? S 15:41 0:00 postgres: logger process
postgres 20136 0.0 0.0 120692 980 ? S 15:41 0:00 postgres: writer process
postgres 20137 0.0 0.0 110872 700 ? S 15:41 0:00 postgres: stats buffer process
postgres 20138 0.0 0.0 110060 876 ? S 15:41 0:00 postgres: stats collector process
root 20299 0.0 0.0 61152 728 pts/0 S+ 16:08 0:00 grep postgre
EDIT 2: This is what happenes when I turn off iptables.
[maguirre@server ~]# /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
[maguirre@server ~]# iptables -L -nv
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Best Answer
Are you adding to
:RH-Firewall-1-INPUT - [0:0]
section? Could you also please post an error here?