Re: PAM implementation in PG 9.2.3

From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: PAM implementation in PG 9.2.3
Date: 2013-05-08 16:03:33
Message-ID: CA+h6Ahj3Orqoi2RBMcW-JaAC7ZLmuRr7Buf25s0iKBXkQEaAFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 8, 2013 at 4:55 PM, Amit Langote <amitlangote09(at)gmail(dot)com>wrote:

> Hello Raghavendra,
>
> I think probably psql is a problem here. WIthout -W (force password
> before connect) option psql has no way knowing if this user needs a
> password to connect to the given database. So, psql first attempts a
> connection to the database without a password (if -W is not
> specified), which fails since server responds with "password needed"
> kind of message back to psql (this is because we have set 'pam' as the
> authentication method). This makes psql know that a password is needed
> for this user/database combination and it prompts for the password and
> subsequently connects successfully if correct password is specified.
> But this first unsuccessful attempt is indeed logged by the server as
> authentication failure just as what you see. So, this logged failure
> is just the kind of dummy connection attempt (indeed withoutn
> password) made by the psql.
>
>
Firstly, Thank you for your insight explanation.

> However, if you specify -W option, psql won't connect before it
> accepts password. You can try this (and see that no authentication
> failure is logged)
>

Affirmative, I have tried with -W option and it worked as expected and
authentication passed as per PAM setup.

However, PG documentation doesn't highlight about this in psql or PAM
section, because log entries written are slightly confusing.
http://www.postgresql.org/docs/9.2/static/auth-methods.html
http://www.postgresql.org/docs/9.2/static/app-psql.html

I think log entries just mean the authentication has failed with
> PAM-specific error message.
>
> Yep... understood.

---
Regards,
Raghavendra
Blog: http://raghavt.blogspot.com/

> --
>
> Amit Langote
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-05-08 16:12:57 Re: Does it make sense to break a large query into separate functions?
Previous Message Tobias Larsen 2013-05-08 15:07:30 Re: SELECT count(*) differs from result in pgadmin