2

I am using red hat linux. I am trying to run this command:

g8 typesafehub/play-scala

And I am getting this response:

Exception fetching from github peer not authenticated

But when I check the connection using

openssl s_client -connect github.com:443

I get this:

Verify return code: 0 (ok)

Which means that I am able to connect with github. Why doesn't this command work?

g8 typesafehub/play-scala

Bibhas Debnath
  • 14,559
  • 17
  • 68
  • 96
user1435853
  • 633
  • 2
  • 8
  • 18

3 Answers3

4

I also ran into this issue on an RHEL 5 VM image where I am using openjdk 6. It was the other note to look at TrustManager clued me in on a fix. I tweak the invocation to add a trust setting for github; in my situation it resolves the peer authentication issue.

First grab the github certificate using openssl and keytool to make it accessible to 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

Now to rewrite the invocation with a script I call "G8":

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

Now try executing G8 -v typesafehub/akka-scala-sbt and I see things are much happier now. I imagine setting a systemwide default truststore would may be better but I haven't figured that one out yet.

B Evans
  • 61
  • 3
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"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I had the same issue as B Evans (thanks for this!), but in Windows, so here is the equivalent code in case someone else has this issue and doesn't know how to do it from windows cmd. I also had to get openssl from http://www.openssl.org/related/binaries.html

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

Then add the same to JAVA_OPTS (I also had to deal with our corporate firewall and hence proxy as well...)

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
David
  • 199
  • 1
  • 9