Skip to content

Commit 74ebdf9

Browse files
authored
Add support for certificates in PKCS#12 (P12) key stores (#53810) (#54383)
Kibana now supports the usage of PKCS#12 (P12) key stores and trust stores for certificates and keys.
1 parent b4523ee commit 74ebdf9

File tree

83 files changed

+2308
-667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2308
-667
lines changed

docs/development/core/server/kibana-plugin-server.kibanaresponsefactory.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Set of helpers used to create `KibanaResponse` to form HTTP response on an incom
1010

1111
```typescript
1212
kibanaResponseFactory: {
13-
custom: <T extends string | Error | Record<string, any> | Buffer | Stream | {
13+
custom: <T extends string | Error | Buffer | Stream | Record<string, any> | {
1414
message: string | Error;
1515
attributes?: Record<string, any> | undefined;
1616
} | undefined>(options: CustomHttpResponseOptions<T>) => KibanaResponse<T>;
@@ -21,9 +21,9 @@ kibanaResponseFactory: {
2121
conflict: (options?: ErrorHttpResponseOptions) => KibanaResponse<ResponseError>;
2222
internalError: (options?: ErrorHttpResponseOptions) => KibanaResponse<ResponseError>;
2323
customError: (options: CustomHttpResponseOptions<ResponseError>) => KibanaResponse<ResponseError>;
24-
redirected: (options: RedirectResponseOptions) => KibanaResponse<string | Record<string, any> | Buffer | Stream>;
25-
ok: (options?: HttpResponseOptions) => KibanaResponse<string | Record<string, any> | Buffer | Stream>;
26-
accepted: (options?: HttpResponseOptions) => KibanaResponse<string | Record<string, any> | Buffer | Stream>;
24+
redirected: (options: RedirectResponseOptions) => KibanaResponse<string | Buffer | Stream | Record<string, any>>;
25+
ok: (options?: HttpResponseOptions) => KibanaResponse<string | Buffer | Stream | Record<string, any>>;
26+
accepted: (options?: HttpResponseOptions) => KibanaResponse<string | Buffer | Stream | Record<string, any>>;
2727
noContent: (options?: HttpResponseOptions) => KibanaResponse<undefined>;
2828
}
2929
```

docs/settings/security-settings.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if this setting isn't the same for all instances of {kib}.
4545

4646
`xpack.security.secureCookies`::
4747
Sets the `secure` flag of the session cookie. The default value is `false`. It
48-
is set to `true` if `server.ssl.certificate` and `server.ssl.key` are set. Set
48+
is automatically set to `true` if `server.ssl.enabled` is set to `true`. Set
4949
this to `true` if SSL is configured outside of {kib} (for example, you are
5050
routing requests through a load balancer or proxy).
5151

docs/setup/settings.asciidoc

Lines changed: 87 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,52 @@ Elasticsearch nodes immediately following a connection fault.
8282
`elasticsearch.sniffOnStart:`:: *Default: false* Attempt to find other
8383
Elasticsearch nodes on startup.
8484

