How to have jenkins-cli.jar work with Jenkins running https?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 23:16:36

问题


Has anyone successfully run Jenkins-cli.jar for https protocol?

I kept getting connection error from client side to Jenkins on https. Could anyone help me on this? My sincere appreciation.

-> java -Djavax.net.ssl.trustStore=/tmp/jenkins2/jenkinskeystore.jks -Djavax.net.ssl.trustStorePassword=<password> -jar jenkins-cli.jar -s https://jenkins2.eng.proofpoint.com:8443 help
Exception in thread "main" java.io.IOException: Failed to connect to https://jenkins2.eng.proofpoint.com:8443/
        at hudson.cli.CLI.getCliTcpPort(CLI.java:266)
        at hudson.cli.CLI.<init>(CLI.java:126)
        at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
        at hudson.cli.CLI._main(CLI.java:466)
        at hudson.cli.CLI.main(CLI.java:382)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:882)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
        at hudson.cli.CLI.getCliTcpPort(CLI.java:264)
        ... 4 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
        at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:462)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:863)
        ... 11 more

Where:

  • /tmp/jenkins2/jenkinskeystore.jks is a copy of /u/xbuild/.ssh/jenkinskeystore.jks from following server command.
  • is same password as in the following server command
  • jar jenkins-cli.jar was extracted from /share/pub/build/jenkins2/bin/jenkins.war in the following server command
  • the following Jenkins server is running on Jenkins ver. 1.605.

The server process:

$ /etc/alternatives/java -Djava.awt.headless=true -server -Xms2048m -Xmx8192m -XX:PermSize=512m -XX:MaxPermSize=1024m -DJENKINS_HOME=/share/pub/build/jenkins2 -jar /share/pub/build/jenkins2/bin/jenkins.war --logfile=/share/pub/build/jenkins2/log/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=-1 --httpsPort=8443 --httpsKeyStore=/u/xbuild/.ssh/jenkinskeystore.jks --httpsKeyStorePassword=<password> --ajp13Port=-1 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
$ hostname
jenkins2.eng.proofpoint.com

来源:https://stackoverflow.com/questions/29955372/how-to-have-jenkins-cli-jar-work-with-jenkins-running-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!