| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | [[node-certificates]]==== Generating Node CertificatesTLS requires X.509 certificates to perform encryption and authentication of theapplication that is being communicated with. In order for the communicationbetween nodes to be truly secure, the certificates must be validated. Therecommended approach for validating certificate authenticity in an {es} clusteris to trust the certificate authority (CA) that signed the certificate. By doingthis, as nodes are added to your cluster they just need to use a certificatesigned by the same CA and the node is automatically allowed to join the cluster.Additionally, it is recommended that the certificates contain subject alternativenames (SAN) that correspond to the node's IP address and DNS name so thathostname verification can be performed.The {ref}/certutil.html[`elasticsearch-certutil`] command simplifies the processof generating certificates for the {stack}. It takes care of generating a CA andsigning certificates with the CA. It can be used interactively or in a silentmode through the use of an input file. It also supports generation ofcertificate signing requests (CSR), so that a commercial- ororganization-specific CA can be used to sign the certificates. For example:. Optional: Create a certificate authority for your {es} cluster.+--For example, use the `elasticsearch-certutil ca` command:[source,shell]----------------------------------------------------------bin/elasticsearch-certutil ca----------------------------------------------------------You can configure the cluster to trust all nodes that have a certificate thathas been signed by this CA.The command outputs a single file, with a default name of `elastic-stack-ca.p12`.This file is a PKCS#12 keystore that contains the public certificate for your CAand the private key that is used to sign the certificates for each node.The `elasticsearch-certutil` command also prompts you for a password to protectthe file and key. If you plan to add more nodes to your cluster in the future,retain a copy of the file and remember its password.--. Generate a certificate and private key for each node in your cluster.+--For example, use the `elasticsearch-certutil cert` command:[source,shell]----------------------------------------------------------bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12----------------------------------------------------------The output is a single PKCS#12 keystore that includes the node certificate, nodekey, and CA certificate.You are also prompted for a password. You can enter a password for yourcertificate and key, or you can leave the password blank by pressing Enter.By default `elasticsearch-certutil` generates certificates that have no hostnameinformation in them (that is, they do not have any Subject Alternative Namefields). This means that you can use the certificate for every node in yourcluster, but you must turn off hostname verification as shown in theconfiguration below.If you want to use hostname verification within your cluster, run the`elasticsearch-certutil cert` command once for each of your nodes and providethe `--name`, `--dns` and `--ip` options.NOTE: You should secure the output files, since they contain the private keysfor your instance.Alternatively, if you want to use a commercial or organization-specific CA,you can use the `elasticsearch-certutil csr` command to generate certificatesigning requests (CSR) for the nodes in your cluster. For more information, see<<certutil>>.--. Copy the node certificate to the appropriate locations.+--Copy the applicable `.p12` file into a directory within the {es} configurationdirectory on each node. For example, `/home/es/config/certs`. There is no needto copy the CA file to this directory.For each additional Elastic product that you want to configure, copy thecertificates to the relevant configuration directory. --NOTE: If you choose not to use `elasticsearch-certutil`, the certificates thatyou obtain must allow for both `clientAuth` and `serverAuth` if the extended keyusage extension is present. The certificates need to be in PEM or PKCS#12format. Although not required, it is highly recommended that the certificatecontain the DNS names and/or IP addresses of the node so that hostnameverification can be used.
 |