Skip to content

Commit 51b55ac

Browse files
lcawltvernum
andcommitted
[DOCS] Updates TLS tutorial for use with basic licenses and new cluster formation settings (#358)
Co-Authored-By: Tim Vernum <[email protected]>
1 parent 69c5feb commit 51b55ac

8 files changed

+320
-271
lines changed

docs/en/getting-started/get-started-stack.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ endif::[]
175175
For other operating systems, go to the
176176
https://www.elastic.co/downloads/elasticsearch[{es} download] page.
177177

178+
TIP: The default {ref}/cluster.name.html[cluster.name] and
179+
{ref}/node.name.html[node.name] are `elasticsearch` and your hostname,
180+
respectively. If you plan to keep using this cluster or add more nodes, it is a
181+
good idea to change these default values to unique names. For details about
182+
changing these and other settings in the `elasticsearch.yml` file, see
183+
{ref}/settings.html[Configuring {es}].
184+
178185
To learn more about installing, configuring, and running {es}, read the
179186
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html[{es} Reference].
180187

docs/en/stack/index.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:kib-repo-dir: {docdir}/../../../../kibana/docs
1515
:xes-repo-dir: {docdir}/../../../../elasticsearch/x-pack/docs/en
1616
:es-repo-dir: {docdir}/../../../../elasticsearch/docs/reference
17+
:stack-repo-dir: {docdir}
1718

1819
include::{asciidoc-dir}/../../shared/versions71.asciidoc[]
1920
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]

docs/en/stack/security/get-started-builtin-users.asciidoc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
// tag::create-users[]
12
There are <<built-in-users,built-in users>> that you can use for specific
23
administrative purposes: `apm_system`, `beats_system`, `elastic`, `kibana`,
34
`logstash_system`, and `remote_monitoring_user`.
45

6+
// end::create-users[]
7+
58
Before you can use them, you must set their passwords:
69

710
. Restart {es}. For example, if you installed {es} with a `.tar.gz` package, run
@@ -16,12 +19,15 @@ the following command from the {es} directory:
1619
See {ref}/starting-elasticsearch.html[Starting {es}].
1720
--
1821
19-
. Set the built-in users' passwords. Run the following command from the {es}
20-
directory:
22+
. Set the built-in users' passwords.
2123
+
2224
--
25+
// tag::create-users[]
26+
Run the following command from the {es} directory:
27+
2328
["source","sh",subs="attributes,callouts"]
2429
----------------------------------------------------------------------
2530
./bin/elasticsearch-setup-passwords interactive
2631
----------------------------------------------------------------------
32+
// end::create-users[]
2733
--

docs/en/stack/security/get-started-kibana-users.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ store them in a keystore instead. Run the following commands to create the {kib}
3434
keystore and add the secure settings:
3535
+
3636
--
37+
// tag::store-kibana-user[]
3738
["source","sh",subs="attributes,callouts"]
3839
----------------------------------------------------------------------
3940
./bin/kibana-keystore create
@@ -44,6 +45,7 @@ keystore and add the secure settings:
4445
When prompted, specify the `kibana` built-in user and its password for these
4546
setting values. The settings are automatically applied when you start {kib}.
4647
To learn more, see {kibana-ref}/secure-settings.html[Secure settings].
48+
// end::store-kibana-user[]
4749
--
4850
4951
. Restart {kib}. For example, if you installed
Lines changed: 111 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
11
[role="xpack"]
2-
[testenv="trial"]
2+
[testenv="basic"]
33
[[encrypting-communications-hosts]]
44
=== Add nodes to your cluster
55

6-
Up to this point, we have used a cluster with a single {es} node to get up and
7-
running with the {stack}. An {es} _node_ is a single server that is part of your
8-
cluster and stores pieces of your data called _shards_.
9-
10-
You can add more nodes to your cluster and optionally designate specific purposes
11-
for each node. For example, you can allocate master nodes, data nodes, ingest
12-
nodes, machine learning nodes, and dedicated coordinating nodes. For details
13-
about each node type, see {ref}/modules-node.html[Nodes].
14-
15-
In a single cluster, you can have as many nodes as you want but they must be
16-
able to communicate with each other. The communication between nodes in a
17-
cluster is handled by the {ref}/modules-transport.html[transport module]. To
18-
secure your cluster, you must ensure that the internode communications are
19-
encrypted.
20-
21-
NOTE: In this tutorial, we add more nodes by installing more copies of {es} on
22-
the same machine. By default, {es} binds to loopback addresses for HTTP and
23-
transport communication. That is fine for the purposes of this tutorial and for
24-
downloading and experimenting with {es} in a test or development environment.
25-
When you are deploying a production environment, however, you are generally
26-
adding nodes on different machines so that your cluster is resilient to outages
27-
and avoids data loss. In a production scenario, there are additional
28-
requirements that are not covered in this tutorial. See
29-
{ref}/bootstrap-checks.html#dev-vs-prod-mode[Development vs production mode] and
30-
{ref}/add-elasticsearch-nodes.html[Adding nodes to your cluster].
6+
You can add more nodes to your cluster and optionally designate specific
7+
purposes for each node. For example, you can allocate master nodes, data nodes,
8+
ingest nodes, machine learning nodes, and dedicated coordinating nodes. For
9+
details about each node type, see {ref}/modules-node.html[Nodes].
3110

