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

Plugin installer proxy support #10946

Conversation

thomasv314
Copy link

This commit fixes #5211 #5196 #5902 and possibly a few others.

Instead of removing the Wreck dependency and changing the plugin CLI API like in PR #7967, it depends on HTTP_PROXY and NO_PROXY envvars.

I did not include any tests for this only because I could not find them in the kibana repo. If you can point me to the right place I'd be more than happy to write a unit or feature test.

@elasticmachine
Copy link
Contributor

Can one of the admins verify this patch?

@tbragin tbragin added the Team:Operations Team label for Operations Team label Apr 26, 2017
@jbudz jbudz changed the title Fixes #5211 Plugin proxy support May 11, 2017
@jbudz
Copy link
Member

jbudz commented May 11, 2017

Thanks for the PR @thomasv314. If you get a chance, would you mind signing the CLA?

@jbudz jbudz changed the title Plugin proxy support Plugin installer proxy support May 11, 2017
@thomasv314
Copy link
Author

@jbudz No problem, I've just signed the agreement.

@meersjo
Copy link

meersjo commented May 30, 2017

Excellent. This is the way to go, at least on unix-like platforms. Any idea when this will make it into mainstream?

@thomasv314
Copy link
Author

@jbudz any chance this will get reviewed anytime soon? It would be super helpful for our ELKv5 rollout. Thanks!

const noProxy = process.env.NO_PROXY || '';

// proxy if the hostname is not in noProxy
const shouldProxy = (noProxy.indexOf(hostname) === -1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually need to split the entries of no_proxy by comma before checking this, since there exist TLD domains, that are the prefix of another. So downloading a plugin from foo.ac would also not use the proxy if your env looks like no_proxy="foo.academy,localhost" even though it should be.

So we should split no_proxy by comma and check for an exact entry.

Also this way we don't support the more complex syntax of no_proxy, with ports and subdomain wildcards. We should think if these are important enough for the beginning that they must be there, or it's a nice to have to implement later.

import URL from 'url';

function getProxyAgent(sourceUrl) {
const httpProxy = process.env.HTTP_PROXY;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the case of the env variable is not really specified. On Linux most programs use the lower case variant http_proxy (and same for no_proxy). Most programs support either lower or upper case and I think we should also try to use lower-case (preferred) and fallback to upper-case.

@tylersmalley
Copy link
Contributor

After chatting with @timroes, I like the idea of using HTTP_PROXY and NO_PROXY since it appears so widely used.

To assist with debugging for us and the users we should log when the proxy is used.

  • If a proxy is present, log that it's used and what to add to NO_PROXY to ignore
  • Log if a proxy is present and it's being ignored due to NO_PROXY

@tylersmalley
Copy link
Contributor

@thomasv314, apologies for taking so long to get to this PR - we do appreciate your contribution. We would like to get this into 6.0, which would require some modifications related to the feedback provided. If you have the bandwidth to do this over the next couple days, that would be great otherwise we can take it over.

@thomasv314
Copy link
Author

@timroes and @tylersmalley, thanks for the feedback.

I intend to make those changes and will update this PR in the next few days.

@timroes
Copy link
Contributor

timroes commented Jul 10, 2017

@thomasv314 Since we have a feature freeze on Tuesday for the upcoming version, I would continue working on your pull request in around 10 hours. Please feel free to also commit broken work-in-progress changes, if you already started working at this. Thanks again for the great contribution and sorry that this pull request went unnoticed for so long.

@timroes
Copy link
Contributor

timroes commented Jul 11, 2017

I made the required changes in #12753 . Closing this PR in favor of the new one.

@timroes timroes closed this Jul 11, 2017
@thomasv314
Copy link
Author

@timroes awesome! thank you, looking forward to these changes :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Operations Team label for Operations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP_PROXY support for connections towards Elasticsearch
7 participants