Re: Re: Proposal for encrypting pg_shadow passwords

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Re: Proposal for encrypting pg_shadow passwords
Date: 2001-08-15 16:36:38
Message-ID: 200108151636.f7FGack26159@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> Attached please find:
>
> the original proposal to encrypt pg_shadow
> a diff of the current CVS
> two new files (backend/libpq/md5.c and include/libpq/md5.h)
> which implement MD5 encryption (from Vince with cleanups)
>
> I have increased the protocol version from 2.0 -> 2.1. I use MD5 for
> all client encryption if the client supports it. I know we have
> portability problems with libc's crypt() this will fix that right away.
> Of course older clients and servers will still talk using libc's
> crypt().

One more issue, and that is salt. The patch uses the username as salt
for storing in pg_shadow. That is how Vince's code did it, and it
seemed OK to me. It prevents me from having to send a second salt over
the wire, and it prevents me from having to pull the salt out of
pg_shadow so I can send it to the client. Not sure if this is how
FreeBSD does it.

Also, we are using only two characters for salt right now because that
is all crypt() accepts. Should we make it larger with MD5? We can only
use printable characters, so we only have:

> 62*62
3844

I am not sure this is random enough to prevent possible playback.
Remember, this salt is used to prevent playback of over-the-wire
passwords.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-15 16:58:14 Re: WIN32 errno patch
Previous Message Peter Eisentraut 2001-08-15 16:09:37 Re: PostGIS spatial extensions