我正在尝试使用 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
但我不确定我做得对。如何启动播放自动测试以在显式位置查找密钥库?