-
Notifications
You must be signed in to change notification settings - Fork 151
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
Forward HTTP_PROXY/HTTPS_PROXY/NO_PROXY
to components.
#2602
Comments
Wouldn’t it be better if this was ELASTIC_HTTPS_PROXY so we can manage the proxy when elastic agent is deployed, without other proxies overriding the setting. The proxy env variables could be created by elastic agent through command line parameters. |
Setting HTTPS_PROXY or HTTP_PROXY will set the proxy for every connection made by Elastic Agent, except those that originate from Elastic Defend which runs as an independent protected service and so doesn't inherit this environment variable. Correcting this inconsistency where the _PROXY environment variables don't affect Elastic Defend is what this issue is primarily about. You can also control the proxy for each individual connection (Fleet, Elasticsearch or Output, and Upgrade downloads) independently directly in the agent policy. Unless I'm missing something here, I don't know why we'd introduce another proxy environment variable. |
Ignore me the proxy stuff with fleet worked fine. |
@cmacknz @AndersonQ what's the action item here? |
It would be forward the value of the *_PROXY environment variables set on the elastic-agent process to the endpoint-security process using the control protocol, so that users don't have to set them in two places. |
@cmacknz do you have an estimate for this one? I would like to plan it in our next coming sprint. |
Yes, it was already discussed, but some technical dependencies were holding us back then at Endpoint side. We're already ready to proceed with it. It'll be quite straightforward to implement, the foundation is already there in Elastic Defend sources. |
We need to confirm and document the precedence order of the proxy configuration fields as part of this. That is if endpoint gets the contents of the HTTPS_PROXY environment variable and also the |
@cmacknz can / should we compile the effective proxy in fleet / agent and pass only that to endpoint? |
I guess they shouldn't look up for environment variables when it comes to proxy settings and only rely on values sent down though the control protocol. |
That is the expectation yes. For the variable precedence, we need to test and document this from the agent perspective so that it knows what it should be sending to endpoint. The HTTPS_PROXY and related variables are features of Go, we do not test them and only document that they exist. There is no documentation explaining how it interacts with the individual proxy_url variables yet.
We could, I like the simplicity of this as from endpoint's perspective there are no code changes if they already respect the individual The only thing I don't like about sending the effective proxy is that the output and fleet configuration sent to endpoint no longer matches what is in the agent policy. One way to solve this would be to keep |
regarding the precedence rules, we've already implemented that on Endpoint side. Native proxy setting from policy is taken first, if it's not set, when we fallback from proxy from agent (which we don't have yet). |
Doing a quick test locally, on the side agent it looks like if I set both HTTPS_PROXY or HTTP_PROXY and the |
Sounds great, IMO as a user I would expect Agent/Endpoint to use what's configured explicitly in the policy rather than preferring some "random" system settings |
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
@michel-laterman @ycombinator this issue status has been changed to |
There's no pr yet |
@cmacknz, I have a draft for the change and @blakerouse rouse some concerns about the intended scope of the change. |
Only providing this to endpoint is fine as a starting point, they are the only component that will actually use it today. |
@michel-laterman can you describe a test scenario for a manual test scenario so we can confirm this inter-operates with endpoint as expected? If it is easier an automated test could be added, but I want to make sure there has been a spot check that endpoint actually gets the proxy and uses it as expected. |
Pinging @elastic/fleet-qasource-external (Team:Fleet-QA) |
Certainly! When setting up the test environment, there must be a proxy in between the instance that has the elastic-agent installed and the deployment. To test: endpoint data from the instance should be available in ES. |
Thank you for the update Team. |
for complete testing please run Note: be patient, it takes some seconds for new Agent process to re-establish connection with Endpoint to exchange the policy change. This however is not visible in the BTW, |
I've tested it locally on Windows, Agent env proxy is applied on Endpoint policy only if the policy doesn't have a proxy defined yet. 👍 |
Hi Team, Thank you @intxgo for helping out in testing this. We have attempted to test this feature on 8.15.0 BC2 and had below observations:
Endpoint Inspect till here:
Further as per security reasons, we can't install proxy on AWS VMs since their IPs are exposed. Please let us know if we are missing anything from our end. |
Thanks for logging the findings, but that's really not the whole picture from our earlier ad-hoc slack discussion. To recap: You've applied env proxy on Agent. After restarting Agent it couldn't communicate with Fleet. There was no Fleet proxy in the policy, so it used the env proxy, but the custom self-signed certificate was not provided in the policy for Fleet config, only for Output. The settings forwarded to Endpoint, as confrimed by
Actually p.2 is an Agent bug, the design is that env proxy settings should override, both on Agent and Endpoint, the fleet and output sections provided that no proxy is configured explicitly in policy for the respective sections. Agent couldn't communicate with fleet anymore after restart so it appears that it applied the env proxy to fleet config (couldn't communicate because of the lack of custom CA), but it didn't inject the proxy into Endpoint's policy fleet section. To further clarify, the setting just creates a proxy config entry:
which has to be explicitly assigned to Output and/or Fleet config. For the sake of testing env proxy, after it has been assigned to Output and Fleet in the policy env proxy should have been set to some bogus unreachable value to test that it's not being used because the proxy settings are explicitly set in the policy (and both Agent and Endpoint sill communicate well with the world using proxy form the policy). |
@aleksmaus we might double-check the fleet proxy override |
Describe the enhancement:
Currently there are 3 different proxies that can be configured for the Elastic Agent:
The default proxy is set though the environment variables
HTTP_PROXY/HTTPS_PROXY/NO_PROXY
. This is actually a Go feature, we don't handle them explicitly, but any other proxy will override it.The proxy setting doe thorough
HTTP_PROXY/HTTPS_PROXY/NO_PROXY
are inherited by the components the Elastic Agent runs as sub process, that means the beats "receive" those settings when they're set for the Elastic Agent, but other components don't. What is at least an inconsistent behaviour.Describe a specific use case for the enhancement or feature:
A user using the environment variables to set up a global proxy and having problems because some of the Elastic Agent components, such as Endpoint Security, aren't receiving the proxy.
The text was updated successfully, but these errors were encountered: