|
| 1 | +[role="xpack"] |
| 2 | +[[reporting-network-policy]] |
| 3 | +=== Restricting requests with a Reporting Network Policy |
| 4 | + |
| 5 | +When {report-features} generates PDF reports, it uses the Chromium browser to fully load the Kibana page on the server. This |
| 6 | +potentially involves sending requests to external hosts, for example, a request may go to an external image server for showing a |
| 7 | +field formatted as an image, or to show an image in a Markdown visualization. |
| 8 | + |
| 9 | +If the Chromium browser is requested to send a request that violates the network policy, Reporting will stop processing the page |
| 10 | +before the request goes out, and the report will be marked as a failure. Additional information about the event can be found in |
| 11 | +Kibana's server logs. |
| 12 | + |
| 13 | +A network policy applies not only to outgoing requests, but also incoming responses. That means if a request goes out to an allowed |
| 14 | +host, but is redirected and a response returns from a denied host, the response will be denied, and the report will fail. |
| 15 | + |
| 16 | +[NOTE] |
| 17 | +============ |
| 18 | +Kibana installations are not designed to be publicly accessible over the Internet. The Reporting network policy and other capabilities |
| 19 | +of the Elastic Stack security features do not change this condition. |
| 20 | +============ |
| 21 | + |
| 22 | +==== Configuring Reporting Network Policy |
| 23 | + |
| 24 | +You configure the network policy by specifying the `xpack.reporting.capture.networkPolicy.rules` setting in `kibana.yml`. A policy is specified as |
| 25 | +an array of objects that describe what to allow or deny based on an optionally-provided host and/or protocol. If a host or protocol |
| 26 | +is not specified, the rule will match any host or protocol, respectively. |
| 27 | + |
| 28 | +The rule objects are evaluated sequentially from the beginning to the end of the array, and continue until there is a matching rule. |
| 29 | +If none of the rules allow a request, the request will be denied. |
| 30 | + |
| 31 | +[source,yaml] |
| 32 | +------------------------------------------------------- |
| 33 | +# Only allow requests to placeholder.com |
| 34 | +xpack.reporting.capture.networkPolicy: |
| 35 | + rules: [ { allow: true, host: "placeholder.com" } ] |
| 36 | +------------------------------------------------------- |
| 37 | + |
| 38 | +[source,yaml] |
| 39 | +------------------------------------------------------- |
| 40 | +# Only allow requests to https://placeholder.com |
| 41 | +xpack.reporting.capture.networkPolicy: |
| 42 | + rules: [ { allow: true, host: "placeholder.com", protocol: "https:" } ] |
| 43 | +------------------------------------------------------- |
| 44 | + |
| 45 | +A final `allow` rule with no host or protocol will allow all requests that are not explicitly denied. |
| 46 | + |
| 47 | +[source,yaml] |
| 48 | +------------------------------------------------------- |
| 49 | +# Denies requests from http://placeholder.com, but anything else is allowed. |
| 50 | +xpack.reporting.capture.networkPolicy: |
| 51 | + rules: [{ allow: false, host: "placeholder.com", protocol: "http:" }, { allow: true }]; |
| 52 | +------------------------------------------------------- |
| 53 | + |
| 54 | +A network policy can be composed of multiple rules. |
| 55 | + |
| 56 | +[source,yaml] |
| 57 | +------------------------------------------------------- |
| 58 | +# Allow any request to http://placeholder.com but for any other host, https is required |
| 59 | +xpack.reporting.capture.networkPolicy |
| 60 | + rules: [ |
| 61 | + { allow: true, host: "placeholder.com", protocol: "http:" }, |
| 62 | + { allow: true, protocol: "https:" }, |
| 63 | + ] |
| 64 | +------------------------------------------------------- |
| 65 | + |
| 66 | +[NOTE] |
| 67 | +============ |
| 68 | +The `file:` protocol will always be denied, even if there is no network policy configured. |
| 69 | +============ |
| 70 | + |
| 71 | +==== Disabling Reporting Network Policy |
| 72 | + |
| 73 | +You can use the `xpack.reporting.capture.networkPolicy.enabled: false` setting to disable the network policy feature. The default for |
| 74 | +this configuration property is `true`, so it is not necessary to explicitly enable it. |
0 commit comments