Обсуждение: Removing a user's password

Поиск
Список
Период
Сортировка

Removing a user's password

От
Bruce Momjian
Дата:
What capabilities do we have for removing a user's password?  The only
way I can see to do it is to insert a NULL into pg_shadow, but clearly
that is pretty ugly.  I don't see any mention in the ALTER USER manual
page, and assigning a password of NULL using ALTER user fails.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Removing a user's password

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> What capabilities do we have for removing a user's password?

If you set VALID UNTIL to 'now' (or sometime in the past), you've
effectively prevented him from logging in with the password ---
more effectively than setting the password to NULL, since if the
user is still logged in he can just undo that.  I don't think we
really need to do anything more here.
        regards, tom lane


Re: Removing a user's password

От
Bruce Momjian
Дата:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > What capabilities do we have for removing a user's password?
> 
> If you set VALID UNTIL to 'now' (or sometime in the past), you've
> effectively prevented him from logging in with the password ---
> more effectively than setting the password to NULL, since if the
> user is still logged in he can just undo that.  I don't think we
> really need to do anything more here.

Well, can they undo the VALID UNTIL too?  I think at a minimum we need
to document the proper procedure for removing a password.  I see NULL as
a more logical way of removing the password rather than playing with
VALID UNTIL.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Removing a user's password

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> If you set VALID UNTIL to 'now' (or sometime in the past), you've
>> effectively prevented him from logging in with the password ---
>> more effectively than setting the password to NULL, since if the
>> user is still logged in he can just undo that.  I don't think we
>> really need to do anything more here.

> Well, can they undo the VALID UNTIL too?

No: a non-superuser can only set his password, not any other fields of
his pg_shadow entry.

> I think at a minimum we need
> to document the proper procedure for removing a password.  I see NULL as
> a more logical way of removing the password rather than playing with
> VALID UNTIL.

It may be more logical, but it doesn't work as well.
        regards, tom lane


Re: Removing a user's password

От
Bruce Momjian
Дата:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> If you set VALID UNTIL to 'now' (or sometime in the past), you've
> >> effectively prevented him from logging in with the password ---
> >> more effectively than setting the password to NULL, since if the
> >> user is still logged in he can just undo that.  I don't think we
> >> really need to do anything more here.
> 
> > Well, can they undo the VALID UNTIL too?
> 
> No: a non-superuser can only set his password, not any other fields of
> his pg_shadow entry.
> 
> > I think at a minimum we need
> > to document the proper procedure for removing a password.  I see NULL as
> > a more logical way of removing the password rather than playing with
> > VALID UNTIL.
> 
> It may be more logical, but it doesn't work as well.

If a non-super user sets his own password, how does he unset it if he
can't use VALID UNTIL?  Is there no valid reason to unset it? 
Obviously, almost no one is asking for this feature so we may be OK, but
I do want to document using VALID UNTIL to disable a password.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Removing a user's password

От
Michael Brusser
Дата:
Is setting password to NULL better then deleting user?
Mike


-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Bruce Momjian
Sent: Monday, May 26, 2003 2:32 PM
To: Tom Lane
Cc: PostgreSQL-development
Subject: Re: [HACKERS] Removing a user's password


Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > What capabilities do we have for removing a user's password?
>
> If you set VALID UNTIL to 'now' (or sometime in the past), you've
> effectively prevented him from logging in with the password ---
> more effectively than setting the password to NULL, since if the
> user is still logged in he can just undo that.  I don't think we
> really need to do anything more here.

Well, can they undo the VALID UNTIL too?  I think at a minimum we need
to document the proper procedure for removing a password.  I see NULL as
a more logical way of removing the password rather than playing with
VALID UNTIL.

-- Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly




Re: Removing a user's password

От
Bruce Momjian
Дата:
Michael Brusser wrote:
> Is setting password to NULL better then deleting user?
> Mike

They are different.  Remove password allows the user to still log into
other non-password databases.  Removing the user prevents any
connection.

---------------------------------------------------------------------------


> 
> 
> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Bruce Momjian
> Sent: Monday, May 26, 2003 2:32 PM
> To: Tom Lane
> Cc: PostgreSQL-development
> Subject: Re: [HACKERS] Removing a user's password
> 
> 
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > What capabilities do we have for removing a user's password?
> >
> > If you set VALID UNTIL to 'now' (or sometime in the past), you've
> > effectively prevented him from logging in with the password ---
> > more effectively than setting the password to NULL, since if the
> > user is still logged in he can just undo that.  I don't think we
> > really need to do anything more here.
> 
> Well, can they undo the VALID UNTIL too?  I think at a minimum we need
> to document the proper procedure for removing a password.  I see NULL as
> a more logical way of removing the password rather than playing with
> VALID UNTIL.
> 
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Removing a user's password

От
Bruce Momjian
Дата:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Well, they are not actually removing it, just setting it to NULL, as
> > though a password was never assigned.  We have a way for users to set
> > it, but no way for them to remove it.
> 
> If they had a way to remove it, then they'd no longer be able to log in
> (assuming password auth is being used, and if it isn't then who cares?)
> I'm not seeing much of anything here except a foot-gun.  It might look
> nice on the argument of symmetry, but as far as actual functionality
> goes, I think it'd be a waste of code space.  How many people have
> actually asked for this, in all the years the password support has
> been there?

I assume there are some database that require passwords and some that
don't.  I don't think we have had any requests for it.  The only recent
request was someone asking for how to alter the password after using
'createuser', and we fixed that by modifying the manual page.

I added a doc mention of also allowing ALTER USER to remove a password,
so I will just remove that mention and add this patch in the future this
if anyone sees value in removing a password.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073