- Lab
- A Cloud Guru
Encrypt Cluster and Client Elasticsearch Networks
No matter what technology we are working with, we always need to be mindful of security. Big data platforms are certainly no exception, as they can contain massive amounts of sensitive data that must be protected. Elasticsearch provides multiple security mechanisms through X-Pack Security. In this hands-on lab, you will complete the following tasks on a 3-node Elasticsearch cluster: * Generate a certificate authority * Generate node certificates * Add certificate passwords to Elasticsearch's keystore * Enable cluster (transport) network encryption * Enable client (HTTP) network encryption * Set built-in user passwords
Path Info
Table of Contents
-
Challenge
Generate a Certificate Authority (CA).
-
Using the Secure Shell (SSH), log in to each node as
cloud_user
via the public IP address. -
Become the
elastic
user with:
sudo su - elastic
- Create a
certs
directory on each node:
mkdir /home/elastic/elasticsearch/config/certs
- On the
master-1
node, create a CA certificate with passwordelastic_ca
in the newcerts
directory:
/home/elastic/elasticsearch/bin/elasticsearch-certutil ca --out config/certs/ca --pass elastic_ca
-
-
Challenge
Generate and deploy a certificate for each node per instructions.
-
Using the Secure Shell (SSH), log in to the master-1 node as
cloud_user
via the public IP address. -
Become the
elastic
user with:
sudo su - elastic
- On the master-1 node, generate each node's certificate with the CA per instructions:
/home/elastic/elasticsearch/bin/elasticsearch-certutil cert --ca config/certs/ca --ca-pass elastic_ca --name master-1 --dns ip-10-1-101.ec2.internal --ip 10.0.1.101 --out config/certs/master-1 --pass elastic_master_1 /home/elastic/elasticsearch/bin/elasticsearch-certutil cert --ca config/certs/ca --ca-pass elastic_ca --name master-2 --dns ip-10-1-102.ec2.internal --ip 10.0.1.102 --out config/certs/master-2 --pass elastic_master_2 /home/elastic/elasticsearch/bin/elasticsearch-certutil cert --ca config/certs/ca --ca-pass elastic_ca --name master-3 --dns ip-10-1-103.ec2.internal --ip 10.0.1.103 --out config/certs/master-3 --pass elastic_master_3 /home/elastic/elasticsearch/bin/elasticsearch-certutil cert --ca config/certs/ca --ca-pass elastic_ca --name data-1 --dns ip-10-1-104.ec2.internal --ip 10.0.1.104 --out config/certs/data-1 --pass elastic_data_1 /home/elastic/elasticsearch/bin/elasticsearch-certutil cert --ca config/certs/ca --ca-pass elastic_ca --name data-2 --dns ip-10-1-105.ec2.internal --ip 10.0.1.105 --out config/certs/data-2 --pass elastic_data_2 /home/elastic/elasticsearch/bin/elasticsearch-certutil cert --ca config/certs/ca --ca-pass elastic_ca --name data-3 --dns ip-10-1-106.ec2.internal --ip 10.0.1.106 --out config/certs/data-3 --pass elastic_data_3
- On the master-1 node, remote copy each certificate to the
certs
directory created on each node:
scp /home/elastic/elasticsearch/config/certs/master-2 10.0.1.102:/home/elastic/elasticsearch/config/certs scp /home/elastic/elasticsearch/config/certs/master-3 10.0.1.103:/home/elastic/elasticsearch/config/certs scp /home/elastic/elasticsearch/config/certs/data-1 10.0.1.104:/home/elastic/elasticsearch/config/certs scp /home/elastic/elasticsearch/config/certs/data-2 10.0.1.105:/home/elastic/elasticsearch/config/certs scp /home/elastic/elasticsearch/config/certs/data-3 10.0.1.106:/home/elastic/elasticsearch/config/certs
- Add the transport keystore password on each node:
echo "CERTIFICATE_PASSWORD_HERE" | /home/elastic/elasticsearch/bin/elasticsearch-keystore add --stdin xpack.security.transport.ssl.keystore.secure_password
- Add the transport truststore password on each node:
echo "CERTIFICATE_PASSWORD_HERE" | /home/elastic/elasticsearch/bin/elasticsearch-keystore add --stdin xpack.security.transport.ssl.truststore.secure_password
- Add the HTTP keystore password on each node:
echo "CERTIFICATE_PASSWORD_HERE" | /home/elastic/elasticsearch/bin/elasticsearch-keystore add --stdin xpack.security.http.ssl.keystore.secure_password
- Add the HTTP truststore password on each node:
echo "CERTIFICATE_PASSWORD_HERE" | /home/elastic/elasticsearch/bin/elasticsearch-keystore add --stdin xpack.security.http.ssl.truststore.secure_password
-
-
Challenge
Configure transport network encryption and restart Elasticsearch.
-
Using the Secure Shell (SSH), log in to each node as
cloud_user
via the public IP address. -
Become the
elastic
user with:
sudo su - elastic
- Add the following to
/home/elastic/elasticsearch/config/elasticsearch.yml
on each node:
# # ---------------------------------- X-Pack ------------------------------------ # xpack.security.enabled: true xpack.security.transport.ssl.enabled: true xpack.security.transport.ssl.verification_mode: full xpack.security.transport.ssl.keystore.path: certs/CERTIFICATE_FILE_NAME_HERE xpack.security.transport.ssl.truststore.path: certs/CERTIFICATE_FILE_NAME_HERE
- Stop Elasticsearch:
pkill -F /home/elastic/elasticsearch/pid
- Start Elasticsearch as a background daemon and record the PID to a file:
/home/elastic/elasticsearch/bin/elasticsearch -d -p pid
-
-
Challenge
Use the elasticsearch-setup-passwords tool to set the password for each built-in user.
-
Using the Secure Shell (SSH), log in to the master-1 node as
cloud_user
via the public IP address. -
Become the
elastic
user with:
sudo su - elastic
- Set the built-in user passwords using the
elasticsearch-setup-passwords
utility on the master-1 node:
/home/elastic/elasticsearch/bin/elasticsearch-setup-passwords interactive
- Use the following passwords:
User: elastic Password: la_elastic_409 User: apm_system Password: la_apm_system_409 User: kibana Password: la_kibana_409 User: logstash_system Password: la_logstash_system_409 User: beats_system Password: la_beats_system_409 User: remote_monitoring_user Password: la_remote_monitoring_user_409
-
-
Challenge
Configure HTTP network encryption and restart Elasticsearch.
-
Using the Secure Shell (SSH), log in to each node as
cloud_user
via the public IP address. -
Become the
elastic
user with:
sudo su - elastic
- Add the following to
/home/elastic/elasticsearch/config/elasticsearch.yml
:
xpack.security.http.ssl.enabled: true xpack.security.http.ssl.keystore.path: certs/CERTIFICATE_FILE_NAME_HERE xpack.security.http.ssl.truststore.path: certs/CERTIFICATE_FILE_NAME_HERE
- Stop Elasticsearch:
pkill -F /home/elastic/elasticsearch/pid
- Start Elasticsearch as a background daemon and record the PID to a file:
/home/elastic/elasticsearch/bin/elasticsearch -d -p pid
-
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.