3211
Let's add two nodes to our cluster!
3312

@@ -39,103 +18,142 @@ in a separate folder. You can simply repeat the steps that you used to install
3918
{stack-gs}/get-started-elastic-stack.html#install-elasticsearch[Getting started with the {stack}]
4019
tutorial.
4120

42-
. Update the `ES_PATH_CONF/elasticsearch.yml` file on each node:
21+
. Generate certificates for the two new nodes.
4322
+
4423
--
45-
.. Enable the {es} {security-features}.
46-
.. Ensure that the nodes share the same {ref}/cluster.name.html[`cluster.name`].
47-
.. Give each node a unique {ref}/node.name.html[`node.name`].
48-
.. Specify the minimum number of master-eligible nodes that must be available to
49-
form a cluster. By default, each node is eligible to be elected as the
50-
{ref}/modules-node.html#master-node[master node] and control the cluster. To
51-
avoid a _split brain_ scenario where multiple nodes elect themselves as the
52-
master, use the `discovery.zen.minimum_master_nodes` setting.
53-
54-
By default, if you run multiple {es} nodes on the same machine, it
55-
automatically uses free ports in the range 9200-9300 for HTTP and 9300-9400 for
56-
transport. If you want to assign specific port numbers to each node, however,
57-
you can add {ref}/modules-transport.html[TCP transport settings]. You can then
58-
provide a list of these seed nodes,
59-
which is used to discover the nodes in your cluster.
24+
For example, run the following command:
6025

61-
For example, add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
62-
file on the first node:
26+
["source","sh",subs="attributes,callouts"]
27+
----------------------------------------------------------------------
28+
./bin/elasticsearch-certutil cert \
29+
--ca elastic-stack-ca.p12 \ <1>
30+
--multiple
31+
----------------------------------------------------------------------
32+
// NOTCONSOLE
33+
<1> Use the certificate authority that you created in <<encrypting-communications-certificates>>.
6334

64-
[source,yaml]
65-
----
66-
xpack.security.enabled: true
67-
cluster.name: test-cluster
68-
node.name: node-1
69-
discovery.zen.minimum_master_nodes: 2
70-
transport.tcp.port: 9301
71-
discovery.zen.ping.unicast.hosts: ["localhost:9302", "localhost:9303"]
72-
----
35+
You are prompted for information about each new node. Specify `node-2` and
36+
`node-3` for the instance names. For the purposes of this tutorial, specify the
37+
same IP address (`127.0.0.1,::1`) and DNS name (`localhost`) for each node.
7338

74-
Add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
39+
You are prompted to enter the password for your CA. You are also prompted to
40+
create a password for each certificate.
41+
42+
By default, the command produces a zip file named `certificate-bundle.zip`,
43+
which contains the generated certificates and keys.
44+
--
45+
46+
. Decompress the `certificate-bundle.zip` file. For example:
47+
+
48+
--
49+
["source","sh",subs="attributes,callouts"]
50+
----------------------------------------------------------------------
51+
unzip certificate-bundle.zip
52+
53+
Archive: certificate-bundle.zip
54+
creating: node-2/
55+
inflating: node-2/node-2.p12
56+
creating: node-3/
57+
inflating: node-3/node-3.p12
58+
----------------------------------------------------------------------
59+
// NOTCONSOLE
60+
61+
The `certificate-bundle.zip` file contains a folder for each of your nodes. Each
62+
folder contains a single PKCS#12 keystore that includes a node certificate,
63+
node key, and CA certificate.
64+
--
65+
66+
. Create a folder to contain certificates in the configuration directory of each
67+
{es} node. For example, create a `certs` folder in the `config` directory.
68+
69+
. Copy the appropriate certificate to the configuration directory on each node.
70+
For example, copy the `node-2.p12` file into the `config/certs` directory on the
71+
second node and the `node-3.p12` into the `config/certs` directory on the third
72+
node.
73+
74+
. Specify the name of the cluster and give each node a unique name.
75+
+
76+
--
77+
For example, add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
7578
file on the second node:
7679

7780
[source,yaml]
7881
----
79-
xpack.security.enabled: true
8082
cluster.name: test-cluster
8183
node.name: node-2
82-
discovery.zen.minimum_master_nodes: 2
83-
transport.tcp.port: 9302
84-
discovery.zen.ping.unicast.hosts: ["localhost:9301", "localhost:9303"]
8584
----
8685

