0

We use jump hosts to access our hardware. These hosts are short-lived (less than a day), and are different every time they're generated. I would like to be able to configure my local .ssh/config file to have the aliases to my real hardware, and be able to forward those aliases to my jump host.

I had tried the following command but it failed:

ssh <jumphost> -t bash -ci ssh <hostalias>

Are there any options that I can try?

jumphost don't mind hand typing, because it is changes so frequently. I just would like a way to automate the process of jumping to that host, and then to the real hardware from there.

2

In your .ssh/config:

Host farsidehost
    HostName acutalremotehostname.example.com
    ProxyJump bastionhost.example.com

You can then execute ssh farsidehost.

If as your updates tell, the name of the jumphost changes frequently, you can instead specify it on the commandline:

$ ssh -J jumphostoftheday.example.com actualremotehostname.example.com

If there is some way to procedurally find the name of the jumphost, this can be automated:

$ ssh -J $( determine_jump_host ) actualremotehostname.example.com
  • Hey thanks, I should make it more clear in my question; our jump hosts are different every time (they only live for a few hours at a time). – MrDuk Sep 13 '18 at 17:07
  • In that case you can on the command line specify the jump host: ssh -J jumphost.example.com farsidehost.example.com. – DopeGhoti Sep 13 '18 at 17:09
1

Use local variable names for the real hardware, and have your local ssh command line expand those variables.

proddb=dc1r12u10.internal.dns
jumper=vm20180913.internal.dns
ssh $jumper -t bash -ci ssh $proddb
  • Hey thanks, I made it more clear in my question just now, sorry; our jump hosts are different every time (they only live for a few hours at a time). – MrDuk Sep 13 '18 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.