Exposing Postgres port externally
Can anyone assist with the exposure of the postgress database port to external connection. I have the following configured but it is not working.
--------------pg_hba.conf----------------------------
local all all md5
host all all {MYMACHINESIPADDRES}/32 trust
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
host all all 0.0.0.0/0 password
------IPTABLES------
-A INPUT -p tcp -m tcp --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 5432 -m state --state ESTABLISHED -j ACCEPT
Responses
Did you look at the manual for pg_hba.conf?
The important bit;
Note: Remote TCP/IP connections will not be possible unless the server is started with an appropriate value for the listen_addresses configuration parameter, since the default behavior is to listen for TCP/IP connections only on the local loopback address localhost.
You can see if it is bound to 0.0.0.0/24 vs. 127.0.0.1 with netstat
%> netstat -anp | grep 5432
Everything looks like it should be working. Can you disable your iptables rules and verify? Process of eliminiation.
I suspect it is because you are using '-A' to add your iptables rules which will add the rules to the end of the chain, which is likely to be after a drop rule that matches the same traffic (eg. a drop all / log rule).
Try adding your iptables rules with '-I' as this will insert them at the top of the chain.
If that still fails, can you provide the output of
iptables -L -v -n
PixelDrift.NET Support is correct;
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5432 state NEW,ESTABLISHED
Is directly following
51720 5489K REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Everything is getting dropped before it gets to your incoming rule for postgres.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