8786
Add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
8887
file on the third node:
8988

9089
[source,yaml]
9190
----
92-
xpack.security.enabled: true
9391
cluster.name: test-cluster
9492
node.name: node-3
95-
discovery.zen.minimum_master_nodes: 2
96-
transport.tcp.port: 9303
97-
discovery.zen.ping.unicast.hosts: ["localhost:9301", "localhost:9302"]
9893
----
9994

100-
TIP: In these examples, we have not specified the `transport.host`,
101-
`transport.bind_host`, or `transport.publish_host` settings, so they default to
102-
the `network.host` value. If you have not specified the `network.host` setting,
103-
it defaults to `_local_`, which represents the loopback addresses for the system.
95+
NOTE: In order to join the same cluster as the first node, they must share the
96+
same `cluster.name` value.
10497

105-
If you choose different cluster names, node names, host names, or ports, you
106-
must substitute the appropriate values in subsequent steps as well.
10798
--
10899

109-
. Start each {es} node. For example, if you installed {es} with a `.tar.gz`
110-
package, run the following command from each {es} directory:
100+
. (Optional) Provide seed addresses to help your nodes discover other nodes with
101+
which to form a cluster.
111102
+
112103
--
113-
["source","sh",subs="attributes,callouts"]
114-
----------------------------------------------------------------------
115-
./bin/elasticsearch
116-
----------------------------------------------------------------------
104+
For example, add the following setting in the `ES_PATH_CONF/elasticsearch.yml`
105+
file:
117106

118-
See {ref}/starting-elasticsearch.html[Starting {es}].
107+
[source,yaml]
108+
----
109+
discovery.seed_hosts: ["localhost"]
110+
----
111+
112+
The default value for this setting is `127.0.0.1, [::1]`, therefore it isn't
113+
actually required in this tutorial. When you want to form a cluster with nodes
114+
on other hosts, however, you must use this setting to provide a list of
115+
master-eligible nodes to seed the discovery process. For more information, see
116+
{ref}/modules-discovery-hosts-providers.html[Discovery].
117+
--
118+
119+
. On each node, enable TLS for transport communications. You must also configure
120+
each node to identify itself using its signed certificate.
121+
+
122+
--
123+
include::tutorial-tls-internode.asciidoc[tag=enable-tls]
124+
--
125+
126+
. On each node, store the password for the PKCS#12 file in the {es} keystore.
127+
+
128+
--
129+
include::tutorial-tls-internode.asciidoc[tag=secure-passwords]
119130

131+
On the second node, supply the password that you created for the `node-2.p12`
132+
file. On the third node, supply the password that you created for the
133+
`node-3.p12` file.
120134
--
121135

122-
. (Optional) Restart {kib}. For example, if you installed
123-
{kib} with a `.tar.gz` package, run the following command from the {kib}
124-
directory:
136+
. Start each {es} node. For example, if you installed {es} with a `.tar.gz`
137+
package, run the following command from each {es} directory:
125138
+
126139
--
127140
["source","sh",subs="attributes,callouts"]
128141
----------------------------------------------------------------------
129-
./bin/kibana
142+
./bin/elasticsearch
130143
----------------------------------------------------------------------
131144

132-
See {kibana-ref}/start-stop.html[Starting and stopping {kib}].
145+
See {ref}/starting-elasticsearch.html[Starting {es}].
146+
147+
If you encounter errors, you can see some common problems and solutions in
148+
<<trb-security-ssl>>.
133149
--
134150

135-
. Verify that your cluster now contains three nodes. For example, use the
136-
{ref}/cluster-health.html[cluster health API]:
151+
. Verify that your cluster now contains three nodes.
137152
+
138153
--
154+
For example, log into {kib} with the `elastic` built-in user. Go to
155+
*Dev Tools > Console* and run the {ref}/cluster-health.html[cluster health API]:
156+
139157
[source,js]
140158
----------------------------------
141159
GET _cluster/health
@@ -161,3 +179,14 @@ Now that you have multiple nodes, your data can be distributed across the
161179
cluster in multiple primary and replica shards. For more information about the
162180
concepts of clusters, nodes, and shards, see
163181
{ref}/getting-started.html[Getting started with {es}].
182+
183+
[float]
184+
[[encrypting-internode-nextsteps]]
185+
=== What's next?
186+
187+
Congratulations! You've encrypted communications between the nodes in your
188+
cluster and can pass the
189+
{ref}/bootstrap-checks-xpack.html#bootstrap-checks-tls[TLS bootstrap check].
190+
191+
If you want to encrypt communications between other products in the {stack}, see
192+
<<encrypting-communications>>.

0 commit comments

Comments
 (0)