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
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • IoT Needs To Get Serious About Security
  • Strengthening Cybersecurity: The Role of Digital Certificates and PKI in Authentication
  • Best Practices To Secure Data Transmission
  • Host Hack Attempt Detection Using ELK

Trending

  • Agile’s Quarter-Century Crisis
  • Navigating and Modernizing Legacy Codebases: A Developer's Guide to AI-Assisted Code Understanding
  • Advancing Robot Vision and Control
  • The Perfection Trap: Rethinking Parkinson's Law for Modern Engineering Teams
  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
DZone Core CORE ·
Sep. 21, 22 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
5.6K 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

  • IoT Needs To Get Serious About Security
  • Strengthening Cybersecurity: The Role of Digital Certificates and PKI in Authentication
  • Best Practices To Secure Data Transmission
  • Host Hack Attempt Detection Using ELK

Partner Resources

×

Comments
Oops! Something Went Wrong

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!