-
Notifications
You must be signed in to change notification settings - Fork 933
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
CloudFoundry CLI should support SOCKS5 proxies #1047
Comments
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/137058285 The labels on this github issue will be updated when the story is started. |
Hi @jkugler Thanks for this feature request. I see it already received a few thumbs up! Regards, |
Hi @jkugler
|
To use a Socks proxy, you can use add this to an ssh invocation:
That will, of course, not work for systems without netcat installed (windows). Also, if the cf binary is not invoking an external SSH client, of course that won't work. If it is an internal library call, I would think that library would have a way to use a Socks proxy. Only being able to use it for HTTP calls would, I would think, be very frustrating when a command was invoked that required an SSH connection. I've only begun using the cf cli, so I really don't know how often we would need command invoked over SSH. |
The cf CLI does not invoke an external SSH client. So basically, what I'd like to confirm when you say "We do a lot of tunneling with SSH SOCKS proxies (the -D option). This allows us to communicate with various environments without having to be on that network directly", is whether you mean you need a SOCKS proxy for the CLI to connect to the Cloud Foundry APIs because your CF is installed on those environments, or need it for other purposes (incl. accessing your app's container with ssh). |
So, still trying to understand. How does it open an ssh shell to the app's container if it doesn't invoke an external SSH client? Is it an SSH client written via a go library built in to the cf cli? And if that is the case, can that library use a socks proxy? |
So...comes down to: if an ssh connection is being invoked for the connection to the container, then it would need to pass through the socks proxy as well. Is there a way to utilize the socks proxy information in the ssh connection as well? |
This issue is also blocking for us. We work in a corporate environnement where all outgoing internet traffic has to go through a proxy. This is really a pita, we don't have any workaround at the moment...If anyone has any kind of workaround, I would be eternally grateful to them. |
@dkoper bosh cli v2 started supporting socks5 recently as well. it uses BOSH_ALL_PROXY env var instead of all_proxy as i found it pretty annoying to not be able to use same terminal session easily for proxied and non-proxied requests. users that do not have to make such distinction can of course just set BOSH_ALL_PROXY=$all_proxy. re ssh wrapping: crypto/ssh library allows to pass in custom Conn which could have been created via a custom dialer that respects socks proxy configuration. here is an example: https://github.com/cloudfoundry/bosh-cli/blob/bd274dde4edba031cfcf7982c2e53a9f393aefb9/ssh/client.go#L116. |
@cppforlife Thanks for chiming in! @Akhena It's not that |
Sorry - didn't mean to close this. |
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/138101297 The labels on this github issue will be updated when the story is started. |
@dkoper Isn't it possible that |
Just chiming in again. While @Akhena's idea is a good one, in our case we do NOT have HTTP proxies in to these environments. The socks proxy created by our |
I agree @jkugler , my suggestion is made at the wrong place. Actually, in our corporate environnement, adding CF cli support for any of the two types of proxies (HTTP / SOCKS5) would solve our problem. |
@Akhena I believe SOCK5 procies are more common, so we'll explore that first. |
@jkugler Are you aware that you can use an external SSH client to connect to applications? I recently verified that using the normal OpenSSH client, the |
I think this is now implemented for free when we moved to go1.9 Quick sanity check worked in my new env. Neat.
|
So since cf CLI 6.31.0 you should be able to set your SOCK5 proxy with Once we figure out why |
@dkoper thanks! In our use case, we configured our ssh client to use the socks proxy directly, so never used |
@jkugler We hope to answer the why of the failure in the coming days. What I see is that |
@dkoper Thanks for the update! Protocol is NOT my area of expertise. I'm sure you can google as well as I can, but I came across this and thought it might be helpful. https://www.infoq.com/articles/Web-Sockets-Proxy-Servers tl;dr: sometimes websockets works with proxies...sometimes it does not. Can depend on the proxy. :( |
@jkugler We believe noaa, the library we use to talk to loggregator, needs changes to support this. Created cloudfoundry/noaa#38. |
@jkugler I'd like to document the SOCKS5 proxy support (with its current limitations with ssh and logs) as I assume it's mostly usable. Do you have a suggestion for where to document it? Where would you look for it? We have https://docs.cloudfoundry.org/cf-cli/http-proxy.html. I can't imagine SOCKS5 proxies are used widely enough to warrant a chapter of its own. I'm thinking of updating this chapter's title to include SOCKS5 and include it here, assuming HTTP and SOCKS5 proxy support are often documented together so that's where people would expect to find it. Does that sound fair? Of course the search DB will be updated so searches for |
Closing this issue as we will release cf cli v6.38.0 soon which will include this feature. Please note support for SOCKS5 will only be available via the |
@abbyachau Are you saying the use of socks proxies will not be available for HTTPS commands as this ticket originally requested? |
Hey @jkugler we've implemented support for SOCKS5 for
Let me know if you have any further questions/comments. |
Thanks answering, but sadly it still doesn't answer my question. :) This issue was opened because I wanted to be able to set an environment variable such as
or
(See this comment: #1047 (comment)) and that would direct all CF API calls (which are http or https traffic) over the given socks proxy. Will the feature you reference in 6.38.0 do that? Or will it just support ssh over socks proxy? |
Hey @jkugler we will support |
Very cool. Thanks! |
I am having a hard time to get |
Command
cf
CLI Version
cf version 6.23.0+c7866be18-2016-12-22
CC API Endpoint Version
N/A
It would be very nice if the CF cli supported the usage of socks proxies. We do a lot of tunneling with SSH SOCKS proxies (the
-D
option). This allows us to communicate with various environments without having to be on that network directly, and not having to set up full-blown HTTP(S) proxies for all the environments.Being able to use SOCKS5 proxies directly from the CF cli would be VERY convenient.
The text was updated successfully, but these errors were encountered: