Bug 846666

Summary: Print distinct errors when there is no CA cert provided or server cert isn't signed by it
Product: Red Hat Enterprise Linux 6 Reporter: David Jaša <djasa>
Component: spice-gtkAssignee: Marc-Andre Lureau <marcandre.lureau>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, cfergeau, dblechte, dyasny, marcandre.lureau, mbarta, mkrcmari
Target Milestone: beta   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spice-gtk-0.14-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:48:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Jaša 2012-08-08 11:45:28 UTC
Description of problem:
This is and extension/clarification of Bug 834504. The error code:
main-1:0: SSL_connect: error:00000001:lib(0):func(0):reason(1)

is the same for all three scenarios:
1) host subject mismatch ($SUBJ of bug 834504)
2) server certificate not being signed by the provided CA
3) no CA cert provided

This makes debugging of connection failures needlesly difficult, especially when the client is run via RHEV/oVirt Portals.

Version-Release number of selected component (if applicable):
spice-gtk-0.11-11.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Christophe Fergeau 2012-08-10 14:51:49 UTC
Would you happen to have the error messages displayed for case 2) and 3)?

Comment 2 David Jaša 2012-08-10 15:02:05 UTC
Something like:

2) "Spice server certificate is not signed by provided CA certificate"
3) "Secure connection requested but no trust store provided. Please use --spice-ca-file option"

Comment 3 Christophe Fergeau 2012-08-10 15:29:53 UTC
I mean, what happens now? In particular what is the cryptic SSL error?

Comment 4 David Jaša 2012-08-17 10:58:07 UTC
(In reply to comment #3)
> I mean, what happens now? In particular what is the cryptic SSL error?

the one in comment 0, it's the same for all three scenarios mentioned there.

Comment 5 Christophe Fergeau 2012-08-17 11:17:19 UTC
Oh never mind, the warning I was interested in is 

        if (!preverify_ok) {
            spice_warning("openssl verify:num=%d:%s:depth=%d:%s", err,
                          X509_verify_cert_error_string(err), depth, buf);

but it's not printed in all cases :(

Comment 7 David Blechter 2012-10-05 12:26:06 UTC
out of time for 6.4

Comment 8 Marc-Andre Lureau 2012-10-18 13:42:35 UTC
With spice-gtk git, I get the following:

1) ssl_verify.c:484:openssl_verify: ssl: subject 'C=IL,L=Raanana,O=Red Hat,CN=my foo' verification failed

2) ssl_verify.c:428:openssl_verify: openssl verify:num=19:self signed certificate in certificate chain:depth=1:/C=IL/L=Raanana/O=Red Hat/CN=my CA

3) GSpice-WARNING **: loading ca certs from /home/elmarco/.spicec/spice_truststore.pem failed

I guess we could improve the messages a bit, but it seems to be mostly resolved now, agree?

Comment 9 David Jaša 2012-10-18 13:57:57 UTC
(In reply to comment #8)
> I guess we could improve the messages a bit, but it seems to be mostly
> resolved now, agree?

I think so but I'd prefer to keep the bug open till the messages are polished to final state.

Comment 10 Marc-Andre Lureau 2012-10-18 14:12:55 UTC
1) and 3) look fine to me, 2) is the official openssl error: 

19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain
    the certificate chain could be built up using the untrusted certificates but the root could not be found locally.

We can also print: "server certificate not being signed by the provided CA" (but I am not sure this is correct)

Comment 11 David Jaša 2012-10-18 14:40:47 UTC
(In reply to comment #10)
> 1) and 3) look fine to me,

agreed.

> 2) is the official openssl error: 
> 
> 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in
> certificate chain
>     the certificate chain could be built up using the untrusted certificates
> but the root could not be found locally.
> 
> We can also print: "server certificate not being signed by the provided CA"
> (but I am not sure this is correct)

I think this wording is good to make it in.

Comment 12 Marc-Andre Lureau 2012-10-18 19:23:28 UTC
patch sent to ML

Comment 14 Marc-Andre Lureau 2012-12-10 13:06:51 UTC
Fixed in spice-gtk-0.14-5.el6

Comment 18 errata-xmlrpc 2013-02-21 08:48:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0343.html