Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins slave using an ssh gateway

Tags:

ssh

proxy

jenkins

I have jenkins running on master.com, and want to have a slave running on slave.com. However, to ssh to the slave I need to go through gateway.com. Generally to ssh to this machine from my normal account, I just use ~/.ssh/config to set up a ProxyCommand.

I have replicated this setup in my /var/lib/jenkins/.ssh/config file:

Host slave.com
 User felix
 ProxyCommand ssh [email protected] nc %h %p

I have public key authentication set up for both the gateway and the slave, such that from the command line I can ssh directly from [email protected] to [email protected] simply by doing ssh slave.com.

Unfortunately Jenkins does not seem to respect my .ssh/config setup, and the connection times out (the slave is not reachable directly). The Jenkins slave log file is:

java.io.IOException: There was a problem while connecting to slave.com:22
....
Caused by: java.net.ConnectException: Connection timed out

How can I figure out whether or not jenkins is respecting my .ssh/config file? Am I missing a step in configuring the master jenkins account or the .ssh/config file for jenkins?

like image 413
Felix Avatar asked Feb 25 '14 18:02

Felix


1 Answers

The jenkins-ssh-slaves plugin uses the trilead SSH2 implementation written in Java.

~/.ssh/config is only read by OpenSSH, and won't affect how Jenkins connects to your slaves.

like image 121
chris Avatar answered Oct 10 '22 22:10

chris