Bug #45280 | For SSL connection Keystore Requires Import of Client Key | ||
---|---|---|---|
Submitted: | 3 Jun 2009 3:39 | Modified: | 18 Jan 2010 14:44 |
Reporter: | Donna Harmon | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J Documentation | Severity: | S3 (Non-critical) |
Version: | 5.1.7 | OS: | Any |
Assigned to: | Tony Bedford | CPU Architecture: | Any |
[3 Jun 2009 3:39]
Donna Harmon
[3 Jun 2009 5:52]
Jon Stephens
I'll take this one, given its possible connection to BUG#44198.
[5 Jun 2009 20:49]
Donna Harmon
Problem with Generating New Certificate Documentation on same page as well: Is currently: To generate your own client certificate, use keytool to create a suitable certificate and add it to the keystore file: shell> keytool -genkey -keyalg rsa \ -alias mysqlClientCertificate -keystore keystore ... Should be something like: 1) Generate Initial Key Pair shell> keytool -genkey -keysize 1024 -keyalg rsa -alias mysqlClientCertificate -keystore keystore 2) Generate a CA Certificate Signing Request shell> keytool -certreq -v -alias mysqlClientCertificate -keystore keystore -file client-sign-request.pem 3) Sign the Certificate shell> openssl x509 -req -in client-sign-request.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > client-signed.pem 4) Import the CA Certificate shell> keytool -import -alias CACertificate -file ca-cert.pem -keystore keystore 5) Import the Signed Certificate into the Keystore shell> keytool -import -keystore keystore -alias mysqlClientCertificate -file client-signed.pem
[15 Sep 2009 14:07]
Steve Cohen
Thanks very much for this. I'd been banging my head against this wall for a day. One further point: In later editions of the JDK, keytool command names have been changed. genkey is now genkeypair, etc. I guess the old names will still work but the mysql documentation should probably reflect the differences somehow. Also, there appears to be much confusion. Users are reporting "solutions" that only solve encryption (REQUIRE SSL) but not authentication (REQUIRE X509). This whole topic deserves better documentation, which one would think should be doable now that Sun and MySQL are one. In any case, thanks to Donna Harmon for providing this.
[16 Sep 2009 18:03]
Steve Cohen
Unfortunately, I cannot get either of the methods suggested by Donna Harmon to work. The first method ("importing an existing Client Certificate") fails on this step: Import the Client Certificate into the keystore using keytool: shell> keytool -import -file client-cert.pem -keystore keystore -alias mysqlClientCertificate with the error keytool error: java.lang.Exception: Input not an X.509 certificate It's not entirely clear in this explanation where client-cert.pem was supposed to have come from but I assumed it was from the script created here: http://dev.mysql.com/doc/refman/5.1/en/secure-create-certs.html which I had previously run. In any case, still no joy with the first method. As far as the second method goes, it all the steps complete successfully but if I try to run a simple java program that uses the keys to access mysql defining on the command line the following parameters javax.net.ssl.keyStore javax.net.ssl.keyStorePassword javax.net.ssl.trustStore javax.net.ssl.trustStorePassword I get the following error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty I am not an expert but I do notice that the second method never mentions the truststore, unlike the first method. Could this be why it doesn't work? I wonder why this defect is considered "minor". MySQL is distributing documentation that is flat out incorrect, and this brave attempt at a fix also is insufficient. This should be a fairly simple process - but I have wasted days on experimenting. One should not need to be a JSSE expert to set this up.
[18 Jan 2010 14:44]
Tony Bedford
Will be fixed as part of major Connector/J docs rewrite. See WL #4462 (a note has been made of this bug in that worklog item).