Re: pgcrypto seeding problem when ssl=on

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: pgcrypto seeding problem when ssl=on
Дата
Msg-id 20121223004900.GA30512@tornado.leadboat.com
обсуждение исходный текст
Ответ на Re: pgcrypto seeding problem when ssl=on  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgcrypto seeding problem when ssl=on
Список pgsql-hackers
On Sat, Dec 22, 2012 at 02:20:56PM -0500, Tom Lane wrote:
> I believe that we'd be better off doing something in postmaster.c to
> positively ensure that each session has a distinct seed value.  Notice
> that BackendRun() already takes measures to ensure that's the case for
> the regular libc random() function; it seems like a reasonable extension
> to also worry about OpenSSL's PRNG.

> #ifdef USE_SSL
>     if (EnableSSL)
>     {
>         struct timeval tv;
> 
>         gettimeofday(&tv, NULL);
>         RAND_add(&tv, sizeof(tv), 0);
>     }
> #endif

Take the caution one step further and make it independent of EnableSSL.  In a
stock installation, a !EnableSSL postmaster will never seed its PRNG, and
there's no vulnerability.  Add a shared_preload_libraries module that uses the
OpenSSL PRNG in its _PG_init(), and suddenly you're vulnerable again.

Other than that, looks good.

> We could perhaps also make this conditional on not EXEC_BACKEND, since
> the whole issue is moot if backends are launched by fork/exec.

True.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Pg_upgrade faster, again!
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Feature Request: pg_replication_master()