By markusin77
I am trying to access to postgresql remotly using psql. Can it be that a firewall is blocking postgresql default port 5432 ?
I did the following modification in pg_hba.conf
host all all 80.240.129.47/24 trust
and allowed everyone to listen in postgresql.conf
listen_addresses='*'
I do not know, what still is missing to make in run?
When starting nmap from a different host the port of postgres is not shown.
any idea??
Markus
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you have listen_addresses='*' and nmap doesn’t show port 5432, it is very likely that your firewall is blocking the port. Have you set up any IP table rules?
Is the IP address 80.240.129.47 the IP of your server or the IP of the machine connecting to it? It should be the address of the client that will connect to the server. Check out the pg_hba.conf docs.
Hi, thanks for your quick response
I assume this. I set up the following rule:
sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere 80.240.129.47 tcp spts:1024:65535 dpt:postgresql state NEW,ESTABLISHED
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 80.240.129.47 anywhere tcp spt:postgresql dpts:1024:65535 state ESTABLISHED
I hope this is correct.
kind regards
Markus
wait Andrew I got it. it was wrongly set in my pg_hba.conf. 80.240.129.47 is the host of the server and not of the client. My mistake and sorry for bothering.
Markus
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.