Re:SSH Proxy Commands that use `sed`
by kbenson on Friday March 27, 2015 @02:25PM
(#9278155)
Does the ProxyCommand directive run the rc scripts of the bastion account? If so, control over the box isn't needed, just control over the bastion user account. Setting a custom $PATH and providing a custom sed, or a custom echo for that matter, would be easier then. Absolute paths are important for this reason. This is exactly why ./ isn't in $PATH (like in DOS/Windows), so someone can't drop a commonly named executable somewhere that accidentally gets run.
[ Parent
| on HN ]
Depends on your shell, but you can try this yourself -- for instance:
$ ssh localhost -o ProxyCommand="ssh localhost 'pstree -a \$PPID >&2 ; nc %h %p'"
sshd
`-bash -c pstree -a $PPID >&2 ; nc localhost 22
`-pstree -a 6703
Bash invoked this way will be non-interactive. Often bashrc will test "$PS1" to bail early in this case, but the point remains that it does run. I also tried my command with echos before and after that test in my bashrc to confirm what happens.