SSH through gateway server

425 views
Skip to first unread message

Salut

unread,
May 20, 2012, 3:46:31 AM5/20/12
to Jenkins Developers
Hi All,

I am trying to execute SSH on a remote server, which includes a
gateway server in between to contact it. I was not able to run my
commands directly on the main server. I should do a SSH to the gateway
server and then from there the main server. I am using the existing
SSH plugins available in Jenkins through which i could connect to
gateway server. But I couldn't write one more SSH shell script since
the main server requires password and SSH doesn't allow sending
password in command line.

How can i sort this issue?? Does Jenkins provide a way to achieve this
scenario?

Thanks in advance.

Christopher Orr

unread,
May 21, 2012, 7:15:43 AM5/21/12
to jenkin...@googlegroups.com
Hi there,

This question is probably better suited to the jenkinsci-users mailing list.

On 05/20/2012 09:46 AM, Salut wrote:
> I am trying to execute SSH on a remote server, which includes a
> gateway server in between to contact it. I was not able to run my
> commands directly on the main server. I should do a SSH to the gateway
> server and then from there the main server. I am using the existing
> SSH plugins available in Jenkins through which i could connect to
> gateway server. But I couldn't write one more SSH shell script since
> the main server requires password and SSH doesn't allow sending
> password in command line.

You should set up public-key authentication to your SSH servers, rather
than requiring passwords.

However, if you really must hardcode an SSH password, you can use
sshpass -- it should be packaged for most distros.

Alternatively, if Jenkins respects the ssh_config(5) file (I don't know
whether it does), you could get rid of the SSH script by wrapping this
up in a Host config like this:

Host <slave-hostname>
Ciphers arcfour
ProxyCommand sshpass -p<gw-pass> ssh <gw-user>@<gw-host> nc %h %p

Then you could just set up the remote slave hostname, username and
password in the Jenkins UI and it should magically work, tunnelling
through the gateway server.

Regards,
Chris

Salut

unread,
May 22, 2012, 1:32:18 AM5/22/12
to Jenkins Developers
Thanks Chris,

For time being i used ssh-keygen and transferred it to the main
server .ssh/authorized_keys.
Reply all
Reply to author
Forward
0 new messages