DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Building Threat Intelligence Pipelines Using Python, APIs, and Elasticsearch
  • IoT Needs To Get Serious About Security
  • Strengthening Cybersecurity: The Role of Digital Certificates and PKI in Authentication
  • Best Practices To Secure Data Transmission

Trending

  • Pragmatica Aether: Let Java Be Java
  • Jakarta EE 12: Entering the Data Age of Enterprise Java
  • Liquid Glass, Material 3, and a Lot of Plumbing
  • Advanced Error Handling and Retry Patterns in Enterprise REST Integrations
  1. DZone
  2. Software Design and Architecture
  3. Security
  4. Elasticsearch TLS Activation: X-Pack Security

Elasticsearch TLS Activation: X-Pack Security

In this article, learn more about what the Elasticsearch TLS structure is used to ensure, and also how to activate the x-pack-security module.

By 
Omer Yilmaz user avatar
Omer Yilmaz
·
Sep. 21, 22 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
5.8K Views

Join the DZone community and get the full member experience.

Join For Free

TLS (Transport Layer Security) is the general name of a standardized encryption protocol for inter-network communications. Transfer Protocol, on the other hand, is a special name that Elasticsearch uses for data transfer.

On the Elasticsearch side, the TLS structure is used to ensure data transfer between clusters (nodes) in an encrypted manner and to prevent nodes that do not provide the relevant encryption certificate from connecting to the existing cluster structure unannounced. Along with this, we will also activate the xpack.security module.

Process Steps

When we use the Elasticsearch basic license, security mode is installed by default as disabled. For this process, we first need to activate the xpack.security module.  To do this, on the computer with Elasticsearch installed, we need to add the following two lines of code into the elasticsearch.yml file in the C:\elastic\config directory (in which directory you installed it).

If you have a cluster consisting of more than one node, we need to do this on all nodes.

#action.destructive_requires_name: true

 
xpack.security.enabled: true 
xpack.security.transport.ssl.enabled: true


After this process, we need to restart the service in order to detect the changes and move on to other configurations. After restarting the service, we enter the bin folder in the directory where Elasticsearch is installed and open the command line here.

Then we create a certificate using elasticsearch-certutil ca command. 

When we enter this command, it asks us to give a name to the certificate we will create. If you press enter directly, it creates a certificate named default elastic-stack-ca.p12 (p12 extension). 

After renaming, we set a password for the certificate. Be sure to take note of the password here, as we will also use it when creating the keystore and adding other nodes to the cluster. 

Set a password for the certificate


After the above operations, a certificate will be created with the name we gave to the Elasticsearch main directory. We are moving this certificate to the config folder in the Elasticsearch home directory.

Move certificate to the config folder in the Elasticsearch home directory

After the migration, we run the command line while in the bin folder in the Elasticsearch main directory. At this stage, we will create our keystore files as follows:

  • elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password: Enter the command and press enter. It is waiting for a password from us. We create our keystore file with the password we gave to the certificate.
  • elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password: Enter the command and press enter. When it asks for a password, we enter the same password again and press enter.

When it asks for a password, we enter the same password again and press enter

After this step, we make the relevant certificate and keystore definitions in the elasticsearch.yml file as follows.

 
xpack.security.transport.ssl.verification_mode: certificate 
xpack.security.transport.ssl.client_authentication: required 
xpack.security.transport.ssl.keystore.path: global-test-ca.p12 
xpack.security.transport.ssl.truststore.path: global-test-ca.p12


The latest version of elasticsearch.yml file:

Latest version of elasticsearch.yml file-

With this process, we now specify our certificate and keystore files to be used in data transfer between nodes. 

Now, finally, let's run the command line again in the bin folder to determine the password to be used in HTTP requests. After running the command line, we can set two types of passwords:

  • elasticsearch-setpassword auto: It automatically determines the passwords and displays them on the console at the end of the process.

elasticsearch-setpassword auto automatically determines the passwords and displays them on the console at the end of the process

  • elasticsearch-setpassword interactive:  You have to enter and verify the password for each module one by one.

Enter and verify the password for each module one by one

Finally, we just need to restart the services on each node.

PS: If we have a cluster consisting of more than one node, we need to perform these operations on all nodes.

Elasticsearch TLS security

Opinions expressed by DZone contributors are their own.

Related

  • Building Threat Intelligence Pipelines Using Python, APIs, and Elasticsearch
  • IoT Needs To Get Serious About Security
  • Strengthening Cybersecurity: The Role of Digital Certificates and PKI in Authentication
  • Best Practices To Secure Data Transmission

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook