I want to create environment that allows the limited number of machines connect to my database server.
For debugging needs all IP address have the remote access to PostgreSQL server
listen_addresses = '*' host all all 0.0.0.0/0 md5
I want to limit access. What is the canonical way to do that?
I though of using proxy server to connect from local machines to PostgreSQL server, but I’ll appreciate other ideas.
Just change pg_hba.conf from
host all all 0.0.0.0/0 md5
to rules you need. Columns are :
type (leave host),
For example, if you need to allow only 188.8.131.52 and 184.108.40.206 to connect any database using any username:
host all all 220.127.116.11/32 md5 host all all 18.104.22.168/32 md5 host all all 0.0.0.0/0 reject
service postgresql reload
(or smt like that, depending on your system) to apply changes.