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

Using Apache HttpComponents does not honor the JVM Proxy settings #75

Closed
schulzh opened this issue Feb 3, 2017 · 10 comments
Closed

Using Apache HttpComponents does not honor the JVM Proxy settings #75

schulzh opened this issue Feb 3, 2017 · 10 comments
Assignees
Milestone

Comments

@schulzh
Copy link

schulzh commented Feb 3, 2017

Spring-cloud-vault does not respect the http.proxyHost and http.proxyPort system parameters when connecting to vault, it always tries to connect directly. This makes it unusable behind a proxy like in many corporate environments.

@spencergibb
Copy link
Member

It seems strange to me to connect to vault, the thing that stores secrets, via a proxy. Why exactly would you require it?

@schulzh
Copy link
Author

schulzh commented Feb 3, 2017

Well, I cannot connect to vault, running on AWS, from my workplace behind the firewall. The proxy does not intercept SSL, so the connection is still secured end to end.
It is not that uncommon for enterprise networks to use proxy servers for all internet facing connections.

@mp911de
Copy link
Member

mp911de commented Feb 3, 2017

Proxy support depends on the used HTTP client. Spring Vault supports Apache HttpComponents, OkHttp 2+3, Netty and the JDK client (in that order of dependencies available during runtime).

You can provide an own ClientFactoryWrapper bean that holds a configured ClientHttpRequestFactory configured with a client that either respects the system properties or is configured to use a proxy.

@spencergibb
Copy link
Member

@schulzh so for development purposes? Vault is very easy to run locally, plus what @mp911de about configuring the http client.

@schulzh
Copy link
Author

schulzh commented Feb 3, 2017

@spencergibb No, not for development. We have internal applications that need to access secrets on this vault, which is hosted outside of the corporate network, therefore we need to access it via the proxy. There is simply no other way to do that, and it works just fine with the command line client, Jenkins plugins, etc.; just not with Spring-cloud-vault.

Thanks @mp911de, I will look into that solution. Still, as vault is an HTTP application, it should honor the proxy settings of the JVM per default.

@schulzh schulzh changed the title Unable to use Proxy to access Vault Spring-cloud-vault does not honor the JVM Proxy settings Feb 3, 2017
@mp911de
Copy link
Member

mp911de commented Feb 3, 2017

From a technical perspective, if there is no external HTTP client, the JDK HTTP client is used which takes proxy system properties into account. As soon as an external HTTP client is on the class path, the JDK HTTP client is no longer used.

I think it would make sense to support HTTP proxy configuration because runtime environments can sometimes require a HTTP proxy. Any intercepting proxy is a threat for secrets and I assume that client certificate authentication stops working when using an intercepting proxy. We could provide proxy support for Apache HttpComponents, OkHttp 2 and 3 via system properties and configuration properties.Netty4ClientHttpRequestFactory does not support HTTP proxies. Proxy support requires a change in Spring Vault to configure the underlying HTTP client properly.

@spencergibb
Copy link
Member

In other spring cloud uses of Apache and okhttp we support system properties, but not configuration properties.

@mp911de
Copy link
Member

mp911de commented Feb 3, 2017

Ok, let's stick to that which requires only a change to Spring Vault. I created spring-projects/spring-vault#52 to do the actual change. I'll close this ticket once the change is in place.

@mp911de mp911de self-assigned this Feb 3, 2017
@spencergibb
Copy link
Member

Again, going over an HTTP proxy seems like a bad idea when you can use AWS VPN.

@mp911de mp911de changed the title Spring-cloud-vault does not honor the JVM Proxy settings Using Apache HttpComponents does not honor the JVM Proxy settings Feb 5, 2017
@mp911de
Copy link
Member

mp911de commented Feb 5, 2017

That's fixed with spring-projects/spring-vault@d3af1d4. OkHttp 2 and 3 use the JVM proxy settings by default, only Apache HttpComponents was affected.

@mp911de mp911de closed this as completed Feb 5, 2017
@mp911de mp911de added this to the 1.0.0 RC1 milestone Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants