2

我正在使用红帽Linux。我正在尝试运行此命令:

g8 typesafehub/play-scala

我得到了这样的回应:

从 github 对等方获取的异常未经过身份验证

但是当我使用检查连接时

openssl s_client -connect github.com:443

我明白了:

验证返回码:0(ok)

这意味着我可以连接到 github。为什么这个命令不起作用?

g8 typesafehub/play-scala

4

3 回答 3

4

RHEL 5我还在使用的VM 映像上遇到了这个问题openjdk 6。这是另一个让TrustManager我了解修复的笔记。我调整了调用,为 github 添加了信任设置;在我的情况下,它解决了对等身份验证问题。

openssl首先使用和获取 github 证书keytool,使其可供 java 访问。

echo "" | openssl s_client -connect www.github.com:443 \
    -showcerts 2>/dev/null | openssl x509 -out github.cert
keytool -import -alias github \ 
    -file github.cert -storepass g8g8g8 \
    -keystore $HOME/g8.truststore

现在用我称为“G8”的脚本重写调用:

g8 \
   \ -Djavax.net.ssl.trustStore=$HOME/g8.truststore \
   \ -Djavax.net.ssl.trustStorePassword=g8g8g8 \
   $*

现在尝试执行G8 -v typesafehub/akka-scala-sbt,我发现现在事情变得更快乐了。我想设置一个系统范围的默认信任库可能会更好,但我还没有想出来。

于 2012-11-03T06:47:04.430 回答
1

If it really is an authentication issue, check your ~/.g8/config file for authentication purpose, but you shouldn't need it for anonymous access.

Note that, according to issue 32 of giter8, it can also depends on the Java you are using.
For instance:

Sorry, that preview release of openjdk 7 is not fit for general use. (There's also giter8 issue #27 specific to openjdk on mac.) I have tested openjdk 7~b147-2.0-0ubuntu0.11.10.1 with giter8 and that worked fine, so when there is a final release available for mac you should be able to use it.

For now, please try with jdk 6 and reopen if you are still having trouble.

Another JDK (openjdk) might end up using the wrong TrustManager, as described in "Avoiding the "javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated" with HttpClient"

于 2012-06-15T08:05:25.750 回答
0

我和 B Evans 有同样的问题(谢谢!),但是在 Windows 中,所以这里是等效的代码,以防其他人遇到这个问题并且不知道如何从 windows cmd 执行此操作。我还必须从http://www.openssl.org/related/binaries.html获取 openssl

openssl s_client -connect www.github.com:443 -showcerts > out.txt
openssl x509 -out github.cert < out.txt
keytool -import -alias github -file github.cert \
 -storepass g8g8g8 -keystore C:\tmp\g8.truststore

然后将其添加到 JAVA_OPTS (我还必须处理我们的公司防火墙,因此还要处理代理......)

SET JAVA_OPTS=-Dhttp.proxyHost=our.proxy.com -Dhttp.proxyPort=8080 \
 -Dhttps.proxyHost=our.proxy.com -Dhttps.proxyPort=8080 \
 -Djavax.net.ssl.trustStore=C:\tmp\g8.truststore \ 
 -Djavax.net.ssl.trustStorePassword=g8g8g8
于 2013-01-09T15:58:32.713 回答