0

我的问题是如何配置它,以便非管理员(非 postgres)帐户可以从 Internet 登录,但管理员(postgres)用户只能从本地主机或有限的 IP 范围内登录。中的哪些条目pg_hba.conf让我进行了设置?我已经在以下位置进行了设置postgresql.conf

listen_addresses = '*'

我还在我的行中添加了该行,pg_hba.conf以允许从广阔的世界登录:

host all all 0.0.0.0/0 md5

但是现在postgres用户可以从任何我不想要的地址登录:(

我看到很多地方都在谈论如何打开 PostgreSQL 以获取来自任何地址的连接,例如:https ://dba.stackexchange.com/questions/83984/connect-to-postgresql-server-fatal-no-pg- hba-conf-entry-for-host但没有任何问题可以打开它并锁定postgres用户。

4

1 回答 1

1

尝试:

# "local" is for Unix domain socket connections only
local   all             postgres                                trust
# IPv4 local connections:
host    all             postgres        0.0.0.0/0               reject 
host    all             all             0.0.0.0/0               md5 
于 2020-04-13T06:13:58.260 回答