Please log in or register to answer this question.

2 Answers

1 like 0 dislike
answered by (1.1k points)  

Change the host-based authentication (HBA) file to refuse all incoming
connections, and then reload the server:
Create a new file named pg_hba_lockdown.conf, and add the
following two lines to the file. This puts in place rules that will
completely lock down the server, including super users. You
should have no doubt that this is a serious and drastic action:

# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all reject
host all all 0.0.0.0/0 reject

If you still want super user access, then try something like the following:

# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all postgres peer
local all all reject
host all all 0.0.0.0/0 reject
0 like 0 dislike
answered by (1.1k points)  
edited by

In pg_hba.con file

Host all all range_of_the_ip reject

or

Set connection limit to zero

Or else

Restrict the connections for a specific database to zero, by setting the connection

limit to zero.

ALTER DATABASE foo_db CONNECTION LIMIT 0;

--That is for individual database

Related questions

0 like 0 dislike
0 answers
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
...