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

Support proxy connection with SSH Tunnel through bastion server #2865

Closed
cyberduck opened this issue Jan 9, 2009 · 38 comments
Closed

Support proxy connection with SSH Tunnel through bastion server #2865

cyberduck opened this issue Jan 9, 2009 · 38 comments
Assignees
Labels
Milestone

Comments

@cyberduck
Copy link
Collaborator

95d3de5 created the issue

Coming from Windows, I used WinSCP for my SFTP transfers. One of the features I miss in Cyberduck is the ability to connect to SFTP though another machine via SSH.

For example, I have a gateway that machine with an SSH server. When I connect to that server via SSH, I can then connect to another machine (inside the network) via SSH.

So having the ability to tunnel through one SSH server to another SSH server for SFTP transfers would be great. Right now, I have to log into the gateway, map a local port to the final machine, and use Cyberduck to connect to localhost:22 after the connection to the gateway has been made.

This would be a wonderful feature and a HUGE help to me and others in similar situations.


Attachments

@cyberduck
Copy link
Collaborator Author

5327009 commented

I just would like to second this feature request. We also have to access all our files through a gateway machine. It would be very helpful if one could do this via Cyberduck, without extra work.

@cyberduck
Copy link
Collaborator Author

ff038db commented

I would like to third this request. I have the following setup in my ~/.ssh/config file:

Host gateway
  Hostname gateway.mydomain.com

Host server1
  HostName	server1.mydomain.com
  ProxyCommand	ssh gateway netcat %h %p 

This works perfectly for ssh and scp in the Terminal, but not with Cyberduck. Would there be a way for Cyberduck to use that information?

@cyberduck
Copy link
Collaborator Author

4f2c907 commented

this would be very useful for me too

@cyberduck
Copy link
Collaborator Author

ade52fa commented

Seconded this request as well, it'd be hugely useful.

@cyberduck
Copy link
Collaborator Author

65121d1 commented

I have to also ask for this. This is a common corporate strategy and we are stuck dealing with it in strange ways.

@cyberduck
Copy link
Collaborator Author

4acee99 commented

This would be a useful addition for those of us who host machines behind an SSH-enabled gateway host and prefer to avoid opening multiple ports for each machine behind that host.

SSHFS from MacFuse, SCP and regular SSH all support the ProxyCommand config directive.

Other tickets which touch on or duplicate this request are: #958, #2104, #3030.

@cyberduck
Copy link
Collaborator Author

cdcb698 commented