85-
`elasticsearch.ssl.alwaysPresentCertificate:`:: *Default: false* Controls
86-
whether to always present the certificate specified by
87-
`elasticsearch.ssl.certificate` when requested. This applies to all requests to
88-
Elasticsearch, including requests that are proxied for end-users. Setting this
89-
to `true` when Elasticsearch is using certificates to authenticate users can
90-
lead to proxied requests for end-users being executed as the identity tied to
91-
the configured certificate.
92-
93-
`elasticsearch.ssl.certificate:` and `elasticsearch.ssl.key:`:: Optional
94-
settings that provide the paths to the PEM-format SSL certificate and key files.
95-
These files are used to verify the identity of Kibana to Elasticsearch and are
96-
required when `xpack.ssl.verification_mode` in Elasticsearch is set to either
97-
`certificate` or `full`.
98-
99-
`elasticsearch.ssl.certificateAuthorities:`:: Optional setting that enables you
100-
to specify a list of paths to the PEM file for the certificate authority for
101-
your Elasticsearch instance.
102-
103-
`elasticsearch.ssl.keyPassphrase:`:: The passphrase that will be used to decrypt
104-
the private key. This value is optional as the key may not be encrypted.
105-
106-
`elasticsearch.ssl.verificationMode:`:: *Default: full* Controls the
107-
verification of certificates presented by Elasticsearch. Valid values are `none`,
108-
`certificate`, and `full`. `full` performs hostname verification, and
109-
`certificate` does not.
85+
`elasticsearch.ssl.alwaysPresentCertificate:`:: *Default: false* Controls whether to always present the certificate specified by
86+
`elasticsearch.ssl.certificate` or `elasticsearch.ssl.keystore.path` when requested. This setting applies to all requests to Elasticsearch,
87+
including requests that are proxied for end users. Setting this to `true` when Elasticsearch is using certificates to authenticate users can
88+
lead to proxied requests for end users being executed as the identity tied to the configured certificate.
89+
90+
`elasticsearch.ssl.certificate:` and `elasticsearch.ssl.key:`:: Paths to a PEM-encoded X.509 certificate and its private key, respectively.
91+
When `xpack.security.http.ssl.client_authentication` in Elasticsearch is set to `required` or `optional`, the certificate and key are used
92+
to prove Kibana's identity when it makes an outbound request to your Elasticsearch cluster.
93+
+
94+
--
95+
NOTE: These settings cannot be used in conjunction with `elasticsearch.ssl.keystore.path`.
96+
--
97+
98+
`elasticsearch.ssl.certificateAuthorities:`:: Paths to one or more PEM-encoded X.509 certificates. These certificates may consist of a root
99+
certificate authority (CA), and one or more intermediate CAs, which make up a trusted certificate chain for Kibana. This chain is used to
100+
establish trust when Kibana creates an SSL connection with your Elasticsearch cluster. In addition to this setting, trusted certificates may
101+
be specified via `elasticsearch.ssl.keystore.path` and/or `elasticsearch.ssl.truststore.path`.
102+
103+
`elasticsearch.ssl.keyPassphrase:`:: The passphrase that will be used to decrypt the private key that is specified via
104+
`elasticsearch.ssl.key`. This value is optional, as the key may not be encrypted.
105+
106+
`elasticsearch.ssl.keystore.path:`:: Path to a PKCS #12 file that contains an X.509 certificate with its private key. When
107+
`xpack.security.http.ssl.client_authentication` in Elasticsearch is set to `required` or `optional`, the certificate and key are used to
108+
prove Kibana's identity when it makes an outbound request to your Elasticsearch cluster. If the file contains any additional certificates,
109+
those will be used as a trusted certificate chain for your Elasticsearch cluster. This chain is used to establish trust when Kibana creates
110+
an SSL connection with your Elasticsearch cluster. In addition to this setting, trusted certificates may be specified via
111+
`elasticsearch.ssl.certificateAuthorities` and/or `elasticsearch.ssl.truststore.path`.
112+
+
113+
--
114+
NOTE: This setting cannot be used in conjunction with `elasticsearch.ssl.certificate` or `elasticsearch.ssl.key`.
115+
--
116+
117+
`elasticsearch.ssl.keystore.password:`:: The password that will be used to decrypt the key store and its private key. If your key store has
118+
no password, leave this unset. If your key store has an empty password, set this to `""`.
119+
120+
`elasticsearch.ssl.truststore.path:`:: Path to a PKCS #12 trust store that contains one or more X.509 certificates. This may consist of a
121+
root certificate authority (CA) and one or more intermediate CAs, which make up a trusted certificate chain for your Elasticsearch cluster.
122+
This chain is used to establish trust when Kibana creates an SSL connection with your Elasticsearch cluster. In addition to this setting,
123+
trusted certificates may be specified via `elasticsearch.ssl.certificateAuthorities` and/or `elasticsearch.ssl.keystore.path`.
124+
125+
`elasticsearch.ssl.truststore.password:`:: The password that will be used to decrypt the trust store. If your trust store has no password,
126+
leave this unset. If your trust store has an empty password, set this to `""`.
127+
128+
`elasticsearch.ssl.verificationMode:`:: *Default: full* Controls the verification of certificates presented by Elasticsearch. Valid values
129+
are `none`, `certificate`, and `full`. `full` performs hostname verification and `certificate` does not. This setting is used only when
130+
traffic to Elasticsearch is encrypted, which is specified by using the HTTPS protocol in `elasticsearch.hosts`.
110131

