tutorial-tls-internode.asciidoc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. [role="xpack"]
  2. [testenv="trial"]
  3. [[encrypting-internode]]
  4. === Encrypt internode communications
  5. Now that we've generated a certificate authority and certificates, let's update
  6. the cluster to use these files.
  7. IMPORTANT: When you enable {es} {security-features}, unless you have a trial
  8. license, you must use Transport Layer Security (TLS) to encrypt internode
  9. communication. By following the steps in this tutorial, you learn how
  10. to meet the minimum requirements to pass the
  11. <<bootstrap-checks-tls,TLS bootstrap check>>.
  12. . (Optional) Name the cluster.
  13. +
  14. --
  15. For example, add the <<cluster.name,cluster.name>> setting in the
  16. `ES_PATH_CONF/elasticsearch.yml` file:
  17. [source,yaml]
  18. ----
  19. cluster.name: test-cluster
  20. ----
  21. TIP: The `ES_PATH_CONF` environment variable contains the path for the {es}
  22. configuration files. If you installed {es} using archive distributions (`zip` or
  23. `tar.gz`), it defaults to `ES_HOME/config`. If you used package distributions
  24. (Debian or RPM), it defaults to `/etc/elasticsearch`. For more information, see
  25. <<settings>>.
  26. The default cluster name is `elasticsearch`. You should choose a unique name,
  27. however, to ensure that your nodes join the right cluster.
  28. --
  29. . (Optional) Name the {es} node.
  30. +
  31. --
  32. For example, add the <<node.name,node.name>> setting in the
  33. `ES_PATH_CONF/elasticsearch.yml` file:
  34. [source,yaml]
  35. ----
  36. node.name: node-1
  37. ----
  38. In this tutorial, the cluster will consist of three nodes that exist on the same
  39. machine and share the same (loopback) IP address and hostname. Therefore, we
  40. must give each node a unique name.
  41. This step is also necessary if you want to use the `node.name` value to define
  42. the location of certificates in subsequent steps.
  43. --
  44. . Disable single-node discovery.
  45. +
  46. --
  47. To enable {es} to form a multi-node cluster, use the default value for the
  48. `discovery.type` setting. If that setting exists in your
  49. `ES_PATH_CONF/elasticsearch.yml` file, remove it.
  50. --
  51. . (Optional) If you are starting the cluster for the first time, specify the
  52. initial set of master-eligible nodes.
  53. +
  54. --
  55. For example, add the following setting in the `ES_PATH_CONF/elasticsearch.yml`
  56. file:
  57. [source,yaml]
  58. ----
  59. cluster.initial_master_nodes: ["node-1"]
  60. ----
  61. If you start an {es} node without configuring this setting or any other
  62. discovery settings, it will start up in development mode and auto-bootstrap
  63. itself into a new cluster.
  64. TIP: If you are starting a cluster with multiple master-eligible nodes for the
  65. first time, add all of those node names to the `cluster.initial_master_nodes`
  66. setting.
  67. See <<modules-discovery-bootstrap-cluster>> and
  68. <<discovery-settings>>.
  69. --
  70. . Enable Transport Layer Security (TLS/SSL) for transport (internode)
  71. communications.
  72. +
  73. --
  74. // tag::enable-tls[]
  75. For example, add the following settings in the `ES_PATH_CONF/elasticsearch.yml`
  76. file:
  77. [source,yaml]
  78. ----
  79. xpack.security.enabled: true
  80. xpack.security.transport.ssl.enabled: true
  81. xpack.security.transport.ssl.keystore.path: certs/${node.name}.p12 <1>
  82. xpack.security.transport.ssl.truststore.path: certs/${node.name}.p12
  83. ----
  84. <1> If the file name for your certificate does not match the `node.name` value,
  85. you must put the appropriate file name in the `elasticsearch.yml` file.
  86. // end::enable-tls[]
  87. NOTE: The PKCS#12 keystore that is output by the `elasticsearch-certutil` can be
  88. used as both a keystore and a truststore. If you use other tools to manage and
  89. generate your certificates, you might have different values for these settings,
  90. but that scenario is not covered in this tutorial.
  91. For more information, see <<get-started-enable-security>> and
  92. <<transport-tls-ssl-settings>>.
  93. --
  94. . Store the password for the PKCS#12 file in the {es} keystore.
  95. +
  96. --
  97. // tag::secure-passwords[]
  98. For example, run the following commands:
  99. ["source","sh",subs="attributes,callouts"]
  100. ----------------------------------------------------------------------
  101. ./bin/elasticsearch-keystore create <1>
  102. ./bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
  103. ./bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
  104. ----------------------------------------------------------------------
  105. <1> If the {es} keystore already exists, this command asks whether you want to
  106. overwrite it. You do not need to overwrite it; you can simply add settings to
  107. your existing {es} keystore.
  108. // end::secure-passwords[]
  109. You are prompted to supply the password that you created for the `node-1.p12`
  110. file. We are using this file for both the transport TLS keystore and truststore,
  111. therefore supply the same password for both of these settings.
  112. --
  113. . <<starting-elasticsearch,Start {es}>>.
  114. +
  115. --
  116. For example, if you installed {es} with a `.tar.gz` package, run the following
  117. command from the {es} directory:
  118. ["source","sh",subs="attributes,callouts"]
  119. ----------------------------------------------------------------------
  120. ./bin/elasticsearch
  121. ----------------------------------------------------------------------
  122. --
  123. . Create passwords for the built-in users and configure {kib} to use them.
  124. +
  125. --
  126. NOTE: If you already configured passwords for these users in other tutorials,
  127. you can skip this step.
  128. include::{xes-repo-dir}/security/get-started-builtin-users.asciidoc[tag=create-users]
  129. After you setup the password for the `kibana_system` built-in user,
  130. <<get-started-kibana-user,configure {kib} to use it>>.
  131. For example, run the following commands to create the {kib} keystore and add the
  132. `kibana_system` built-in user and its password in secure settings:
  133. include::{xes-repo-dir}/security/get-started-kibana-users.asciidoc[tag=store-kibana-user]
  134. --
  135. . Start {kib}.
  136. +
  137. --
  138. For example, if you installed {kib} with a `.tar.gz` package, run the following
  139. command from the {kib} directory:
  140. ["source","sh",subs="attributes,callouts"]
  141. ----------------------------------------------------------------------
  142. ./bin/kibana
  143. ----------------------------------------------------------------------
  144. See {kibana-ref}/start-stop.html[Starting and stopping {kib}].
  145. --