通过socks代理连接到Jenkins Node

时间:2018-03-29 13:56:08

标签: jenkins ssh

我将Jenkins部署在公司代理服务器后面。我想在AWS上通过ssh启动节点,所以我需要通过代理执行ssh。

我已在var/lib/jenkins/.ssh/config中添加了这些行:

Host <aws host>
ProxyCommand connect -S proxyhost:port %h %p

通过这些更改,我可以使用命令ssh从我的linux手动将ssh -i /var/lib/jenkins/.ssh/other user@aws作为jenkins用户手动{,1}},但我无法通过ssh启动jenkins节点。我在连接到aws时遇到连接超时。

1 个答案:

答案 0 :(得分:1)

基于this articleJava docs,您将必须使用一些其他标志来启动Jenkins,以下是文档:

  

袜子   这是另一种代理。它允许较低级别的   隧道,因为它在TCP级别上起作用。实际上,在Java(tm)中   平台设置SOCKS代理服务器将导致所有TCP   通过该代理的连接,除非有其他代理   指定。如果Java SE实施支持SOCKS,则   将使用以下属性:

socksProxyHost (default: <none>)
The hostname, or address, of the proxy server.

socksProxyPort (default: 1080)
The port number of the proxy server.

socksProxyVersion (default: 5)
The version of the SOCKS protocol supported by the server. The default is 5 indicating SOCKS V5, alternatively 4 can be specified for
     

袜子V4。将属性设置为这些值以外的值会导致   未指明的行为。

java.net.socks.username (default: <none>)
Username to use if the SOCKSv5 server asks for authentication and no java.net.Authenticator instance was found.

java.net.socks.password (default: <none>)
Password to use if the SOCKSv5 server asks for authentication and no java.net.Authenticator instance was found.

很可能看起来像这样

java -DsocksProxyHost=some.proxy.host -jar jenkins.war

假设您使用文档默认设置。