Re: Issues with PAM : log that it failed, whether it actually failed or not

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: La Cancellera Yoann <lacancellera(dot)yoann(at)gmail(dot)com>
Subject: Re: Issues with PAM : log that it failed, whether it actually failed or not
Date: 2019-11-04 17:01:46
Message-ID: 30950.1572886906@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

[ redirecting to pgsql-hackers ]

I wrote:
> La Cancellera Yoann <lacancellera(dot)yoann(at)gmail(dot)com> writes:
>> I am having issues with PAM auth :
>> it works, password are correctly checked, unknown users cannot access,
>> known user can, everything looks good
>> But, it always log an error by default even if auth is succesful:
>> And if auth is unsuccessful, it will log that very same message twice

> Those aren't errors, they're just log events.

> If you're using psql to connect, the extra messages aren't surprising,
> because psql will first try to connect without a password, and only
> if it gets a failure that indicates that a password is needed will
> it prompt the user for a password (so two connection attempts occur,
> even if the second one is successful). You can override that default
> behavior with the -W switch, and I bet that will make the extra
> log messages go away.

> Having said that, using LOG level for unsurprising auth failures
> seems excessively chatty. More-commonly-used auth methods aren't
> that noisy.

I took a closer look at this and realized that the problem is that
the PAM code doesn't support our existing convention of not logging
anything about connections wherein the client side disconnects when
challenged for a password. 0001 attached fixes that, not in a
terribly nice way perhaps, but the PAM code is already relying on
static variables for communication :-(.

Also, 0002 adjusts some messages in the same file to match project
capitalization conventions.

Barring objections, I propose to back-patch 0001 but apply 0002
to HEAD only.

regards, tom lane

Attachment Content-Type Size
0001-suppress-PAM-logging-for-EOF.patch text/x-diff 2.1 KB
0002-message-style-police.patch text/x-diff 1.5 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2019-11-04 19:12:38 Re: v12 and pg_restore -f-
Previous Message Merlin Moncure 2019-11-04 16:15:36 Re: question about array indexing

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-11-04 17:14:53 Re: Missed check for too-many-children in bgworker spawning
Previous Message Alvaro Herrera 2019-11-04 16:58:20 Re: Obsolete comment in partbounds.c