我正在尝试使用Play插件设置Jenkins CI,该插件使用播放自动测试来运行应用。
问题是我还要求SSL,但是firephoque java测试浏览器没有使用正确的密钥/证书。
我最初使用OpenSSL创建了一个密钥/证书对,但现在需要弄清楚如何将这些密钥导入全局默认Java密钥库(可能在$ HOME / .keystore中)。
我以不同的顺序尝试了这些资源但无济于事:
我开始使用的原始游戏谷歌小组帖子: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
但我不确定我做得对。如何启动播放自动测试以在明确的位置查找密钥库?
答案 0 :(得分:2)
不是很优雅,但是在播放1.2.5的情况下,修补1.2.4并不是什么大不了的事情。
https://github.com/playframework/play/commit/52f3c165cba1ea62e91a6c26ed62979b90da99c
感谢dertoni。
答案 1 :(得分: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)吗? 另外,您可以发送密钥库的输出吗?