Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature suggestion: Multi hop connections #113

Open
mgttlinger opened this issue Jul 15, 2019 · 3 comments
Open

Feature suggestion: Multi hop connections #113

mgttlinger opened this issue Jul 15, 2019 · 3 comments

Comments

@mgttlinger
Copy link

This could be relevant for accessing cluster machines through a gateway machine.

@sdowdy
Copy link

sdowdy commented Jul 15, 2019

FWIW, here's what i do for 'ssh' connections ...

[~/.ssh/config]
Host    *!*
    LogLevel ERROR
    ProxyCommand $(h="%h";p="%p" ; echo ssh -o 'LogLevel=ERROR' -W ${h##*\!}:%p -l root ${h%%\!*})

Then, for pdsh, i do:

pdsh -lroot -w 'cluster-login-node!node[1-64]'

Just be sure you escape the '!' -- I have seen others use '+' as the hop-delimiter character.
I used to use '::' but found that 'scp' wouldn't support that, even though 'ssh' did.
NOTE:
:: (DECnet style gateway hops ;) )
! (bitnet style routing ;) )

Unfortunately, i haven't figure out if there's any way (i don't think so at this point), to use ProxyJump directive in a macro substitution way. It seems to only support hardcoded names, so you'd need one for every cluster login node (bleah).

You could also create a POSIX function like:


jpdsh() {  
    jumphost="${1:?JumpHost?}"
    hostspec="${2:?host-spec?}"
    shift; shift
    export PDSH_SSH_ARGS_APPEND="-J ${jumphost} -o stricthostkeychecking=no"
    pdsh -w "${hostspec}" "$@"
}

to leverage a dynamic value for the Jump Host.
(i put in stricthostkeychecking=no for my test, as there's no way to approve hostkey mismatch via JumpHost -- nor would you want to for N compute nodes :-( )

@sdowdy
Copy link

sdowdy commented Jul 15, 2019

Oof, sorry, quick note, i actually use '!!' and edited the ssh config stanza only partially.
So, you'd need to replace the '!!' in the ProxyCommand entry with '!'. I had a '!' and a '!!' entry like this, and kinda forgot, but i think i used '!' for non-root, and '!!' for 'root'. I have a MUCH more complicated one that allows an arbitrary chain of "[user@]host..." specs, but never use it.
EDIT: fixed it via edit (i dont' use github much, and forgot i could)

@iavael
Copy link

iavael commented Nov 23, 2023

Also you can use ProxyJump feature in relatively new openssh client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants