diff --git a/deploy-manage/security/_snippets/eck-transport.md b/deploy-manage/security/_snippets/eck-transport.md index c357f30ce9..c7769709c4 100644 --- a/deploy-manage/security/_snippets/eck-transport.md +++ b/deploy-manage/security/_snippets/eck-transport.md @@ -1 +1 @@ -{{es}} transport security and TLS certificates are automatically configured by the operator, but you can still [customize its service and CA certificates](/deploy-manage/security/k8s-transport-settings.md). +{{es}} transport security and TLS certificates are automatically configured by the operator, but you can still [customize the {{es}} transport service, certificate authority, and certificates](/deploy-manage/security/k8s-transport-settings.md). diff --git a/deploy-manage/security/_snippets/own-ca-warning.md b/deploy-manage/security/_snippets/own-ca-warning.md new file mode 100644 index 0000000000..e96ea36f23 --- /dev/null +++ b/deploy-manage/security/_snippets/own-ca-warning.md @@ -0,0 +1,5 @@ +:::{warning} +Transport connections between {{es}} nodes are security-critical and you must protect them carefully. Malicious actors who can observe or interfere with node-to-node transport traffic can read or modify cluster data. A malicious actor who can establish a transport connection might be able to invoke system-internal APIs, including APIs that read or modify cluster data. + +If you choose to issue node transport certificates using an external CA, then carefully review [](/deploy-manage/security/external-ca-transport.md) to ensure that your certificates meet the security requirements for transport connections. +::: \ No newline at end of file diff --git a/deploy-manage/security/different-ca.md b/deploy-manage/security/different-ca.md index 101f0d62cb..622fea0424 100644 --- a/deploy-manage/security/different-ca.md +++ b/deploy-manage/security/different-ca.md @@ -12,8 +12,11 @@ products: # Different CA [update-node-certs-different] +If you have to trust a new CA from your organization, or you need to generate a new CA yourself, instruct your nodes to trust the new CA and then use this new CA to sign the new node certificates. + +:::{include} ./_snippets/own-ca-warning.md +::: -If you have to trust a new CA from your organization, or you need to generate a new CA yourself, use this new CA to sign the new node certificates and instruct your nodes to trust the new CA. ## Generate a new certificate for the transport layer [node-certs-different-transport] diff --git a/deploy-manage/security/external-ca-transport.md b/deploy-manage/security/external-ca-transport.md new file mode 100644 index 0000000000..a9a238c2e5 --- /dev/null +++ b/deploy-manage/security/external-ca-transport.md @@ -0,0 +1,42 @@ +--- +applies_to: + deployment: + self: + eck: +products: + - id: elasticsearch +navigation_title: External CA for TLS +--- + +# Using an external certificate authority to secure node-to-node connections + +By default, {{es}} uses mutual TLS (mTLS) to secure node-to-node transport connections. Mutual TLS means that data is encrypted in transit, ensuring confidentiality and integrity, and also that both nodes in a connection must present a valid certificate to the other node when establishing the connection. Each node requires that certificates be issued by a trusted certificate authority (CA), ensuring that only authorized nodes can connect. Configure trusted certificate authorities using settings in the [`xpack.security.transport.ssl.*`](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#transport-tls-ssl-settings) namespace, such as `xpack.security.transport.ssl.certificate_authorities` and `xpack.security.transport.ssl.truststore.path`. + +{{es}} comes with a built-in tool called [`elasticsearch-certutil`](/deploy-manage/security/set-up-basic-security.md), which you can use to create and manage a dedicated certificate authority for each of your clusters, and to issue TLS certificates from this certificate authority. If you prefer not to use `elasticsearch-certutil`, then you must obtain the certificates from another certificate authority using standard TLS tools. Any certificate authority that is not managed using `elasticsearch-certutil` is referred to as an "external certificate authority" or "external CA". + +This page explains the requirements and best practices to ensure that certificates generated using an external CA work correctly and protect your cluster properly. + +::::{warning} +Transport connections between {{es}} nodes are security-critical and you must protect them carefully. Malicious actors who can observe or interfere with unencrypted node-to-node transport traffic can read or modify cluster data. A malicious actor who can establish a transport connection might be able to invoke system-internal APIs, including APIs that read or modify cluster data. +:::: + +## Transport mTLS certificate requirements for external CAs + +Obtain your transport certificates from a certificate authority that only issues certificates to {{es}} nodes permitted to connect to your cluster. Do not use a public certificate authority or an organization-wide private certificate authority, because these issue certificates to entities beyond your authorized cluster nodes. Use a dedicated private certificate authority for each {{es}} cluster. + +Certificates used for transport mTLS must either have no Extended Key Usage extension, or include both `clientAuth` and `serverAuth` values in the extension. Public certificate authorities typically omit the `clientAuth` value in the Extended Key Usage extension, making them unsuitable for mTLS. + +### Transport certificates vs. HTTP certificates + +Transport certificates have different security requirements than [HTTP certificates](/deploy-manage/security/secure-cluster-communications.md#encrypt-http-communication). HTTP server certificates don't require the `clientAuth` Extended Key Usage extension because they are used solely for server authentication, regardless of whether mTLS is enabled. In practice, HTTP connections don't typically use mTLS because HTTP has its own authentication mechanisms. + +HTTP certificates can come from public or organization-wide certificate authorities, while transport certificates should use a cluster-specific private CA. In most cases, you should not use the same CA or certificate for both HTTP and transport connections. + +## Turning off mTLS for transport connections [turn-off-mtls] + +If your environment has some other way to prevent unauthorized node-to-node connections, you can disable mTLS by setting `xpack.security.transport.ssl.client_authentication: none`. You can still use non-mutual TLS to ensure the confidentiality and integrity of node-to-node traffic by setting `xpack.security.transport.ssl.enabled: true`. With non-mutual TLS, transport certificates don't require the `clientAuth` value in the Extended Key Usage extension. + +::::{warning} +Turning off mTLS by setting `xpack.security.transport.ssl.client_authentication` to `optional` or `none` allows anyone with network access to establish transport connections. Malicious actors can use these connections to invoke system-internal APIs that may read or modify cluster data. Use mTLS to +protect your node-to-node transport connections unless you are absolutely certain that unauthorized network access to these nodes cannot occur. +:::: \ No newline at end of file diff --git a/deploy-manage/security/k8s-transport-settings.md b/deploy-manage/security/k8s-transport-settings.md index 9f21f518bb..25d8a6d8ba 100644 --- a/deploy-manage/security/k8s-transport-settings.md +++ b/deploy-manage/security/k8s-transport-settings.md @@ -10,7 +10,10 @@ products: # Manage transport certificates on ECK [k8s-transport-settings] -The transport module in {{es}} is used for internal communication between nodes within the cluster as well as communication between remote clusters. Check the [{{es}} documentation](elasticsearch://reference/elasticsearch/configuration-reference/networking-settings.md) for details. For customization options of the HTTP layer, check [Access services](../deploy/cloud-on-k8s/accessing-services.md) and [HTTP TLS certificates](./k8s-https-settings.md). +The transport module in {{es}} is used for internal communication between nodes within the cluster as well as communication between remote clusters. For more information, refer to [Networking settings](elasticsearch://reference/elasticsearch/configuration-reference/networking-settings.md). For customization options of the HTTP layer, refer to [Access services](../deploy/cloud-on-k8s/accessing-services.md) and [HTTP TLS certificates](./k8s-https-settings.md). + +:::{include} ./_snippets/own-ca-warning.md +::: ## Customize the Transport Service [k8s_customize_the_transport_service] diff --git a/deploy-manage/security/same-ca.md b/deploy-manage/security/same-ca.md index a8cdef7290..f2394deb7d 100644 --- a/deploy-manage/security/same-ca.md +++ b/deploy-manage/security/same-ca.md @@ -16,12 +16,15 @@ products: This procedure assumes that the you have access to the CA certificate and key that was originally generated (or otherwise held by your organization) and used to sign the node certificates currently in use. It also assumes that the clients connecting to {{es}} on the HTTP layer are configured to trust the CA certificate. -If you have access to the CA used to sign your existing certificates, you only need to replace the certificates and keys for each node in your cluster. If you replace your existing certificates and keys on each node and use the same filenames, {{es}} reloads the files starts using the new certificates and keys. +If you have access to the certificate authority (CA) used to sign your existing certificates, you only need to replace the certificates and keys for each node in your cluster. If you replace your existing certificates and keys on each node and use the same filenames, {{es}} reloads the files starts using the new certificates and keys. You don’t have to restart each node, but doing so forces new TLS connections and is [a recommended practice](updating-certificates.md#use-rolling-restarts) when updating certificates. Therefore, the following steps include a node restart after updating each certificate. The following steps provide instructions for generating new node certificates and keys for both the transport layer and the HTTP layer. You might only need to replace one of these layer’s certificates depending on which of your certificates are expiring. +:::{include} ./_snippets/own-ca-warning.md +::: + ::::{important} :name: cert-password-updates diff --git a/deploy-manage/security/secure-cluster-communications.md b/deploy-manage/security/secure-cluster-communications.md index c76140a0cb..2671732d3e 100644 --- a/deploy-manage/security/secure-cluster-communications.md +++ b/deploy-manage/security/secure-cluster-communications.md @@ -4,10 +4,12 @@ mapped_pages: - https://www.elastic.co/guide/en/elasticsearch/reference/current/security-basic-setup.html - https://www.elastic.co/guide/en/kibana/current/elasticsearch-mutual-tls.html applies_to: + serverless: deployment: self: eck: ece: + ess: products: - id: elasticsearch - id: kibana @@ -57,36 +59,43 @@ Securing this layer prevents unauthorized nodes from joining your cluster and pr The way that transport layer security is managed depends on your deployment type: -::::{tab-set} +:::::{tab-set} :group: deployments -:::{tab-item} ECH and Serverless +::::{tab-item} ECH and Serverless :sync: ech {{es}} transport security is fully managed by Elastic, and no configuration is required. -::: +:::: -:::{tab-item} ECE +::::{tab-item} ECE :sync: ece -{{es}} transport security is fully managed by {{ece}} platform, and no configuration is required. -::: +{{es}} transport security is fully managed by the {{ece}} platform, and no configuration is required. +:::: -:::{tab-item} ECK +::::{tab-item} ECK :sync: eck :::{include} ./_snippets/eck-transport.md ::: +:::{include} ./_snippets/own-ca-warning.md ::: -:::{tab-item} Self-managed +:::: + +::::{tab-item} Self-managed :sync: self {{es}} transport security can be [automatically configured](self-auto-setup.md), or manually set up by following the steps in [](set-up-basic-security.md). For additional TLS configuration options, refer to [](./self-tls.md). + +:::{include} ./_snippets/own-ca-warning.md ::: :::: +::::: + ### HTTP layer security [encrypt-http-communication] The HTTP layer includes the service endpoints exposed by both {{es}} and {{kib}}, supporting communications such as REST API requests, browser access to {{kib}}, and {{kib}}’s own traffic to {{es}}. Securing these endpoints helps prevent unauthorized access and protects sensitive data in transit. diff --git a/deploy-manage/security/set-up-basic-security.md b/deploy-manage/security/set-up-basic-security.md index 0da5d5abb3..8ee7470042 100644 --- a/deploy-manage/security/set-up-basic-security.md +++ b/deploy-manage/security/set-up-basic-security.md @@ -17,18 +17,18 @@ Configuring TLS between nodes is the basic security setup to prevent unauthorize This document focuses on the **manual configuration** of TLS for [{{es}} transport protocol](./secure-cluster-communications.md#encrypt-internode-communication) in self-managed environments. Use this approach if you want to provide your own TLS certificates, generate them with Elastic’s tools, or have full control over the configuration. Alternatively, {{es}} can [automatically generate and configure HTTPS certificates](./self-auto-setup.md) for you. -::::{note} -For other deployment types, such as {{ech}}, {{ece}}, or {{eck}}, refer to [](./secure-cluster-communications.md). -:::: - In this guide, you will learn how to: -* [Generate a Certificate Authority (CA) and a server certificate using the `elasticsearch-certutil` tool](#generate-certificates). +* [Generate or provide security certificates](#obtain-certificates). * [Configure your {{es}} nodes to use the generated certificate for the transport layer](#encrypt-internode-communication). Refer to [Transport TLS/SSL settings](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#transport-tls-ssl-settings) for the complete list of available settings in {{es}}. -## Generate the certificate authority [generate-certificates] +::::{note} +For other deployment types, such as {{ech}}, {{ece}}, or {{eck}}, refer to [](./secure-cluster-communications.md). +:::: + +## Obtain certificates You can add as many nodes as you want in a cluster but they must be able to communicate with each other. The communication between nodes in a cluster is handled by the transport module. To secure your cluster, you must ensure that internode communications are encrypted and verified, which is achieved with mutual TLS. @@ -36,39 +36,57 @@ In a secured cluster, {{es}} nodes use certificates to identify themselves when The cluster must validate the authenticity of these certificates. The recommended approach is to trust a specific certificate authority (CA). When nodes are added to your cluster they must use a certificate signed by the same CA. -For the transport layer, we recommend using a separate, dedicated CA instead of an existing, possibly shared CA so that node membership is tightly controlled. Use the `elasticsearch-certutil` tool to generate a CA for your cluster. +For the transport layer, we recommend using a separate, dedicated CA instead of an existing, possibly shared CA so that node membership is tightly controlled. + +When you manually set up transport TLS, you can choose from the following CA options: + +* [Use the `elasticsearch-certutil` tool to generate a CA unique to your cluster](#generate-certificates) (recommended) +* [Provide certificates from an external CA](#external-ca) -1. Before starting {{es}}, use the `elasticsearch-certutil` tool on any single node to generate a CA for your cluster. +### Generate the certificate authority using `elasticsearch-certutil` [generate-certificates] + +You can use the `elasticsearch-certutil` tool to generate a CA for your cluster. Using `elasticsearch-certutil` guarantees that your certificates meet {{es}} certificate requirements and security best practices. + +1. Before starting {{es}}, generate the CA: + 1. Use the `elasticsearch-certutil` tool on any single node to generate a CA for your cluster. ```shell ./bin/elasticsearch-certutil ca ``` - 1. When prompted, accept the default file name, which is `elastic-stack-ca.p12`. This file contains the public certificate for your CA and the private key used to sign certificates for each node. - 2. Enter a password for your CA. You can choose to leave the password blank if you’re not deploying to a production environment. + 2. When prompted, accept the default file name, which is `elastic-stack-ca.p12`. This file contains the public certificate for your CA and the private key used to sign certificates for each node. + 3. Enter a password for your CA. You can choose to leave the password blank if you’re not deploying to a production environment. -2. On any single node, generate a certificate and private key for the nodes in your cluster. You include the `elastic-stack-ca.p12` output file that you generated in the previous step. +2. Generate the certificate: + 1. On any single node, generate a certificate and private key for the nodes in your cluster. Include the `elastic-stack-ca.p12` output file that you generated in the previous step. - ```shell - ./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 - ``` + ```shell + ./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 <1> + ``` + 1. The `--ca` flag must contain the name of the CA file used to sign your certificates. The default file name from the `elasticsearch-certutil` tool is `elastic-stack-ca.p12`. - `--ca ` - : Name of the CA file used to sign your certificates. The default file name from the `elasticsearch-certutil` tool is `elastic-stack-ca.p12`. + 2. Enter the password for your CA, or press **Enter** if you did not configure one in the previous step. + 3. Create a password for the certificate and accept the default file name. - 1. Enter the password for your CA, or press **Enter** if you did not configure one in the previous step. - 2. Create a password for the certificate and accept the default file name. + The output file is a keystore named `elastic-certificates.p12`. This file contains a node certificate, node key, and CA certificate. - The output file is a keystore named `elastic-certificates.p12`. This file contains a node certificate, node key, and CA certificate. -3. On **every** node in your cluster, copy the `elastic-certificates.p12` file to the `$ES_PATH_CONF` directory. +### Provide certificates from an external CA [external-ca] + +You might choose to use an external CA to generate transport certificates for node-to-node connections. An external CA is any CA that is not managed using `elasticsearch-certutil`. + +Transport connections between {{es}} nodes are security-critical and you must protect them carefully. Malicious actors who can observe or interfere with unencrypted node-to-node transport traffic can read or modify cluster data. A malicious actor who can establish a transport connection might be able to invoke system-internal APIs, including APIs that read or modify cluster data. + +Carefully review [](/deploy-manage/security/external-ca-transport.md) to ensure that your certificates meet the security requirements for transport connections. ## Encrypt internode communications with TLS [encrypt-internode-communication] The transport networking layer is used for internal communication between nodes in a cluster. When security features are enabled, you must use TLS to ensure that communication between the nodes is encrypted. -Now that you’ve generated a certificate authority and certificates, you’ll update your cluster to use these files. +Now that you’ve obtained your certificates, you’ll update your cluster to use these files. + +These steps assume that you [generated a CA and certificates](#generate-certificates) using `elasticsearch-certutil`. The `xpack.security.transport.ssl` settings that you need to set differ if you're using a certificate generated with an external CA. Refer to [Transport TLS/SSL settings](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#transport-tls-ssl-settings) for a full list of available settings. ::::{note} {{es}} monitors all files such as certificates, keys, keystores, or truststores that are configured as values of TLS-related node settings. If you update any of these files, such as when your hostnames change or your certificates are due to expire, {{es}} reloads them. The files are polled for changes at a frequency determined by the global {{es}} `resource.reload.interval.high` setting, which defaults to 5 seconds. @@ -77,7 +95,9 @@ Now that you’ve generated a certificate authority and certificates, you’ll u Complete the following steps **for each node in your cluster**. To join the same cluster, all nodes must share the same `cluster.name` value. -1. Open the `$ES_PATH_CONF/elasticsearch.yml` file and make the following changes: +1. Place the certificate or keystore file that you obtained in the `$ES_PATH_CONF` directory on **every** node in your cluster. If you generated a CA using `elasticsearch-certutil`, then this file is named `elastic-certificates.p12`. + +2. Open the `$ES_PATH_CONF/elasticsearch.yml` file and make the following changes: 1. Add the [`cluster-name`](elasticsearch://reference/elasticsearch/configuration-reference/miscellaneous-cluster-settings.md#cluster-name) setting and enter a name for your cluster: @@ -105,7 +125,7 @@ Complete the following steps **for each node in your cluster**. To join the same 1. If you want to use hostname verification, set the verification mode to `full`. You should generate a different certificate for each host that matches the DNS or IP address. See the `xpack.security.transport.ssl.verification_mode` parameter in [TLS settings](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#transport-tls-ssl-settings). -2. If you entered a password when creating the node certificate, run the following commands to store the password in the {{es}} keystore: +3. If you entered a password when creating the node certificate, run the following commands to store the password in the {{es}} keystore: ```shell ./bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password @@ -115,8 +135,8 @@ Complete the following steps **for each node in your cluster**. To join the same ./bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password ``` -3. Complete the previous steps for each node in your cluster. -4. On **every** node in your cluster, start {{es}}. The method for [starting](../maintenance/start-stop-services/start-stop-elasticsearch.md) and [stopping](../maintenance/start-stop-services/start-stop-elasticsearch.md) {{es}} varies depending on how you installed it. +4. Complete the previous steps for each node in your cluster. +5. On **every** node in your cluster, start {{es}}. The method for [starting](../maintenance/start-stop-services/start-stop-elasticsearch.md) and [stopping](../maintenance/start-stop-services/start-stop-elasticsearch.md) {{es}} varies depending on how you installed it. For example, if you installed {{es}} with an archive distribution (`tar.gz` or `.zip`), you can enter `Ctrl+C` on the command line to stop {{es}}. diff --git a/deploy-manage/toc.yml b/deploy-manage/toc.yml index 8b4773bbf1..575db3b6f4 100644 --- a/deploy-manage/toc.yml +++ b/deploy-manage/toc.yml @@ -488,6 +488,7 @@ toc: children: - file: security/k8s-https-settings.md - file: security/k8s-transport-settings.md + - file: security/external-ca-transport.md - file: security/network-security.md children: - file: security/network-security-policies.md