4

我正在尝试使用 Play 插件设置 Jenkins CI,该插件使用 play 自动测试来运行应用程序。

问题是我也有 SSL 作为要求,但是 firephoque java 测试浏览器没有正确的密钥/证书来使用。

我最初使用 OpenSSL 创建了一个密钥/证书对,但现在需要弄清楚如何将这些密钥导入全局默认 Java 密钥库(大概在 $HOME/.keystore 中)。

我以不同的顺序尝试了这些资源,但无济于事:

我开始使用的原始 play google group 线程:http: //bit.ly/yZBezu

http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html

http://www.agentbob.info/agentbob/79-AB.html

http://docs.oracle.com/javase/1.3/docs/tooldocs/win32/keytool.html

当播放运行程序从 application.conf 中的条目获取密钥库位置时,我能够通过 SSL 运行应用程序,但是当自动测试运行 firephoque 浏览器时,我得到:

The application does not start. There are errors: 
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: 
    PKIX path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException:
        unable to find valid certification path to requested target

很想指出一个简洁的方法来做到这一点,我的大脑被 DER 和 PEM 的愿景和 keytool 的乐趣所煎熬,现在我无法思考。

最终目标是一个自签名证书,它将在play auto-test以及运行应用程序的任何其他方式下进行验证。

我的 application.conf 文件具有以下不同组合:

# SSL - localhost default
# original way worked fine before auto-test came into play (so to speak :))
# certificate.key.file=conf/play_host.key
# certificate.file=conf/play_host.crt

# Keystore 
ssl.KeyManagerFactory.algorithm=SunX509
trustmanager.algorithm=JKS
keystore.password=passw0rd
keystore.file=conf/keystore.jks 
https.port=9443

更新 conf/keystore.jks 的输出:

# keytool -list -keystore keystore.jks
Enter keystore password:  

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

localhost, Jan 31, 2012, PrivateKeyEntry, 
Certificate fingerprint (MD5): 36:EF:63:4E:53:23:18:22:13:8C:2C:DB:F1:72:2C:93

但是在自动测试中运行的浏览器无法访问此文件,它是 firephoque,这是一个查看默认密钥库的 java 应用程序 - 进行了更多挖掘并开始查看

/Library/Java/Home/lib/security/

哪个符号链接到

/System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security

找到任何应​​用程序都可以找到密钥库的位置。但是,如果我将另一个密钥库放在security上面的文件夹中,我仍然会得到相同的结果。

更新2:也试过

play auto-test -Xmx1g -Djavax.net.ssl.trustStore=/path/to/keystore.jks

但我不确定我做得对。如何启动播放自动测试以在显式位置查找密钥库?

4

2 回答 2

2

不优雅,但随着 1.2.5 的出现,修补 1.2.4 以使其正常工作并不是什么大不了的事。

https://github.com/playframework/play/commit/52f3c165cba1ea62e91a6c26ed62979b90da99c

感谢德托尼。

于 2012-02-01T19:26:02.867 回答
1

假设您按照以下链接中的步骤操作,您的密钥库应该有正确的信息。

http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html

您知道您的应用程序是否正在获取密钥库吗?
您能否指定密钥库文件位置的完整路径(即 keystore.file=/home/some_user/conf/keystore.jks)?
另外,您可以发送密钥库的输出吗?

于 2012-02-01T01:15:03.713 回答