warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.35k stars 373 forks source link

ssh to jumphost #2100

Open ITJamie opened 1 year ago

ITJamie commented 1 year ago

Discord username (optional)

No response

Describe the solution you'd like?

I regularly have to ssh to a jumphost to then ssh to other remote hosts (with an ssh key that exists on the jumphost server)

It would be really nice when i ssh to the jump host that i could have the ssh wrapper support on the remote host. Ether by a set of bash extensions i install on the remote host or by dropping in an alias as part of bringing up the ssh connection to the ssh jump host.

In the past ive used iterm2 extensions on remote hosts (see https://iterm2.com/documentation-shell-integration.html ) to enable some of the iterm2 options on remote hosts. something similar would be nice for jumphost usage

Is your feature request related to a problem? Please describe.

No response

Additional context

No response

How important is this feature to you?

4

Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087

No response

elviskahoro commented 1 year ago

Thanks for opening. We've gotten other reports of not being compatible with jumphosts. Will try to get back to you with a link to the primary issue

dannyneira commented 1 year ago

is it #502 by any chance? @elviskahoro

ITJamie commented 1 year ago

no it would be that when your ssh'd to another box (jumphost) when you run ssh command on the other host it doesnt have the wrapper injected at that point so you lose the nice warp wrapping function.

warp should make it possible to inject its wrapper to the hosts it connects to for further ssh jumps

pixelsoccupied commented 1 year ago

hi folks, just wanted to verify if I'm also thinking of the same issue as reported here.

from localhost --> ssh root@myserver1 ✔️ can see full warp features e.g block from myserver1 --> ssh root@myserver2 ❌ no blocks (falls backs to plain terminal...no warp features)

equivalent one-liner: ssh -t root@myserver1 ssh root@myserver2 or ssh -J root@myserver1 -i /path/to/key root@myserver2

And basically we would like all the block features when jumping?

vamshiaruru commented 1 year ago

I'd like to chime into say I'd love this feature too. When using the jump host ssh using -J / -t, the terminal wrapping doesn't work anymore.

blackhuman commented 11 months ago

I found there's a workaround, when using ssh config file with the ProxyJump directive to login into the remote server, Warp block can work perfectly. I've only tested on my own evnironment, not sure this is a general workaround.

given the ssh config file as follows.

# ~/.ssh/config
Host remoteserver
  HostName 192.168.200.200
  User dev
  IdentityFile ~/.ssh/<your_key>
  Port 2048
  ProxyJump jumperserver

Host jumperserver
  HostName 192.168.200.100
  User dev
  IdentityFile ~/.ssh/<your_key>
  Port xxxx

and use ssh command in Warp as nomral.

# shell
ssh remoteserver
wonb168 commented 11 months ago

Not work via jumpserver, First,I use ssh jump@jumpserver, then, p then, 1 then input username and password into the target server, then all in one block,and can't use all warp features

image

HOW to use all feature in target server via jumpserver.

dannyneira commented 11 months ago

Hi Folks, sorry about this issue. Since the SSH Wrapper is already enabled on the jump server, Warp treats any further ssh connections like a subshell. You can workaround this by adding the subshell line to your remote ssh server rc files.

# For zsh subshells, add to ~/.zshrc.
printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "zsh"}}\x9c'

# For bash subshells, add to ~/.bashrc or ~/.bash_profile.
printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "bash"}}\x9c'

# For fish subshells, add to ~/.config/fish/config.fish.
if status is-interactive
  printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "fish"}}\x9c'
end

then, once you SSH into the remote server it should automatically warpify the subshell and enable Warp features. https://docs.warp.dev/features/subshells#automatically-warpify-subshells

Please let us know if this was helpful.

ruhengChen commented 10 months ago

Hi Folks, sorry about this issue. Since the SSH Wrapper is already enabled on the jump server, Warp treats any further ssh connections like a subshell. You can workaround this by adding the subshell line to your remote ssh server rc files.

# For zsh subshells, add to ~/.zshrc.
printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "zsh"}}\x9c'

# For bash subshells, add to ~/.bashrc or ~/.bash_profile.
printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "bash"}}\x9c'

# For fish subshells, add to ~/.config/fish/config.fish.
if status is-interactive
  printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "fish"}}\x9c'
end

then, once you SSH into the remote server it should automatically warpify the subshell and enable Warp features. https://docs.warp.dev/features/subshells#automatically-warpify-subshells

Please let us know if this was helpful.

this way is worked, but every command is stucked by loading prompt... @dannyneira 2023-12-28 16 58 42@2x use twice ctrl+d can exit loading, but next command is the same ...

TheFern2 commented 2 months ago

I found there's a workaround, when using ssh config file with the ProxyJump directive to login into the remote server, Warp block can work perfectly. I've only tested on my own evnironment, not sure this is a general workaround.

given the ssh config file as follows.

# ~/.ssh/config
Host remoteserver
  HostName 192.168.200.200
  User dev
  IdentityFile ~/.ssh/<your_key>
  Port 2048
  ProxyJump jumperserver

Host jumperserver
  HostName 192.168.200.100
  User dev
  IdentityFile ~/.ssh/<your_key>
  Port xxxx

and use ssh command in Warp as nomral.

# shell
ssh remoteserver

This is what I do, and also found it to work.