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

[actions] adds proxyBypassHosts and proxyOnlyHosts Kibana config keys #95365

Merged
merged 5 commits into from
Apr 7, 2021

Conversation

pmuellr
Copy link
Member

@pmuellr pmuellr commented Mar 24, 2021

resolves #92949

Summary

This PR adds two new Kibana config keys to further customize when the proxy is used when making HTTP requests. Prior to this PR, if a proxy was set via the xpack.actions.proxyUrl config key, all requests would be proxied.

Now, there's a further refinement in that hostnames can be added to the xpack.actions.proxyBypassHosts and xpack.actions.proxyOnlyHosts config keys. Only one of these config keys can be used at a time.

If proxyBypassHosts is set and the target URL hostname of the HTTP request is listed in the proxyBypassHosts list, the proxy won't be used.

If proxyOnlyHosts is set and the target URL hostname of the HTTP request is NOT listed in the proxyOnlyHosts list, the proxy won't be used.

Depending on the customer's environment, it may be easier to list the hosts to bypass, or easier to list the hosts that should only be proxied, so they can choose either method.

docs preview

Checklist

Delete any items that are not applicable to this PR.

For maintainers

Release note

Adds configuration keys xpack.actions.proxyBypassHosts and xpack.actions.proxyOnlyHosts
to customize the use of the proxy configured with the key xpack.actions.proxyUrl. Hostnames
can be added to the these keys to avoid using the proxy for some hostnames.

@pmuellr pmuellr added Feature:Actions Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Mar 24, 2021
@pmuellr pmuellr linked an issue Mar 25, 2021 that may be closed by this pull request
@pmuellr pmuellr force-pushed the actions/proxy-bypass branch 4 times, most recently from 1fc503f to c932f56 Compare March 30, 2021 19:59
resolves elastic#92949

This PR adds two new Kibana config keys to further customize when the proxy
is used when making HTTP requests.  Prior to this PR, if a proxy was set
via the `xpack.actions.proxyUrl` config key, all requests would be
proxied.

Now, there's a further refinement in that hostnames can be added
to the `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts`
config keys.  Only one of these config keys can be used at a time.

If the target URL hostname of the HTTP request is listed in the
`proxyBypassHosts` list, the proxy won't be used.

If the target URL hostname of the HTTP request is **NOT** listed in the
`proxyOnlyHosts` list, the proxy won't be used.

Depending on the customer's environment, it may be easier to list the hosts to
bypass, or easier to list the hosts that should only be proxied, so they can
choose either method.
@pmuellr pmuellr force-pushed the actions/proxy-bypass branch from a2763b2 to 12d6cbf Compare March 31, 2021 13:08
@pmuellr pmuellr marked this pull request as ready for review March 31, 2021 13:19
@pmuellr pmuellr requested review from a team as code owners March 31, 2021 13:19
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

Copy link
Contributor

@tylersmalley tylersmalley left a comment

Choose a reason for hiding this comment

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

Docker changes LGTM

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM! Just a note about clarifying the docs some more.

const { httpAgent, httpsAgent } = getCustomAgents(configurationUtilities, logger, targetUrl);
expect(httpAgent instanceof HttpProxyAgent).toBeFalsy();
expect(httpsAgent instanceof HttpsProxyAgent).toBeFalsy();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add tests for the reverse? When hostname is not in proxyBypassHosts and when hostname is not in proxyOnlyHosts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added tests for these cases in commit 7626ece

| Specifies hostnames which should not use the proxy, if using a proxy for actions. The value is an array of hostnames as strings. By default, all hosts will use the proxy. The settings `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts` cannot be used at the same time.

| `xpack.actions.proxyOnlyHosts` {ess-icon}
| Specifies hostnames which should only use the proxy, if using a proxy for actions. The value is an array of hostnames as strings. By default, all hosts will use the proxy. The settings `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts` cannot be used at the same time.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to make clear that hostnames not included in this configuration will not use the proxy? I did not get that from first reading this.

Copy link
Member Author

@pmuellr pmuellr Apr 5, 2021

Choose a reason for hiding this comment

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

Good call - I've updated the text for both of these to try to make it clearer 7626ece

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM

@pmuellr
Copy link
Member Author

pmuellr commented Apr 5, 2021

@elasticmachine merge upstream

@pmuellr
Copy link
Member Author

pmuellr commented Apr 5, 2021

@elasticmachine merge upstream

@pmuellr
Copy link
Member Author

pmuellr commented Apr 7, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

pmuellr added a commit to pmuellr/kibana that referenced this pull request Apr 7, 2021
…elastic#95365)

resolves elastic#92949

This PR adds two new Kibana config keys to further customize when the proxy
is used when making HTTP requests.  Prior to this PR, if a proxy was set
via the `xpack.actions.proxyUrl` config key, all requests would be
proxied.

Now, there's a further refinement in that hostnames can be added
to the `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts`
config keys.  Only one of these config keys can be used at a time.

If the target URL hostname of the HTTP request is listed in the
`proxyBypassHosts` list, the proxy won't be used.

If the target URL hostname of the HTTP request is **NOT** listed in the
`proxyOnlyHosts` list, the proxy won't be used.

Depending on the customer's environment, it may be easier to list the hosts to
bypass, or easier to list the hosts that should only be proxied, so they can
choose either method.
pmuellr added a commit that referenced this pull request Apr 7, 2021
…#95365) (#96491)

resolves #92949

This PR adds two new Kibana config keys to further customize when the proxy
is used when making HTTP requests.  Prior to this PR, if a proxy was set
via the `xpack.actions.proxyUrl` config key, all requests would be
proxied.

Now, there's a further refinement in that hostnames can be added
to the `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts`
config keys.  Only one of these config keys can be used at a time.

If the target URL hostname of the HTTP request is listed in the
`proxyBypassHosts` list, the proxy won't be used.

If the target URL hostname of the HTTP request is **NOT** listed in the
`proxyOnlyHosts` list, the proxy won't be used.

Depending on the customer's environment, it may be easier to list the hosts to
bypass, or easier to list the hosts that should only be proxied, so they can
choose either method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:Actions release_note:enhancement Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Actions] email action fails due to enabled HTTP proxy in kibana
7 participants