Re: Re: Proposal for encrypting pg_shadow passwords - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Re: Proposal for encrypting pg_shadow passwords
Date
Msg-id 200108151636.f7FGack26159@candle.pha.pa.us
Whole thread Raw
In response to Re: Proposal for encrypting pg_shadow passwords  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-patches by date:

Previous
From: Denis Perchine
Date:
Subject: Re: patch for JDBC PreparedStatement
Next
From: Peter Eisentraut
Date:
Subject: Re: Re: Proposal for encrypting pg_shadow passwords