111132
`elasticsearch.startupTimeout:`:: *Default: 5000* Time in milliseconds to wait
112133
for Elasticsearch at Kibana startup before retrying.
@@ -330,11 +351,19 @@ are rewritten by your reverse proxy.
330351
`server.socketTimeout:`:: *Default: "120000"* The number of milliseconds to wait before closing an
331352
inactive socket.
332353

333-
`server.ssl.certificate:` and `server.ssl.key:`:: Paths to the PEM-format SSL
334-
certificate and SSL key files, respectively.
354+
`server.ssl.certificate:` and `server.ssl.key:`:: Paths to a PEM-encoded X.509 certificate and its private key, respectively. These are used
355+
when enabling SSL for inbound requests from web browsers to the Kibana server.
356+
+
357+
--
358+
NOTE: These settings cannot be used in conjunction with `server.ssl.keystore.path`.
359+
--
335360

336-
`server.ssl.certificateAuthorities:`:: List of paths to PEM encoded certificate
337-
files that should be trusted.
361+
`server.ssl.certificateAuthorities:`:: Paths to one or more PEM-encoded X.509 certificates. These certificates may consist of a root
362+
certificate authority (CA) and one or more intermediate CAs, which make up a trusted certificate chain for Kibana. This chain is used when a
363+
web browser creates an SSL connection with the Kibana server; the certificate chain is sent to the browser along with the end-entity
364+
certificate to establish trust. This chain is also used to determine whether client certificates should be trusted when PKI authentication
365+
is enabled. In addition to this setting, trusted certificates may be specified via `server.ssl.keystore.path` and/or
366+
`server.ssl.truststore.path`.
338367