I would also love to see this feature. (I kind of just assumed Cyberduck would automatically support this, since everything else that I use that goes through ssh automatically does, and I banged my head on the wall for a while trying to figure out why it wasn't working.)

@cyberduck
Copy link
Collaborator Author

dbab61c commented

I concur with all in this thread. This would help out allot for thous of us whom would like to use Cyberduck with ssh "jumpbox" (ProxyCommand). I use something similar to @pablo.englebienne in my ~/.ssh/config file:

Host proxy_jumpbox
  DynamicForward 8080
  HostName jumpbox.ssh-access-to-outside.myprotecteddomain.com 

Host *.NOssh-access-to-outside.myprotecteddomain.com
  EscapeChar none
  StrictHostKeyChecking no
  ProxyCommand /usr/bin/nc  -x localhost:8080 %h %p

When I want to connect into any machine under *.NOssh-access-to-realworld.myprotecteddomain.com domain I first open a connection to the outside accessible jump host: $ssh proxy_jumpbox. Then all the subsequent connections to the boxs w/o access to the internets *.NOssh-access-to-realworld.myprotecteddomain.com get tunneled via the DynamicForward+(ProxyCommand/nc) proxy_jumpbox.

Support for functionality like this would be awesome. +bump

@cyberduck
Copy link
Collaborator Author

f8fbd13 commented

Adding my name to the list of people who have requested this. I use SSH tunnel only on rare occasions, but when I need it, it's for a good reason.

Fugu http://rsug.itd.umich.edu/software/fugu/ can do this, but I like Cyberduck.

@cyberduck
Copy link
Collaborator Author

Gabrielradic commented

Many hosting providers, especially for dedicated boxes, would provide a free space server to an (S)FTP. The catch is that the server would only work from inside that specific network. Some hosters providing this system are Hetzner, Dedibox and OVH, all huge.

Having a tunnel option for any (S)FTP connection would allow managing the backup space without much hassle.

@cyberduck
Copy link
Collaborator Author

e1630ff commented

this would be very useful for me, too.

@cyberduck
Copy link
Collaborator Author

07b56f4 commented

dkocher:

Can I ask you why you changed this back? Do you have any plans on developing this, or? I thought it was ok, since this is quite old. I'm also open to come collaboration.

/DSDeniso

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Replying to [comment:16 DSDeniso]:

dkocher:

Can I ask you why you changed this back? Do you have any plans on developing this, or? I thought it was ok, since this is quite old. I'm also open to come collaboration.

I would certainly welcome code contributions which would allow it to schedule for a milestone.

@cyberduck
Copy link
Collaborator Author

07b56f4 commented

Replying to [comment:17 dkocher]:

Replying to [comment:16 DSDeniso]:

dkocher:

Can I ask you why you changed this back? Do you have any plans on developing this, or? I thought it was ok, since this is quite old. I'm also open to come collaboration.

I would certainly welcome code contributions which would allow it to schedule for a milestone.

I'm sorry. I don't think that I understand your message. Will you please try to explain in a bit more in depth? My formatting also looks wrong, so I'm maybe also missing some part of your comment.

Thanks,
/DSDeniso

@cyberduck
Copy link
Collaborator Author

4728f41 commented

+1

@cyberduck
Copy link
Collaborator Author

http://openid.lyraphase.com/ commented

Surprised that this isn't already a part of Cyberduck, although I guess that this means it doesn't use built-in ssh & ~/.ssh/config.

@cyberduck
Copy link
Collaborator Author

f1dc5c8 commented

Most companies uses jumpboxes and without SSH Tunnel support its not easy to use Cyberduck.
I think, It's easy and very helpful change for new release

+one

@cyberduck
Copy link
Collaborator Author

94b5859 commented

I agree; I'm surprised this feature doesn't exist, as it's a very common situation. For example, Amazon suggests setting up a bastion server for EC2 instances (https://blogs.aws.amazon.com/security/post/Tx3N8GFK85UN1G6/Securely-connect-to-Linux-instances-running-in-a-private-Amazon-VPC), so if you want to transfer files to and from your instance, you have to first tunnel through the bastion server. Please add this functionality.

@cyberduck
Copy link
Collaborator Author

f3a2704 commented

+1, it would be very useful to have SSH tunnel information in the settings for a specific bookmark and avoid having to manually reopen the tunnel when the connection drops.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

#8688 closed as duplicate.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

#9304 closed as duplicate.

@cyberduck
Copy link
Collaborator Author

a6e2bdf commented

I'd like to also nominate this feature - it is critical in enterprise environments that SSH bastion's or jumpbox's are reliably employed.
There are two primary configuration components needed for this to work well: ProxyCommand, and ForwardAgent.

Consider this example where I first define my bastion host, and second define a host domain range for which I'd like to tunnel connections through the bastion.

Host bastion
Hostname        bastion.mydomain.com
User            jcw
IdentityFile    /Users/.../jcw.pem

Host *.mydomain.com
User            jcw
IdentityFile    /Users/.../jcw.pem
ProxyCommand    ssh -vvv bastion -W %h:%p -q
ForwardAgent    yes

The ProxyCommand is self-explanatory, and the crux of this topic.
ForwardAgent is an important nuance, allowing the client to remain the only holder of their private key (it should not live on the bastion!).

If these things were in place, I would be using Mountain Duck as part of my core workflow every day!

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Some references

@cyberduck
Copy link
Collaborator Author

@dkocher commented

#9708 closed as duplicate.

@cyberduck
Copy link
Collaborator Author

ea3ae99 commented

It would be great if this were a thing. Right now I have to use a different product to be able to accomplish this. As much as I love cyberduck, if i dont have this feature I cannot use this product. Its sad that this has been open for 8 years.... 2016... and cannot ssh tunnel... tsk tsk.

Please implement.

@cyberduck
Copy link
Collaborator Author

f1dc5c8 commented

Hi micah, which product are you using support ssh tunnel, I cannot find any so I'm continue to use this, if you found can you share the name

@cyberduck
Copy link
Collaborator Author

ea3ae99 commented

I may have misspoke a little. I have an ssh config that does the proxying for me. Other clients respect this config and work as expected. When I use cyberduck it will not let use the setting i have setup in the .ssh/config file.

Host domenode
  HostName somenode
  ForwardAgent yes

Host someprefix-* !somenode*
  Compression no
  ForwardAgent yes
  HostName %h
  ProxyCommand ssh somenode -W %h:%p

With this I get this error.
cyberducktunnelerror.png

For context, I can ssh to somenode just fine.

I also think native support would be best since you dont have to rely on ssh configs.

@cyberduck
Copy link
Collaborator Author

f1dc5c8 commented

yep, 8 years ago task was created with same request "even if you are not support tunnel, at least let cyberduck to use ~/.ssh/config" but it is not support

@cyberduck
Copy link
Collaborator Author

ea3ae99 commented

Is there a timeline for supporting .ssh/config settings? or support it natively?

@cyberduck
Copy link
Collaborator Author

f1dc5c8 commented

I’m also a user, but 8 years clearly shows it won’t happen.

@cyberduck
Copy link
Collaborator Author

ac56a80 commented

I found myself desperately needing to access a VPN that was connected to on a remote host, from my localhost (Mac). Specifically, I wanted CyberDuck on my Mac to have access to hosts on a VPN that only a remote (but locally accessible) host had access to. But I found the ProxyCommand setting that works perfectly with BBEdit's SFTP infrastructure, doesn't work with Cyberduck.

WORKAROUND: I set up an ssh tunnel daemon using the Mac "SSH Tunnel" app (paid app) from the App Store, using the app as convenient way to track and manage tunnels (in my case, all one of them), but no magic there, it's just uses ssh -L ... (many examples of setting up that kind of tunnel, online). Once a tunnel is running that bridges the Mac to a host on VPN via the the VPN-connected remote host (lets call it the proxy), I connect with Cyberduck running on the mac to the tunnel port on same mac Cyberduck running on (e.g. to localhost:), and whalla - CyberDuck now has access to a host on the VPN. The downside of this workaround might be an avoidable performance hit (e.g. redundant ssh encryption of the I/O streams).

It would be helpful if CyberDuck supported the ProxyCommand ssh config option, or at least would explain their position on the matter, in any case (I.e. Are there future plans to add this? Is it deferred? Is it technically not feasible? Skipped due to the availability of workarounds? Not enough demand? Not interested, etc...?)

@cyberduck
Copy link
Collaborator Author

ac48fff commented

This would be very useful to me too! I tried almost all ssh/scp clients for mac and currently there is no GUI client capable of doing this.
With sshfs it would look something like this if you dont fill out the ~/.ssh/config file (and using private key auth) :

/etc/ssh/sshd_config file on the server:

Match User john
  ForceCommand nc -q0 192.168.1.10 22

mount command on client:

sshfs john@my-entry-server.hu:/ my_local_folder/ -o ProxyCommand='ssh -q john@my-entry-server.hu -i ~/id_rsa_user_v2' -o IdentityFile='~/id_rsa_user_v2’

if you have the config file:

host internal_server
user john
ProxyCommand ssh -q john@my-entry-server.hu -i ~/id_rsa_user_v2
IdentityFile ~/id_rsa_user_v2

then it is just:

sshfs internal_server: my_local_folder/

@cyberduck
Copy link
Collaborator Author

@dkocher commented

We would intend to support the ProxyJump directive from the OpenSSH configuration.

The main method is to use an SSH connection to forward the SSH protocol through one or more jump hosts, using the ProxyJump directive. Using the ProxyCommand option to invoke Netcat as the last in the chain is a variation of this for very old clients.

Starting from OpenSSH 7.3, released August 2016[1], the easiest way to pass through one or more jump hosts is with the ProxyJump directive in ssh_config(5).

@cyberduck
Copy link
Collaborator Author

@dkocher commented

In 410a54d. Documentation in Connect via SSH tunnel through bastion server.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Can be tested as of snapshot build 7.6.5.33632 or later.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Milestone renamed

2 similar comments
@cyberduck
Copy link
Collaborator Author

@dkocher commented

Milestone renamed

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Milestone renamed

@iterate-ch iterate-ch locked as resolved and limited conversation to collaborators Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants