Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 164601 - ssl-cert.eclass installs invalid ssl certificate
Summary: ssl-cert.eclass installs invalid ssl certificate
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
: 123316 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-30 20:10 UTC by Philip Kovacs
Modified: 2010-02-16 14:59 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ssl-cert.eclass.patch (ssl-cert.eclass.patch,1.27 KB, patch)
2010-01-06 23:23 UTC, James Le Cuirot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Kovacs 2007-01-30 20:10:00 UTC
See bug# 163851.  Opening separate bug, as per uberlord's suggestion.

With USE ssl, the ebuild silently installs an invalid ssl cert/key pair
/etc/ssl/dovecot/{server.pem, server.key}.  The dovecot tarball does supply doc/mkcert.sh and doc/dovecot-openssl.cnf for generating a valid
certificate/private key, but those files are currently not installed.

Perhaps the ebuild should install these additional doc/ files and issue a notice of some kind?  I'm not sure how best to handle the generation of a valid cert/key (i.e. if automatic generation makes sense) but I'm fairly certain that silently installing an invalid one isn't ideal.

Reproducible: Always
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-01-30 20:20:28 UTC
Care to explain how exactly is the certificate *invalid*? Already told once that the certificates are for *testing* purposes, if you need real ones, then create your own certificates as needed; we can't read your mind as for which certificates you need and its not really our business. So, what's invalid there?

Plus using some bundled homebrew scripts turns out to be potentially a serious security issue (as recently with openldap).
Comment 2 Philip Kovacs 2007-01-30 21:46:48 UTC
http://www.sdesign.us/~drphibes/desktop.png

illustrates the problem I observed with the gentoo-installed cert.  it is "invalid" in the sense that any attempt to use it or verify it results in an error.  if you create a self-signed cert with syntax similar to this:

openssl req -new -x509 -nodes -out test.pem -keyout test.key -days 365

(as mkcert.sh does), then the cert passes the test:

openssl verify -CAfile test.pem test.pem

and you can use it.  I am not trying to be argumentative or pedantic here,
I am simply reporting my experience with the ebuild and what I had to do to
get things working.  If you feel there's no problem and no need to make any changes, fine.

Phil
Comment 3 Philip Kovacs 2007-01-30 21:49:27 UTC
also i agree that running a third party script is not advisable.  making it available to users, however, *might* be something to consider.
Comment 4 Roy Marples (RETIRED) gentoo-dev 2007-01-30 21:53:24 UTC
The author of ssl-cert.eclass is retired afaik.
Also, postfix (and other ebuilds) install SSL certs in the same manner, so this bug equally applies.

The beauty of ssl-cert means that all apps that require SSL certs get it made the same way, as many apps that ship with scripts to make certs are often buggy and use once only type things, so an eclass is the best solution imo.

I'm not the best person to handle this, and as the mail apps seem to use it more I'm going to re-assign this bug.
Comment 5 abma 2007-04-06 14:16:47 UTC
why not advice the user to run 

cd /etc/ssl/dovecot
openssl req -new -x509 -nodes -out server.pem -keyout server.key -days 365

and disable the eclass generation?

the eclass generated certs failed for me too.
Comment 6 Philip Kovacs 2007-04-07 00:24:45 UTC
This bug should probably be recategorized to refer specifically to the docert() function in the ssl-cert.eclass.  

Note that bug #123316 is exactly the same issue on a different package. docert() is the culprit there also.
Comment 7 Roy Marples (RETIRED) gentoo-dev 2007-04-07 08:26:10 UTC
*** Bug 123316 has been marked as a duplicate of this bug. ***
Comment 8 David Sperling 2009-02-12 13:22:43 UTC
Hi-

Hopefully, this will explain what "Invalid SSL Certificate" means a little better.

The cause and fix are listed below from an IBM article on the subject.
http://www-01.ibm.com/support/docview.wss?uid=swg21266530

This is still happening in net-mail/dovecot-1.1.7-r1.  Since courier-imap no longer supports qmail/vpopmail setups and dovecot will be replacing it.  I'd suggest that the SSL cert be created in the same way that Courier IMAP and netqmail handle creating certs.  

With the netqmail and courier-imap, the emerge notes suggest that the user edit a config file before creating the cert.  Those certs work fine with Thunderbird.  Currently the dovecot config doesn't prompt the user to do this and creates a cert that isn't accepted by Thunderbird.  Thunderbird won't allow a secure connection with the current gentoo dovecot config script generated cert.  The user is forced to send his password via plain text.  Something that the gentoo netqmail guide says not to do.

Excerpt from the IBM article below:

HTH,



Thunderbird gives me the same error as for Firefox below:

Firefox reports:
Could not establish an encrypted connection because certificate presented by [host name] has an invalid signature.

Internet Explorer reports:
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.
 
Cause
The keyring file created by the CA database has the same name for both the certificate subject and certificate issuer.
 
Resolving the problem
Create another Certificate Authority and signed keyfile for the server using unique values for the certificate subject and issuer. 
Comment 9 David Sperling 2009-02-12 13:34:59 UTC
(In reply to comment #5)
> why not advice the user to run 
> 
> cd /etc/ssl/dovecot
> openssl req -new -x509 -nodes -out server.pem -keyout server.key -days 365
> 
> and disable the eclass generation?
> 
> the eclass generated certs failed for me too.
> 

This worked great and fixed the problem with Thunderbird.

Thanks for that, and yes it would be helpful to have this instead of the current config script that creates a cert that doesn't work with Thunderbird SSL/TLS connections.

Cheers,
Comment 10 Jared Thirsk 2009-07-21 08:40:54 UTC
Ditto on comment #9.  I ran into this too with 1.1.7-r1.  I thought I was being good by following the instructions to do "emerge --config ..." but it set me up for failure and google led me here for the fix.
Comment 11 James Le Cuirot gentoo-dev 2010-01-06 22:55:23 UTC
This has had me stumped for hours today. I must admit that I find the subject confusing but surely someone knows how to do it properly. David Sperling was right though, the common names cannot match. I edited the eclass to make it generate a slightly different config for the CA, where it appends "CA" on the end of the common name. This made Windows slightly happier but it still wasn't satisfied. I imported the CA certificate as well (this normally gets deleted) and all errors disappeared from the certificate manager but Chrome still wouldn't connect. :(
Comment 12 James Le Cuirot gentoo-dev 2010-01-06 23:23:18 UTC
Created attachment 215449 [details, diff]
ssl-cert.eclass.patch

Okay, I've more or less fixed this now. Here's a patch that does the bare minimum. I found a guide for creating your own self-signed CA. What was being done here was all wrong. For starters, you don't create a CSR for the CA itself. Even with this patch, it still doesn't install the CA certificate. Firefox will let you override this and Chrome will complain about it once per session but it may be a good idea to install it anyway.
Comment 13 James Le Cuirot gentoo-dev 2010-01-08 00:47:35 UTC
Just read in the news that 768-bit RSA encryption has been broken and 1024-bit will be next. We theremore may want to raise the default value of SSL_BITS from 1024 to 4096.
Comment 14 Peter Volkov (RETIRED) gentoo-dev 2010-02-16 14:59:59 UTC
Thank you guys for report and explanation of this problem. Should be fixed with:

http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ssl-cert.eclass?r1=1.17&r2=1.18


... still I wonder, do we really need CA? It looks like self signed certificate is better then certificate signed with some unknown CA.