BUG #1321: SSL error: sslv3 alert handshake failure

Lists: pgsql-bugs
From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 03:40:39
Message-ID: 20041116034039.163717386DC@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1321
Logged by: T.J. Ferraro

Email address: tjtoocool(at)phreaker(dot)net

PostgreSQL version: 8.0 Beta

Operating system: Mandrake Linux 10

Description: SSL error: sslv3 alert handshake failure

Details:

After installing 8.0.0beta4 (previously tried with beta3,2,etc) on a linux
system with a working 7.4.x installation I was unable to connect with ssl.
Tried compiling with OpenSSL 0.9.7d/e. I used certificates created with
OpenSSL 0.9.7d/e that both worked fine with 7.4.x but apparently not so with
8.0.0. Server starts fine, but when I attempt to connect to the server with
latest pgadmin or psql (8.0.0beta4 both on the pgfoundry binary for windows
and a compiled version on Mandrake Linux) the error is always the same. The
error message returned to the client is "SSL error: sslv3 alert handshake
failure". The log reports: "could not accept SSL connection: 1".


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "T(dot)J(dot) Ferraro" <tjtoocool(at)phreaker(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, "Magnus Hagander" <mha(at)sollentuna(dot)net>
Subject: Re: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 20:01:23
Message-ID: 1781.1100635283@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
> After installing 8.0.0beta4 (previously tried with beta3,2,etc) on a linux
> system with a working 7.4.x installation I was unable to connect with ssl.
> Tried compiling with OpenSSL 0.9.7d/e. I used certificates created with
> OpenSSL 0.9.7d/e that both worked fine with 7.4.x but apparently not so with
> 8.0.0. Server starts fine, but when I attempt to connect to the server with
> latest pgadmin or psql (8.0.0beta4 both on the pgfoundry binary for windows
> and a compiled version on Mandrake Linux) the error is always the same. The
> error message returned to the client is "SSL error: sslv3 alert handshake
> failure". The log reports: "could not accept SSL connection: 1".

The only SSL changes between beta3 and beta4 were Magnus' changes to
make ssl work on Windows, so I'm assuming this is his fault ...

regards, tom lane


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "T(dot)J(dot) Ferraro" <tjtoocool(at)phreaker(dot)net>, pgsql-bugs(at)postgresql(dot)org, Magnus Hagander <mha(at)sollentuna(dot)net>
Subject: Re: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 20:30:33
Message-ID: 20041116203033.GA24871@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Nov 16, 2004 at 03:01:23PM -0500, Tom Lane wrote:
> "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
> > After installing 8.0.0beta4 (previously tried with beta3,2,etc) on a linux
> > system with a working 7.4.x installation I was unable to connect with ssl.
> > Tried compiling with OpenSSL 0.9.7d/e. I used certificates created with
> > OpenSSL 0.9.7d/e that both worked fine with 7.4.x but apparently not so with
> > 8.0.0. Server starts fine, but when I attempt to connect to the server with
> > latest pgadmin or psql (8.0.0beta4 both on the pgfoundry binary for windows
> > and a compiled version on Mandrake Linux) the error is always the same. The
> > error message returned to the client is "SSL error: sslv3 alert handshake
> > failure". The log reports: "could not accept SSL connection: 1".
>
> The only SSL changes between beta3 and beta4 were Magnus' changes to
> make ssl work on Windows, so I'm assuming this is his fault ...

Sounds like a problem due to the backend in recent betas demanding
a client certificate if $PGDATA/root.crt exists, but the client
certificate doesn't exist in ~/.postgresql/postgresql.{crt,key}.

What happens if you remove or rename $PGDATA/root.crt and restart
the backend? The server should print warnings like the following
but client connections should then succeed:

could not load root certificate file "/usr/local/pgsql/data/root.crt": No such file or directory
Will not verify client certificates.

Or you could install a client certificate and key in the locations
mentioned (~/.postgresql/postgresql.{crt,key}).

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: "T(dot)J(dot) Ferraro" <tjtoocool(at)phreaker(dot)net>, pgsql-bugs(at)postgresql(dot)org, Magnus Hagander <mha(at)sollentuna(dot)net>
Subject: Re: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 20:33:49
Message-ID: 2074.1100637229@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael Fuhr <mike(at)fuhr(dot)org> writes:
> Sounds like a problem due to the backend in recent betas demanding
> a client certificate if $PGDATA/root.crt exists, but the client
> certificate doesn't exist in ~/.postgresql/postgresql.{crt,key}.

If that is the problem, it's still broken because the error message
is so unhelpful. (I'm quite certain I tested that case last time
I touched the SSL code, and it said something reasonable then.)

regards, tom lane


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "T(dot)J(dot) Ferraro" <tjtoocool(at)phreaker(dot)net>, pgsql-bugs(at)postgresql(dot)org, Magnus Hagander <mha(at)sollentuna(dot)net>
Subject: Re: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 20:41:56
Message-ID: 20041116204156.GA27507@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Nov 16, 2004 at 03:33:49PM -0500, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > Sounds like a problem due to the backend in recent betas demanding
> > a client certificate if $PGDATA/root.crt exists, but the client
> > certificate doesn't exist in ~/.postgresql/postgresql.{crt,key}.
>
> If that is the problem, it's still broken because the error message
> is so unhelpful. (I'm quite certain I tested that case last time
> I touched the SSL code, and it said something reasonable then.)

I get the following error if I use an 8.0.0beta4 client to connect
to an 8.0.0beta4 server that has a root.crt, but the client certificate
doesn't exist in ~/.postgresql:

psql: SSL error: sslv3 alert handshake failure

The server logs the following:

LOG: could not accept SSL connection: 1

If the certificate exists but I use a 7.4.6 client, then the client
fails with the following:

psql: unrecognized SSL error code

The server logs this:

LOG: could not accept SSL connection: 5

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: "T(dot)J(dot)" <tjtoocool(at)phreaker(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <mha(at)sollentuna(dot)net>, Michael Fuhr <mike(at)fuhr(dot)org>
Subject: Re: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 22:48:52
Message-ID: 419A83D4.6030203@phreaker.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

To clarify, what I have experienced was in all versions of 8.0.0.beta,
it did not just happen between 3 to 4. It was the change from 7.4 to
8.0. The error was not just windows based as I built psql on a seperate
linux machine communicating with a linux server and got the same
results. I created a client.crt client.key and placed them into the data
directory, no change. I read the below post again and renamed the files
to postgresql.crt and postgresql.key. No change. Read the below post
very carefully AGAIN and then copied those files up one directory into
the main pgsql dir. No change. Did I miss something?

Michael Fuhr wrote:

>On Tue, Nov 16, 2004 at 03:33:49PM -0500, Tom Lane wrote:
>
>
>>Michael Fuhr <mike(at)fuhr(dot)org> writes:
>>
>>
>>>Sounds like a problem due to the backend in recent betas demanding
>>>a client certificate if $PGDATA/root.crt exists, but the client
>>>certificate doesn't exist in ~/.postgresql/postgresql.{crt,key}.
>>>
>>>
>>If that is the problem, it's still broken because the error message
>>is so unhelpful. (I'm quite certain I tested that case last time
>>I touched the SSL code, and it said something reasonable then.)
>>
>>
>
>I get the following error if I use an 8.0.0beta4 client to connect
>to an 8.0.0beta4 server that has a root.crt, but the client certificate
>doesn't exist in ~/.postgresql:
>
>psql: SSL error: sslv3 alert handshake failure
>
>The server logs the following:
>
>LOG: could not accept SSL connection: 1
>
>If the certificate exists but I use a 7.4.6 client, then the client
>fails with the following:
>
>psql: unrecognized SSL error code
>
>The server logs this:
>
>LOG: could not accept SSL connection: 5
>
>
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "T(dot)J(dot)" <tjtoocool(at)phreaker(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, Magnus Hagander <mha(at)sollentuna(dot)net>, Michael Fuhr <mike(at)fuhr(dot)org>
Subject: Re: BUG #1321: SSL error: sslv3 alert handshake failure
Date: 2004-11-16 22:56:22
Message-ID: 3780.1100645782@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"T.J." <tjtoocool(at)phreaker(dot)net> writes:
> To clarify, what I have experienced was in all versions of 8.0.0.beta,
> it did not just happen between 3 to 4. It was the change from 7.4 to
> 8.0. The error was not just windows based as I built psql on a seperate
> linux machine communicating with a linux server and got the same
> results. I created a client.crt client.key and placed them into the data
> directory, no change. I read the below post again and renamed the files
> to postgresql.crt and postgresql.key. No change. Read the below post
> very carefully AGAIN and then copied those files up one directory into
> the main pgsql dir. No change. Did I miss something?

The client key files go into something under the client user's HOME
directory (I think ~/.pgsql/client.key, but check the manual). This
is entirely unrelated to either PGDATA or the postgres user's home
(neither of which a client program would be able to read, typically).

This stuff is documented in the 8.0 libpq docs.

regards, tom lane