11
votes

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?

2
I ran into the same issue. Do you have an update @Felix?Split Your Infinity
Unfortunately not; my "workaround" was to get a slave machine setup outside of the gateway.Felix

2 Answers

10
votes

Instead of using Jenkin's built in SSH implementation, use the "Launch slave by execution of command on the Master". You can then use the regular ssh command, and take advantage of .ssh/config like you're used to. If you click the ? button next to the option, it should give you all the details you need.

4
votes

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.