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 1v27rp-000Xsn-0J for pgsql-general@arkaria.postgresql.org; Fri, 26 Sep 2025 12:48:05 +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 1v27rn-001JSb-06 for pgsql-general@arkaria.postgresql.org; Fri, 26 Sep 2025 12:48:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v27rm-001JST-Hk for pgsql-general@lists.postgresql.org; Fri, 26 Sep 2025 12:48:03 +0000 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v27rk-0001n9-2S for pgsql-general@lists.postgresql.org; Fri, 26 Sep 2025 12:48:02 +0000 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-7827025e548so1176238a34.2 for ; Fri, 26 Sep 2025 05:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758890880; x=1759495680; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=jSl+jLFoWH+D0PSyhjp01chfxtpxEQyWo6suX+MiSUA=; b=f+FdPCXsnCH9cu0GvwCpklHyT83oaR/ES4U7hAuzimL00tuaNOtpg/G5t+pugP2+D6 pFLmLOwj88FaikRIOIMkq45Tn0yC1h6ijCzO4RiyoikIcwiX8t/fSYPNfNZQD7zs/sEo KkTjjvnkp2oIz/zLVB/cge6dN0FC3JbiYv3LU70C2LqcVTOzNej+8+XDCH6TCb5/dSAr QlDfVHuykbK87DmDRsymv6/jQs5eR4lz+pRVTas40bI1UQzmpQNSfPV0iBtNmklHWvRI UuenoOKUTO1OQcV0KFYLsAA87mTrDrvbKicbfNhzJwh7twmlDeY5UzZ4q4LovAnHXnPl IyUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758890880; x=1759495680; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jSl+jLFoWH+D0PSyhjp01chfxtpxEQyWo6suX+MiSUA=; b=WoWxaDCY0DWn80Sc2X4hOxa7lb/pqOCUGTOqh1woF5RyyS/9baXfxKZwkU49BNWSiH kjJ18gfOUMDdd99mlOJWytZEej7xIV+kl/PNyBAEz/SWcP0BxwI2MXxNNKNwF/1ZS+qy /kjBKCE5RXI4EWl0KBkad4ZLBUtFHDZ8PvcRybv4XajZLv/zCfZuntW9brMVfHG4r0Qp MO34DoGI7yeTFViI99t88pqYKBohjkE3cHRPW45zpaEaWGujfkQmh6paZ/BuYSLdZMtB tKjMW4KqnGeujepKgrbFx1SA0YaXa9O/xaii/94XOUnvD+rVFq9nnBFyd3ryf3niOFr1 C/6Q== X-Gm-Message-State: AOJu0Yx2RzzisDfbUdsRjOcbOUB+nsnb0q+rh4D8j4tp9g+ymyUrwpLr l8nuo3WnISR20gmBbSJGzVvj6g3Tz+FYWIecixRI1jWHYAR7qwsfC2qnNPuvRqjNy/AHaIHGhix 69s2wzadcv/2vniiX87gp9MtMx4PgCH4nrfjm X-Gm-Gg: ASbGncvfZDCONqgSt/2yuIiwDt+k94wYXe6p+ZbBMdLKmAgcgQXpSVRZLpj9mg7kUmr oLPAfsJqWNvRXIJmRy3Ef4G6Ow3deko8fbE0Nd+8fp3mtyyUuQ/NVVmkWxyHLerarZ7O4THfY86 glQhpBG7ivhPWIvCJ+RcSOMpmxszih1DjxSC5P02EoipGP/VTcQCv4m+mxyHpJojWNiZcJ5ek2o wzZPdXaDH0CJWhhHFM= X-Google-Smtp-Source: AGHT+IFCY0KqTzp2E93NzeayZDQS7LnVcZ++0uecN+lfIig/RVhQLLaXykn+yemZKbZeKgvFifu5N5p5tnABfI6mOtg= X-Received: by 2002:a05:6808:f93:b0:43f:2c73:347f with SMTP id 5614622812f47-43f4cc0393dmr3915426b6e.1.1758890879954; Fri, 26 Sep 2025 05:47:59 -0700 (PDT) MIME-Version: 1.0 References: <31ded2b6-d8f8-497c-59ea-c7885b4a7d26@gushi.org> In-Reply-To: <31ded2b6-d8f8-497c-59ea-c7885b4a7d26@gushi.org> From: Ron Johnson Date: Fri, 26 Sep 2025 08:47:48 -0400 X-Gm-Features: AS18NWCf4JkaUnCPzXi2PNy4sye5PqmMbYPxZtDKgdbcnh7jakMAGrsYRO0NiWQ Message-ID: Subject: Re: pgpass file in postresql.auto.conf? To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000193594063fb3b2db" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000193594063fb3b2db Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2025 at 8:06=E2=80=AFAM Dan Mahoney (Gushi) wrote: > Hey folks, > > In the interest of automation, I've set up a pgpass file for my > pg_basebackup between master and standby. This all works, thusly: > > pg_basebackup -d > 'postgres://repuser@10.1.1.1:5432/foo?sslmode=3Dverify-ca' -F p > --wal-method=3Dstream -P -R -D /var/db/postgres/data17-test3 > > However, instead of the password getting baked into the pgsql.auto.conf, > the reference to the passfile gets put in, instead: > It's still early in the morning, so I might still be fuzzy-brained, but are you asking why the repuser password is not hard-coded into postresql.auto.conf? > # Do not edit this file manually! > # It will be overwritten by the ALTER SYSTEM command. > primary_conninfo =3D 'user=3Drepuser passfile=3D''/var/db/postgres/.pgpas= s'' > channel_binding=3Dprefer host=3D10.1.1.1 port=3D5432 sslmode=3D''verify-c= a'' > sslnegotiation=3Dpostgres sslcompression=3D0 sslcertmode=3Dallow sslsni= =3D1 > ssl_min_protocol_version=3DTLSv1.2 gssencmode=3Ddisable krbsrvname=3Dpost= gres > gssdelegation=3D0 target_session_attrs=3Dany load_balance_hosts=3Ddisable > dbname=3Dfoo' > > But it seems postgres won't actually read the passfile. > > Sep 26 12:01:27 hostname postgres[42455]: [7-1] 2025-09-26 12:01:27.658 > UTC [42455] FATAL: could not connect to the primary server: connection t= o > server at "10.1.1.1", port 5432 failed: fe_sendauth: no password supplied > > Am I doing something wrong here? > *When* do you get that message? And what does "for my pg_basebackup between master and standby" mean? > I'm loathe to hand-edit the file, because of that warning there. > > Why does pg_basebackup put a reference to a file it it won't read it? > Because you have a subtle bug in the .pgpass file. It's case sensitive, and requires the domain name of that's part of $HOSTNAME. > Is there an alter system command that can be used to properly populate th= e > password into this file? > Does the .pgpass file work for "regular" connections? --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000193594063fb3b2db Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Sep 26, 2025 at 8:06=E2=80=AFAM D= an Mahoney (Gushi) <postgres@gushi= .org> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">Hey folks,

