Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fPzi0-0004U9-OI for pgsql-general@arkaria.postgresql.org; Tue, 05 Jun 2018 00:20:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fPzhz-0008Al-JQ for pgsql-general@arkaria.postgresql.org; Tue, 05 Jun 2018 00:20:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fPzgV-0000dx-OH for pgsql-general@lists.postgresql.org; Tue, 05 Jun 2018 00:18:48 +0000 Received: from resqmta-ch2-07v.sys.comcast.net ([2001:558:fe21:29:69:252:207:39]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fPzgS-0004oz-5A for pgsql-general@postgresql.org; Tue, 05 Jun 2018 00:18:46 +0000 Received: from resomta-ch2-09v.sys.comcast.net ([69.252.207.105]) by resqmta-ch2-07v.sys.comcast.net with ESMTP id Px3efNlTPzvgzPzgPfSst4; Tue, 05 Jun 2018 00:18:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1528157921; bh=5GcG/NdsSxT2U4G/QPpucomcD6McYz2yklP+1xM53OI=; h=Received:Received:Subject:To:From:Message-ID:Date:MIME-Version: Content-Type; b=FsfSIJCPvGbTxidt8PxXPzbHnpAndL57Y2psEx9Wswc5NxR/tHb3j9WRXj7iWy8du W6NTIeVQeU3j6qrZ7pj+M6lSZtDUuGeQguyLKHBlG+HHVjv8nzvWdqwmevms6Qnz3z qFbfEn/XHhVFZYrVBIyDtZmastf42oBcavjDBzHM7dDxxAISup8d1fEfPf1/yZGdlL OuEHVM8nWZqRERP0TcjhR1lSAGU1SEltXa/E850yYgN4j/bNphICdU5P5vo1NtU7xo mOVya29x4TLzKisga4XHe/SrbhLoQr0dUHPpbYC+xOrbGKyETU6QxKwLOmehDJOSnM GPX2Y/hoBKZWA== Received: from [IPv6:2601:19c:4701:878e::4] ([IPv6:2601:19c:4701:878e::4]) by resomta-ch2-09v.sys.comcast.net with ESMTPSA id PzgOfYtqQJQD7PzgPfMoq5; Tue, 05 Jun 2018 00:18:41 +0000 Subject: Re: Pgagent is not reading pgpass file either in Windows or Linux. To: nageswara Bandla Cc: pgsql-general@postgresql.org References: <5595335e-32e8-80da-9c65-8d79fce554a7@aklaver.com> From: George Neuner Message-ID: Date: Mon, 4 Jun 2018 20:18:39 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------E4C705911485E04736C84E54" Content-Language: en-US X-CMAE-Envelope: MS4wfGWHu9SqgZSSdYQfE6W2VxHppidEOkfvevpRg/K2m+5iNQ9eMrcVqKr87Kg1jk9xGQZSVX7HIGUIfqB1oMGPaoYAqBgtmw5X7MczezXtDgiULj4ViPtR jQ5F3Fq4+rWO1jzFVRKXgIE4Km2mjvjm7LHt6ECqOrCSEFB8MpLFAwqanQKmQFb0xynUg/yWN5TwBkTrQxc0J3tv8/FzRwrsvwtNWBztfyCh0JX4PSX6oXn6 rESkJyN1NW2H07wzBqDhGw== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E4C705911485E04736C84E54 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit On 6/4/2018 6:31 PM, nageswara Bandla wrote: > I have figured out the issue with pgAgent both in Windows and Linux. > > PgAgent seems to ignore pgpass.conf/.pgpass whenever it has 127.0.0.1 > (127.0.0.1:5432:*:postgres:postgres) throws an error: > > *DEBUG: Creating DB connection: user=postgres port=5432 > hostaddr=127.0.0.1 dbname=linuxpostgresdb* > > *WARNING: Couldn't create the primary connection (attempt 1): > fe_sendauth: no password supplied* > > * > * > > The solution could be update .pgpass to have ( > localhost:5432:*:postgres:postgres ) and then pgagent works fine > without issues. > > > I think, pgagent is not inline with libpq.dll while passing host > address parameter. I have raised this concern with pgagent github > where exactly they need to change the code in order for pgagent to be > in line with psql program. > > > https://github.com/postgres/pgagent/issues/14 Wow !!! I don't use pgpass much at all - usually I want the security of providing the password manually.  Since we started with the idea that the file wasn't being read properly, I was mainly trying to figure out how Windows could be screwing that up. There is a difference between localhost and 127.0.0.1:  localhost is DNS resolved - usually from the local hosts file - and thus works with either IPv4 or IPv6 addressing.  But it never would have occurred to me that using one vs the other, on an otherwise properly configured system, should cause an error. Great work finding that. George --------------E4C705911485E04736C84E54 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit
On 6/4/2018 6:31 PM, nageswara Bandla wrote:
I have figured out the issue with pgAgent both in Windows and Linux. 

PgAgent seems to ignore pgpass.conf/.pgpass whenever it has 127.0.0.1 (127.0.0.1:5432:*:postgres:postgres) throws an error:

    DEBUG: Creating DB connection: user=postgres port=5432 hostaddr=127.0.0.1 dbname=linuxpostgresdb

    WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth: no password supplied


The solution could be update .pgpass to have ( localhost:5432:*:postgres:postgres ) and then pgagent works fine without issues.


I think, pgagent is not inline with libpq.dll while passing host address parameter. I have raised this concern with pgagent github where exactly they need to change the code in order for pgagent to be in line with psql program. 



Wow !!!

I don't use pgpass much at all - usually I want the security of providing the password manually.  Since we started with the idea that the file wasn't being read properly, I was mainly trying to figure out how Windows could be screwing that up. <grin>

There is a difference between localhost and 127.0.0.1:  localhost is DNS resolved - usually from the local hosts file - and thus works with either IPv4 or IPv6 addressing.  But it never would have occurred to me that using one vs the other, on an otherwise properly configured system, should cause an error.

Great work finding that.
George

--------------E4C705911485E04736C84E54--