339368
`server.ssl.cipherSuites:`::
340369
*Default: ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-GCM-SHA384, DHE-RSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA256, ECDHE-RSA-AES256-SHA384, DHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA256, HIGH,!aNULL, !eNULL, !EXPORT, !DES, !RC4, !MD5, !PSK, !SRP, !CAMELLIA*.
@@ -345,12 +374,36 @@ https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT[OpenS
345374
connections. Valid values are `required`, `optional`, and `none`. `required` forces a client to present a certificate, while `optional`
346375
requests a client certificate but the client is not required to present one.
347376

348-
`server.ssl.enabled:`:: *Default: "false"* Enables SSL for outgoing requests
349-
from the Kibana server to the browser. When set to `true`,
350-
`server.ssl.certificate` and `server.ssl.key` are required.
377+
`server.ssl.enabled:`:: *Default: "false"* Enables SSL for inbound requests from the browser to the Kibana server. When set to `true`, a
378+
certificate and private key must be provided. These can be specified via `server.ssl.keystore.path` or the combination of
379+
`server.ssl.certificate` and `server.ssl.key`.
380+
381+
`server.ssl.keyPassphrase:`:: The passphrase that will be used to decrypt the private key that is specified via `server.ssl.key`. This value
382+
is optional, as the key may not be encrypted.
383+
384+
`server.ssl.keystore.path:`:: Path to a PKCS #12 file that contains an X.509 certificate with its private key. These are used when enabling
385+
SSL for inbound requests from web browsers to the Kibana server. If the file contains any additional certificates, those will be used as a
386+
trusted certificate chain for Kibana. This chain is used when a web browser creates an SSL connection with the Kibana server; the
387+
certificate chain is sent to the browser along with the end-entity certificate to establish trust. This chain is also used to determine
388+
whether client certificates should be trusted when PKI authentication is enabled. In addition to this setting, trusted certificates may be
389+
specified via `server.ssl.certificateAuthorities` and/or `server.ssl.truststore.path`.
390+
+
391+
--
392+
NOTE: This setting cannot be used in conjunction with `server.ssl.certificate` or `server.ssl.key`.
393+
--
394+
395+
`server.ssl.keystore.password:`:: The password that will be used to decrypt the key store and its private key. If your key store has no
396+
password, leave this unset. If your key store has an empty password, set this to `""`.
397+
398+
`server.ssl.truststore.path:`:: Path to a PKCS #12 trust store that contains one or more X.509 certificates. These certificates may consist
399+
of a root certificate authority (CA) and one or more intermediate CAs, which make up a trusted certificate chain for Kibana. This chain is
400+
used when a web browser creates an SSL connection with the Kibana server; the certificate chain is sent to the browser along with the
401+
end-entity certificate to establish trust. This chain is also used to determine whether client certificates should be trusted when PKI
402+
authentication is enabled. In addition to this setting, trusted certificates may be specified via `server.ssl.certificateAuthorities` and/or
403+
`server.ssl.keystore.path`.
351404

352-
`server.ssl.keyPassphrase:`:: The passphrase that will be used to decrypt the
353-
private key. This value is optional as the key may not be encrypted.
405+
`server.ssl.truststore.password:`:: The password that will be used to decrypt the trust store. If your trust store has no password, leave
406+
this unset. If your trust store has an empty password, set this to `""`.
354407

355408
`server.ssl.redirectHttpFromPort:`:: Kibana will bind to this port and redirect
356409
all http requests to https over the port configured as `server.port`.

docs/user/monitoring/monitoring-kibana.asciidoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ used when {kib} sends monitoring data to the production cluster.
9696
.. Configure {kib} to encrypt communications between the {kib} server and the
9797
production cluster. This set up involves generating a server certificate and
9898
setting `server.ssl.*` and `elasticsearch.ssl.certificateAuthorities` settings
99-
in the `kibana.yml` file on the {kib} server. For example:
99+
in the `kibana.yml` file on the {kib} server. For example, using a PEM-formatted
100+
certificate and private key:
100101
+
101102
--
102103
[source,yaml]
@@ -105,14 +106,19 @@ server.ssl.key: /path/to/your/server.key
105106
server.ssl.certificate: /path/to/your/server.crt
106107
--------------------------------------------------------------------------------
107108

108-
If you are using your own certificate authority to sign certificates, specify
109-
the location of the PEM file in the `kibana.yml` file:
109+
If you are using your own certificate authority (CA) to sign certificates,
110+
specify the location of the PEM file in the `kibana.yml` file:
110111

111112
[source,yaml]
112113
--------------------------------------------------------------------------------
113114
elasticsearch.ssl.certificateAuthorities: /path/to/your/cacert.pem
114115
--------------------------------------------------------------------------------
115116

117+
NOTE: Alternatively, the PKCS #12 format can be used for the Kibana certificate
118+
and key, along with any included CA certificates, by setting
119+
`server.ssl.keystore.path`. If your CA certificate chain is in a separate trust
120+
store, you can also use `server.ssl.truststore.path`.
121+
116122
For more information, see <<using-kibana-with-security>>.
117123
--
118124

docs/user/security/authentication/index.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ server.ssl.clientAuthentication: required
6767
xpack.security.authc.providers: [pki]
6868
--------------------------------------------------------------------------------
6969

70+
NOTE: Trusted CAs can also be specified in a PKCS #12 keystore bundled with your Kibana server certificate/key using
71+
`server.ssl.keystore.path` or in a separate trust store using `server.ssl.truststore.path`.
72+
7073
PKI support in {kib} is designed to be the primary (or sole) authentication method for users of that {kib} instance. However, you can configure both PKI and Basic authentication for the same {kib} instance:
7174

7275
[source,yaml]

0 commit comments

Comments
 (0)