Thread: Issue with configuration parameter "require_auth"

Issue with configuration parameter "require_auth"

From
"Gaisford, Phillip"
Date:

I am having trouble using require_auth (https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-REQUIRE-AUTH).

 

Using golang sqlx.Connect on the client side, the connection fails and my Postgresql 16 server logs the following:

2024-07-17 14:42:07.285 UTC [115] FATAL:
  unrecognized configuration parameter "require_auth"

 

What could the issue be?

 

Re: Issue with configuration parameter "require_auth"

From
Tom Lane
Date:
"Gaisford, Phillip" <phillip.gaisford@hpe.com> writes:
> Using golang sqlx.Connect on the client side, the connection fails and my Postgresql 16 server logs the following:
> 2024-07-17 14:42:07.285 UTC [115] FATAL:  unrecognized configuration parameter "require_auth"

require_auth is a connection parameter, like host or port or dbname.
You seem to be trying to specify it as a server parameter, ie inside
the "options" connection parameter.

            regards, tom lane



Re: Issue with configuration parameter "require_auth"

From
"David G. Johnston"
Date:
On Wednesday, July 17, 2024, Gaisford, Phillip <phillip.gaisford@hpe.com> wrote:

I am having trouble using require_auth (https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-REQUIRE-AUTH).

 

Using golang sqlx.Connect on the client side, the connection fails and my Postgresql 16 server logs the following:

2024-07-17 14:42:07.285 UTC [115] FATAL:
  unrecognized configuration parameter "require_auth"

 

What could the issue be?

 


Seems like a bug or version mis-match in the client library.  That is a new option in v16 so it may not be handled properly.  That option is client-only, the client should not be sending it to the server, which the error message indicates it is.  Unless you can reproduce with psql you’ll need to check your installation environment (maybe you only have v15 or less client libraries installed?) or file a bug with the driver project.

David J.

Re: Issue with configuration parameter "require_auth"

From
"Gaisford, Phillip"
Date:

Interesting…

 

So what would a connection URI using require_auth properly look like? Here’s what I have been trying:

url: "postgres://postgres:postgres@localhost:5432/aioli?require_auth=password&application_name=aioli-controller&sslmode=disable&sslrootcert=",

 

 

From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wednesday, July 17, 2024 at 11:24
AM
To: Gaisford, Phillip <phillip.gaisford@hpe.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Issue with configuration parameter "require_auth"

"Gaisford, Phillip" <phillip.gaisford@hpe.com> writes:
> Using golang sqlx.Connect on the client side, the connection fails and my Postgresql 16 server logs the following:
> 2024-07-17 14:42:07.285 UTC [115] FATAL:  unrecognized configuration parameter "require_auth"

require_auth is a connection parameter, like host or port or dbname.
You seem to be trying to specify it as a server parameter, ie inside
the "options" connection parameter.

                        regards, tom lane

Re: Issue with configuration parameter "require_auth"

From
Tom Lane
Date:
"Gaisford, Phillip" <phillip.gaisford@hpe.com> writes:
> So what would a connection URI using require_auth properly look like? Here’s what I have been trying:

> url:
"postgres://postgres:postgres@localhost:5432/aioli?require_auth=password&application_name=aioli-controller&sslmode=disable&sslrootcert=",

Hm, that looks right (and behaves as-expected here).

What version of what client-side stack are you using?  For me, libpq 16
and up recognize this parameter, while older versions fail with

psql: error: invalid URI query parameter: "require_auth"

If you're using some other client driver, maybe it doesn't know this
parameter and guesses that it should be passed to the server.

            regards, tom lane



Re: Issue with configuration parameter "require_auth"

From
"Gaisford, Phillip"
Date:

I think Tom is right.

 

I am using v5.6 of https://github.com/jackc/pgx

 

I quick read of the code reveals no awareness of require_auth, so I have filed an issue with the project.

 

From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wednesday, July 17, 2024 at 1:11
PM
To: Gaisford, Phillip <phillip.gaisford@hpe.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Issue with configuration parameter "require_auth"

"Gaisford, Phillip" <phillip.gaisford@hpe.com> writes:
> So what would a connection URI using require_auth properly look like? Here’s what I have been trying:

> url: "postgres://postgres:postgres@localhost:5432/aioli?require_auth=password&application_name=aioli-controller&sslmode=disable&sslrootcert=",

Hm, that looks right (and behaves as-expected here).

What version of what client-side stack are you using?  For me, libpq 16
and up recognize this parameter, while older versions fail with

psql: error: invalid URI query parameter: "require_auth"

If you're using some other client driver, maybe it doesn't know this
parameter and guesses that it should be passed to the server.

                        regards, tom lane