Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5qoq-00FRCQ-4b for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2023 17:15:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r5qoo-00BE2S-Ny for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2023 17:15:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5qon-00BDzu-AQ for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2023 17:15:18 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5qoj-007oRO-8j for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2023 17:15:16 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 7942F3200B1F; Wed, 22 Nov 2023 12:15:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 22 Nov 2023 12:15:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1700673308; x=1700759708; bh=6fKvcQL36cBy2Q/Nw59LVGwcQ/Uq85QzF2S Bdtb3fLE=; b=ZQNq/uY64+A5/8gpg/XjJ/vlD8nhYP02bamEFkf/NerwvvbItS4 7Xxw2WO16vMr9kLBGnUXLmXGpfTjYuhUdD3LzCoa2VrW7al1syk11Uw6B90R/M5k eCGb/fHIh/1RCKM68lMx5OGx+kx/ixzoRO/ltmtCTNOxstSVJcWo/DDG22wS+a1a WXXZU1XMf1w2AB8ZU2gdwNWPifPf2uDAo8lteBg/HHlzh/CiIy6lqtTrzFG1mZgB 7ZSSTYAcLmf691xrtPcGr+dMSaBOUphkPq3F4JOezTxRBs5qvTRDStoZGrJvMIEA oLIBxKrN6teKbQFQcwSlmQKv+4I4jamui1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1700673308; x= 1700759708; bh=6fKvcQL36cBy2Q/Nw59LVGwcQ/Uq85QzF2SBdtb3fLE=; b=D /hpyFGgfJHe78schWq0wnhS/GY8DYKqF2dKDJFLjPTwk2RxwhBV46d3jAchzRqg2 qh3A8Jo74mo219qF5yIaJb/fahpAS/gpEi4CEFQVSu9xwz1BUT76L2PhNdjeK8ZN RLKE2Dy/uxXes6OBvJg/qHnDuCFR06LqroDz63Sa4Gb4esiWs6TgAI0rG24vJwPI 0rV3095hLsmW+9jXipgagQwq2l+XVKW4sySjmzl9yiKoQb6mJUX1gqzBUxXRoZtd jHZEQGsQvpibyO4L4qjoFh1j8mzrrEjUXSQuFdRF8w2Wv4EPqswmtwVklI60wfmy 8KwbASGcYQ9tzcEcUjiGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehuddgleejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeelgedtuedvgeffkeeukedvfedtveegkeeujefhgfef hefgtdeffeeufedvieetgfenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpd gtohhnfhdrrghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Nov 2023 12:15:08 -0500 (EST) Message-ID: Date: Wed, 22 Nov 2023 09:15:07 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: strange behavior of pg_hba.conf file Content-Language: en-US To: Atul Kumar , Ron Johnson , pgsql-general References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/22/23 09:03, Atul Kumar wrote: > The entries that I changed were to replace the md5 with scram-sha-256 > and remove unnecessary remote IPs. FYI from: https://www.postgresql.org/docs/current/auth-password.html md5 The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead. > > But it has nothing to do with connecting the server locally with "psql > -d postgres -U postgres -h localhost" The error: no pg_hba.conf entry for host "::1", user "postgres", database "postgres says it does and the error is correct as you do not have an IPv6 entry for localhost in pg_hba.conf. At least in the snippet you showed us. > > But when I try to connect it locally I get this error. So it is related When you say connect locally do you mean to localhost or to local(socket)? > to local connections only and when I pass the hostname or ip of the > server it works fine without any issue. > > > Regards. > -- Adrian Klaver adrian.klaver@aklaver.com