Jenkins Double SSH Remote Connection

2019-09-15 18:32发布

问题:

I have a bit unusual environment. In order to connect to the machine B via ssh, I need connect to the machine A and from that box, connect to B, and execute a number of commands there.

Local --ssh--> Machine A --ssh--> Machine B (some commands to execute here)

Generally speaking, Machine A is my entry point to all servers.

I am trying to automate the deployment process with Jenkins and wondering, if it supports such unusual scenario.

So far, I installed the SSH plugin and able to connect to Machine A, yet I am struggling with a connection to Machine B. The jenkins process freezes on the ssh command to Machine B and nothing happens.

Does anyone have any ideas how I can make such scenario work?

回答1:

The term for Machine A is a "bastion host", which might help your googling.

This link calls it a "jump host", and describes a number of ways to use SSH's ProxyCommand setting to setup all manner of inter-host SSH communication:

https://www.cyberciti.biz/faq/linux-unix-ssh-proxycommand-passing-through-one-host-gateway-server/



标签: jenkins ssh