Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSkYa-00061x-Jm for pgsql-general@arkaria.postgresql.org; Sat, 03 Apr 2021 17:59:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lSkYZ-0006Hg-Ir for pgsql-general@arkaria.postgresql.org; Sat, 03 Apr 2021 17:59:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSSsJ-0000Yq-KV for pgsql-general@lists.postgresql.org; Fri, 02 Apr 2021 23:06:47 +0000 Received: from mr85p00im-ztdg06011801.me.com ([17.58.23.199]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSSsG-000191-Tc for pgsql-general@postgresql.org; Fri, 02 Apr 2021 23:06:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1617404803; bh=O8v2Bv5NR9A/tngnPdRVp5eHrejTFFoI7VZ3terMo5Y=; h=From:Content-Type:Mime-Version:Subject:Message-Id:Date:To; b=ojqGreeKxJY/ozlBt/jrr5/26cNeBq8EMhuO0HjU+L34YyV8A8Cqz+ynfM5avCF+h ttk59Cvp3+8mUlaDCaSOKhf8U9rfBXmnbcgVy2/k0r+/tYF452RJKAEW4XLfgBUWJq iI929TrdFc7hlPvdKpI4gtdkyKs/gR4JzOaT6SO0FeI7cRr4QG+CXXXrEpUQe0OmaH 49IKkINZ9j25I+aRuZGbwkdvRaJ/t+4S7/w7pWP+z88Qy45Rr5Qo0nIgBu+vrSu3bd WqqhBJtzOOerxI9C8b134LoXlVf8EwbpR3jhvYLYnfHgVH7QXZAY3fWo8t3v014J/J WpwJocCfxSW3g== Received: from [17.11.94.60] (unknown [17.11.94.60]) by mr85p00im-ztdg06011801.me.com (Postfix) with ESMTPSA id 025DBC146F for ; Fri, 2 Apr 2021 23:06:42 +0000 (UTC) From: "A. Reichstadt" Content-Type: multipart/alternative; boundary="Apple-Mail=_38D77F60-E824-49C5-B5B1-9FCD7E8DA939" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: How to deny access to Postgres when connected from host/non-local Message-Id: <7CFC6367-B1D5-4FEF-9578-825A07D9AF81@me.com> Date: Fri, 2 Apr 2021 16:06:41 -0700 To: pgsql-general@postgresql.org X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-02_15:2021-04-01,2021-04-02 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=742 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2104020155 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_38D77F60-E824-49C5-B5B1-9FCD7E8DA939 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello, I try to deny access to all databases on my server if the user = =E2=80=9Cpostgres" tries to connect from a non-local host. Here is what = I did in pg_hba.conf: # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. local replication all md5 host replication all 127.0.0.1/32 md5 host replication all ::1/128 md5 host all all 0.0.0.0/0 md5 local all postgres trust host all postgres 0.0.0.0/0 reject But it continues to allow for Postgres to connect from anywhere through = PGAdmin but also as a direct connection to port 5432. I also relaunched = the server. This is version 12. What else do I have to do? Thanks for any help. Cheers, Alex= --Apple-Mail=_38D77F60-E824-49C5-B5B1-9FCD7E8DA939 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello,

I = try to deny access to all databases on my server if the user = =E2=80=9Cpostgres" tries to connect from a non-local host. Here is what = I did in pg_hba.conf:


# TYPE  DATABASE    =     USER            ADDRESS =                 = METHOD

# = "local" is for Unix domain socket connections only
local =   all             all     =                     =             md5
# IPv4 = local connections:
host    all           =   all             127.0.0.1/32  =           md5
# IPv6 local = connections:
host    all           =   all             ::1/128   =               md5
# Allow = replication connections from localhost, by a user with = the
# = replication privilege.
local   replication     = all                   =                   = md5
host    replication     all     =         127.0.0.1/32        =     md5
host    replication     all     =         ::1/128           =       md5
host    all     =         all           =   0.0.0.0/0               = md5
local =   all             postgres  =                     =           trust
host    all     =         postgres        = 0.0.0.0/0               = reject


But it continues to = allow for Postgres to connect from anywhere through PGAdmin but also as = a direct connection to port 5432. I also relaunched the server. This is = version 12.

What= else do I have to do?

Thanks for any help.

Cheers,
Alex
= --Apple-Mail=_38D77F60-E824-49C5-B5B1-9FCD7E8DA939--