= Help needed to setup postgres on VPS =

![ ](httpswww.redditstatic.com/desktop2x/img/renderTimingPixel.png)

Hello together! I am currently setting up a postgres server on a VPS. The postgres server is running in a docker container. For security reasons I want to access the db only via ssh tunnel. I was able to set up the ssh tunnel, but I have no clue how to disallow connection from the outside world. Obviously the port 5432 is forwarded to the internet. Normal user/password authentication works. Where do I have to block the connections. Is it in the pg_hba.conf, or some docker configuration, or on server level (something like iptable)? I haven't found a tutorial wich handle this specific configuration.

Thank you in adavance!

Usually it’s not a good idea to have postgres externally accessible on port 5432.

By default postgres conf file will bind to localhost interface.

If you only want the db sever accessible internally on the host then you should just not have port 5432 externally accessible on the vps

I assume you are exposing 5432 from the container to a port on the vps host? That does not need to externally accessible.

== About Community ==

Members

Online