In the interest of automation, I've set up a pgpass file for my
pg_basebackup between master and standby.=C2=A0 This all works, thusly:

pg_basebackup -d
'postgres://repuser@10.1.1.1:5432/foo?sslmod= e=3Dverify-ca' -F p
--wal-method=3Dstream -P -R -D /var/db/postgres/data17-test3

However, instead of the password getting baked into the pgsql.auto.conf, the reference to the passfile gets put in, instead:
It's still early in the morning, so I might still be fuzzy= -brained, but are you asking why the repuser password is not hard-coded int= o=C2=A0postresql.auto.conf?
=C2=A0
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
primary_conninfo =3D 'user=3Drepuser passfile=3D''/var/db/postg= res/.pgpass''
channel_binding=3Dprefer host=3D10.1.1.1 port=3D5432 sslmode=3D''ve= rify-ca''
sslnegotiation=3Dpostgres sslcompression=3D0 sslcertmode=3Dallow sslsni=3D1=
ssl_min_protocol_version=3DTLSv1.2 gssencmode=3Ddisable krbsrvname=3Dpostgr= es
gssdelegation=3D0 target_session_attrs=3Dany load_balance_hosts=3Ddisable <= br> dbname=3Dfoo'

But it seems postgres won't actually read the passfile.

Sep 26 12:01:27 hostname postgres[42455]: [7-1] 2025-09-26 12:01:27.658 UTC [42455] FATAL:=C2=A0 could not connect to the primary server: connectio= n to
server at "10.1.1.1", port 5432 failed: fe_sendauth: no password = supplied

Am I doing something wrong here?

*When*= do you get that message?=C2=A0 And what does "for my
pg_baseback= up between master and standby" mean?
=C2=A0
I'm loathe to hand-edit the file, because of that warning = there.

Why does pg_basebackup put a reference to a file it it won't read it?

Because you have a subtle bug in the .pg= pass file.=C2=A0 It's case sensitive, and requires the domain name of t= hat's part of $HOSTNAME.
=C2=A0
Is there an alter system command that can be used= to properly populate the
password into this file?

Does the .pgpass file work for "regular" connections?
=

--
Death to <Redacted&= gt;, and butter sauce.
Don't boil me, I'm still alive.
=
<Redacted> lobster!
--000000000000193594063fb3b2db--