Transport Layer Encryption (TLS) in Elasticsearch

Transport Layer Encryption (TLS) in Elasticsearch

A complete, friendly guide to how Elasticsearch locks the conversations between its nodes and its clients, how certificates prove who is who, how to set it all up and keep it healthy, and how to fix it when a handshake fails at three in the morning.

Imagine you need to send a bundle of private papers across town. You could hand them to a courier in an open basket, and anyone on the street could read them or swap a page. Or you could place them in a locked box, give the courier a key that only the receiver can match, and ask the receiver to show an official badge at the door before the box is opened. The papers arrive unread, unchanged, and in the right hands.

That is what TLS does for the data moving around an Elasticsearch cluster. It puts every message in a locked box, it checks badges on both ends, and it notices if anybody tampers with the contents. Without it, the servers of your search platform whisper their secrets across the network in plain text, and anybody who can listen can learn everything.

In this guide you will learn what TLS is, why Elasticsearch uses it in two different places, how certificates and trust work, how to configure and renew them, and how to diagnose the errors that everybody meets sooner or later. You do not need a security background. Every new word is explained the first time it appears, and each big idea comes with an everyday comparison.

1What Is TLS in Elasticsearch?

The shortest possible answer: TLS is the standard way to encrypt and authenticate network traffic, and Elasticsearch uses it to protect both node-to-node traffic and client-to-cluster traffic.

Let us build the definition slowly. Elasticsearch is a search and analytics engine. Companies use it to search products, explore application logs, count events, and draw charts. It usually runs as a cluster, which is a team of servers, called nodes, that share the work and the data. The nodes talk to each other all day long, and applications talk to the nodes to store and find data.

TLS stands for Transport Layer Security. It is a set of rules that two computers follow to talk safely over a network. It is the same technology that puts the little padlock in your web browser when you visit a bank. It is the successor of an older protocol called SSL, and people still say “SSL” out of habit, which is why Elasticsearch settings contain the word ssl even though modern TLS is what actually runs.

TLS gives three promises. The first is confidentiality: nobody in the middle can read the messages. The second is integrity: nobody in the middle can change a message without being noticed. The third is authentication: each side can check that the other side really is who it claims to be.

Everyday Analogy

Think of sending valuable parcels through a delivery company. Confidentiality is the opaque, locked box, so the courier cannot peek. Integrity is the tamper-proof seal, so anyone can see if the box was opened on the way. Authentication is the badge check at both doors, so the sender knows they are dealing with the real receiver and the receiver knows the sender is genuine. TLS is the whole delivery procedure with all three protections at once.

A small confusing coincidence

Here is a detail that trips up almost every beginner. The T in TLS stands for “transport,” and Elasticsearch also has something it calls the transport layer. These are two different uses of the same word. In TLS, “transport layer” is a general networking term for the level of the network stack where reliable connections live. In Elasticsearch, the “transport layer” is a specific communication channel that the nodes of a cluster use to talk to each other. TLS can protect the Elasticsearch transport layer, and it can also protect the other channel Elasticsearch has, the HTTP layer. Chapter 4 explains both channels in detail.

2 layers
Transport layer between nodes, HTTP layer for clients
3 promises
Secrecy, tamper detection, and identity checks
Certificates
The badges that let each side prove who it is
i
Name check

People say “transport layer encryption,” “TLS,” “SSL,” “node-to-node encryption,” and “encryption in transit.” In the Elasticsearch world these phrases all point to the same family of features. The phrase “encryption in transit” simply means protecting data while it moves, as opposed to protecting data while it sits on a disk.

What TLS is not

TLS protects data only while it travels. It does not encrypt the files on the disk of a node, which is a different topic called encryption at rest. It does not decide who is allowed to read which index, which is called authorization. It does not replace passwords or API keys for users. It is one important layer in a stack of protections, and Chapter 7 shows exactly where its job ends.

Where you will meet it

You will meet TLS the first time you start a modern Elasticsearch node and see a generated password and a security notice. You will meet it again when Kibana asks for an enrollment token, when a Beats agent complains about an unknown certificate authority, when a load balancer must be configured to reach the cluster, and when a certificate expires and a node refuses to rejoin the cluster. In every case, understanding the few ideas in this guide turns a mysterious error into a simple checklist.

2Why It Exists: The Problem of Open Conversations

A network is a shared space. Anyone with the right access can listen, copy, or interfere. TLS exists because trusting the network is not safe.

Data inside an Elasticsearch cluster is often valuable and sometimes private: customer records, payment events, health notes, security logs, business secrets. When a node sends a piece of that data to another node, the message travels through switches, routers, virtual networks, and sometimes across data centers or cloud regions. Every hop is a place where something can go wrong.

Four dangers on an open network

  • Eavesdropping. Someone who can watch the traffic reads it. This can be an attacker who broke into one machine on the network, a curious insider, or a misconfigured cloud setting that copies traffic to the wrong place.
  • Tampering. Someone changes a message on the way, for example altering a search result or a piece of data being copied to another node.
  • Impersonation. Someone pretends to be a trusted server or a trusted client. A client might send its password to a fake server that looks like the real one.
  • Rogue nodes. Someone starts their own Elasticsearch node, points it at your cluster, and asks to join. If joining is not protected, the cluster may happily copy data onto the stranger’s machine.
Everyday Analogy

Picture a school where all messages between teachers are carried by students in open hallways on unsealed postcards. Any student could read the postcards, change a grade, write a fake note in a teacher’s name, or even walk into the staff room saying “I am the new teacher.” The school fixes this with sealed envelopes, staff badges, and a door guard. TLS supplies the sealed envelopes and the badge check.

The rogue node problem is special

Elasticsearch is designed so that a new node can join a cluster and receive copies of the data called shards. A shard is one slice of an index, and an index is a big labeled cabinet of documents. If any machine on the network could join freely, it could simply ask for the data. Transport layer TLS solves this by requiring each joining node to show a certificate signed by an authority the cluster trusts. A stranger without a proper certificate is turned away at the door, even before passwords or roles are considered.

An illustrative story

MediTrack, an imaginary clinic software company

MediTrack stores appointment notes in a three-node Elasticsearch cluster. For a long time the cluster runs inside a private network with no encryption, because “nobody outside can reach it.” One day a contractor’s laptop, infected with malware, is plugged into the same network. The malware records traffic between the nodes and finds patient names in plain text. It also discovers that a new node can join the cluster without any credentials. This story is invented, but the two lessons are real: a private network is not a guarantee, and unprotected node communication invites both spying and unwanted joiners. After the incident, MediTrack turns on TLS on both layers, and the same malware sees only scrambled bytes and is refused entry.

Rules and expectations

Beyond attackers, there are also rules. Many industries require encryption of data in transit: payment card standards, health privacy laws, financial regulations, and internal company policies. Auditors ask a simple question: “Is traffic between your servers encrypted?” Elasticsearch with TLS lets you answer yes with evidence.

A short history

In older versions of Elasticsearch, security features were a separate, paid add-on, and many clusters ran wide open. Over time, basic security, including TLS, moved into the free tier, and modern versions turn security on automatically for a newly installed node and generate certificates for you. The design goal shifted from “security is optional” to “security is the default, and you must work to turn it off.”

!
Do not expect miracles

TLS protects the roads, not the buildings. If an attacker steals a valid password, or an application asks for far more data than it should, TLS will faithfully deliver that data in a safely locked box. You still need users, roles, careful network design, and monitoring on top.

3The Building Blocks You Need to Know First

To follow the rest of this guide you need seven simple ideas: encryption, key, certificate, certificate authority, handshake, transport layer, and HTTP layer.

Encryption

Scrambling data with a secret

Encryption turns readable data into unreadable bytes. Only someone with the right key can turn it back. It is like writing in a code that only the receiver knows.

Key

The secret used to lock and unlock

A key is a long string of numbers. TLS uses a private key that never leaves its owner and a matching public key that can be shared freely.

Certificate

A digital badge

A certificate says “this public key belongs to this name” and carries a signature from someone who vouches for it. It also has dates for when it starts and stops being valid.

Certificate authority

The badge issuer

A certificate authority, or CA, is the trusted party whose signature makes a certificate believable. It can be a public company or a private one you run yourself.

Handshake

The opening ritual

Before any real data flows, the two sides agree on rules, check badges, and build a shared secret for the session. This introduction is called the handshake.

Transport layer

Node to node

In Elasticsearch, this is the channel used by nodes to talk to each other: joining, sharing cluster state, copying shards, and forwarding requests.

HTTP layer

Clients to cluster

This is the channel where applications, Kibana, and agents send searches and writes to Elasticsearch using the web protocol called HTTP.

Two kinds of keys, working together

TLS uses a clever trick called public-key cryptography. Each server has a pair of mathematically linked keys. Whatever the public key locks, only the private key can unlock, and whatever the private key signs, the public key can verify. The public key goes inside the certificate for everyone to see. The private key stays secret on the server. This pairing lets two strangers set up a shared secret over an open network without ever sending the secret itself.

After the handshake, TLS switches to a much faster kind of encryption that uses one shared secret key for both sides, called symmetric encryption. The heavy public-key math is used only at the start, and the fast symmetric lock protects the rest of the conversation.

What a certificate contains

A certificate is a small file of labeled facts. It contains the name of its owner, which for servers is a host name or an address. It contains the owner’s public key, the dates between which it is valid, and the name of the CA that signed it. It ends with the CA’s signature, which cannot be forged without the CA’s private key. When you check a certificate, you are checking that signature, the dates, and the name.

Everyday Analogy

A certificate is like a passport. It shows a photo, a name, a validity period, and a stamp from a government office. A border guard does not need to know you personally. The guard only needs to trust the government that issued the passport, check that the stamp is real, and verify that the passport has not expired. The CA is the passport office, and the guard is the computer checking the certificate.

A cluster in one picture

Look at how the pieces fit together. Clients reach the cluster through a load balancer or an API gateway, which spreads their requests over the nodes. The nodes then talk to each other over the transport layer. Both kinds of traffic can be protected by TLS, but they are configured separately.

flowchart LR
    A["Client application"] -->|HTTPS on port 9200| B["Load balancer or API gateway"]
    K["Kibana"] -->|HTTPS on port 9200| C
    B -->|HTTPS| C["Elasticsearch Node 1"]
    C |Transport TLS on port 9300| D["Elasticsearch Node 2"]
    C |Transport TLS on port 9300| E["Elasticsearch Node 3"]
    D |Transport TLS on port 9300| E
Figure 1: Clients use the HTTP layer, protected by HTTPS. Nodes talk to each other on the transport layer, protected by transport TLS.

Notice the two port numbers. By default, the HTTP layer listens on port 9200 and the transport layer listens on port 9300. A port is like a door number on a building: the same server can offer different services on different doors. Because the two layers have different jobs and different audiences, they get different doors and different security settings.

i
Good to know

HTTPS is simply HTTP carried inside a TLS session. When someone says “enable HTTPS on Elasticsearch,” they mean turning on TLS for the HTTP layer. When they say “enable transport TLS,” they mean the node-to-node layer.

4The Transport Layer and the HTTP Layer Compared

Elasticsearch has two separate communication channels, and each one needs its own TLS setup. Knowing which is which prevents most configuration mistakes.

The transport layer

The transport layer is the private channel of the cluster. Nodes use it to discover each other, agree on who the master node is, share the cluster state, forward search requests to shards on other nodes, replicate new documents to copies, and move whole shards during recovery and rebalancing. It uses a binary protocol built for speed, not the text-based web protocol. Only Elasticsearch nodes, and a few internal tools, are expected to speak on it.

Because this channel carries the raw data and the control messages of the cluster, protecting it is essential. It is also the channel that decides who may join. For that reason, transport TLS uses mutual authentication by default: each node must show a valid certificate to the other, and each node checks the other’s certificate. Both sides verify each other, like two guards inspecting each other’s badges.

The HTTP layer

The HTTP layer is the public-facing channel. Applications, Kibana, Beats, Logstash, and command-line tools use it to send requests, in the familiar form of web calls, and receive answers in a readable format called JSON. Here, the server proves its identity to the client with a certificate, just like a website does for a browser. The client usually proves who it is with a username and password or an API key, which is a long token issued for a program.

Side-by-side comparison

AspectTransport layerHTTP layer
Who talksElasticsearch nodes with each otherClients, Kibana, agents, and tools with the cluster
Default port range starts at93009200
Protocol styleBinary, internalWeb calls with JSON
Setting familyxpack.security.transport.ssl.*xpack.security.http.ssl.*
Client certificates by defaultRequired, so both sides show badgesNot requested, so only the server shows a badge
Who must trust the certificateEvery node must trust the CA that signed every node’s certificateEvery client must trust the CA that signed the server’s certificate
Name checksDepends on the chosen verification modeClients normally check that the name matches the address they used
Typical exposurePrivate, node-only networkWider, reachable by applications and sometimes users
Everyday Analogy

Think of a restaurant. The transport layer is the kitchen’s internal service hallway, where cooks and waiters pass plates and shout orders. Only staff with badges are allowed in. The HTTP layer is the front door and the dining room, where guests arrive and the restaurant shows its license on the wall. The kitchen hallway needs badge checks in both directions. The front door needs a clear, trustworthy sign that this is really the restaurant the guest meant to visit.

Why they are configured separately

The two layers have different audiences and different risks. The transport layer should be reachable only from other nodes, so you can use a private certificate authority and tightly restrict the network. The HTTP layer may need to work with many kinds of clients, some of which you do not control, so its certificate may need to satisfy a wider set of trust rules or even a public authority. Keeping the settings separate lets you use different certificates, different lifetimes, and different verification rules for each.

Other doors you may meet

Modern Elasticsearch has a few more communication surfaces. There is a dedicated interface for cross-cluster connections that uses its own TLS settings, which Chapter 14 explains. Kibana has its own web server, whose TLS settings protect the browser connection. Agents and shippers have their own client settings for reaching Elasticsearch. Each of these is a separate TLS conversation with its own certificates and trust decisions.

!
A classic mistake

Turning on HTTPS and forgetting the transport layer is a very common half-measure. The client traffic looks locked, but the node traffic, which carries the actual data and controls who joins, remains open. In current versions, transport TLS is required when a node runs in production mode with security enabled, but you should never rely on a check alone to tell you what you should have planned.

i
Firewall rule of thumb

Allow the transport port only between the nodes of the cluster. Allow the HTTP port only from the load balancer, Kibana, and the known client networks. TLS is strong, but a closed door in front of it adds one more layer of safety.

5The TLS Handshake, Step by Step

Before a single byte of real data moves, two computers perform a short ritual to agree on rules, check identities, and build a shared secret.

The handshake is the most important moment in any TLS conversation. It takes a few round trips over the network, usually just milliseconds, and it happens every time a new connection is opened. Understanding it makes almost every TLS error message readable.

1

The client says hello

It lists the TLS versions and the encryption recipes, called cipher suites, that it can use. It also sends some random data that will help build the secret.

2

The server answers and shows its badge

It picks a version and a recipe from the client’s list and sends its certificate, which contains its public key and a signature from a CA.

3

The client checks the certificate

It checks that the signature comes from a CA it trusts, that today’s date is inside the validity period, and, depending on the settings, that the name in the certificate matches the address it connected to.

4

The server may ask for a badge too

In mutual TLS, the server requests the client’s certificate and runs the same checks. Elasticsearch does this on the transport layer by default.

5

Both sides build a shared secret

Using the public keys and the random data, they compute the same secret key without ever sending it. Anyone listening sees only pieces that are useless on their own.

6

They confirm and start talking privately

Each side proves that it built the same secret. From now on, all data is encrypted with the fast shared key and protected against tampering.

sequenceDiagram
    participant C as Client or joining node
    participant S as Server node
    C->>S: Hello with supported versions and cipher suites
    S->>C: Hello with chosen version and the server certificate
    C->>C: Check signature, dates, and name
    S->>C: Request for the client certificate on the transport layer
    C->>S: Client certificate
    S->>S: Check signature and dates of the client certificate
    C->>S: Key exchange to build the shared secret
    S->>C: Handshake finished
    C->>S: Encrypted application data
    S->>C: Encrypted application data
Figure 2: A simplified handshake with mutual authentication, as used between Elasticsearch nodes. Real handshakes vary slightly between TLS versions.
Everyday Analogy

Picture two spies meeting in a crowded cafe. They first agree on a language both speak, then show their identity cards to each other, and finally, using a trick with two half-secrets, they arrive at a private code phrase that nobody at the neighboring tables can guess, even though they heard every word of the introduction. After that, they whisper using only the code phrase. The handshake is the introduction, and the code phrase is the session key.

Why the handshake matters for performance

The handshake costs a few network round trips and some computing work. It happens once per connection, not once per message. Elasticsearch nodes keep their transport connections open for a long time and reuse them, so the cost is paid rarely. HTTP clients should do the same by keeping connections alive and reusing them, instead of opening a new connection for each request. Chapter 15 returns to this point.

Newer versions are faster

TLS 1.3, the newest widely used version, shortens the handshake compared with TLS 1.2 and removes some old, weak options. Modern Elasticsearch supports both by default, and prefers the newer one whenever both sides can use it.

i
Reading errors

Almost every TLS error tells you at which step the handshake failed. A message about an unknown authority points to step three, a message about no shared cipher or protocol points to step one or two, and a message about a missing client certificate points to step four. Keep the six steps in mind when you troubleshoot.

6Certificates, Authorities, and the Chain of Trust

Encryption alone is not enough. You must also be sure that you are talking to the right party. Certificates and authorities provide that assurance.

Suppose a stranger hands you a locked box and says, “I am your bank.” Locking the box does not prove the claim. You need a way to check the identity. Certificates solve this with a chain of trust: you trust an authority, the authority vouches for a certificate, and therefore you trust the certificate.

Certificate authorities

A certificate authority is an organization or a tool that signs certificates. Public authorities are trusted by web browsers and operating systems out of the box, which is why you can visit millions of websites without any setup. For a private Elasticsearch cluster, most teams use a private authority instead: a CA that they create themselves and that only their own machines are told to trust. This is simpler, cheaper, and safer for internal traffic, because nobody outside the company can obtain a certificate that your nodes accept.

Trust stores and key stores

Two kinds of storage matter. A keystore holds a machine’s own certificate together with its private key, like a person’s wallet with their own passport and their own signature stamp. A truststore holds the certificates of the authorities that the machine is willing to believe, like a list of governments whose passports are accepted at the border. Elasticsearch settings ask for both, or for a set of separate files in a common text format called PEM.

flowchart TD
    A["Private CA certificate: trusted by every node and client"] --> B["Node 1 certificate"]
    A --> C["Node 2 certificate"]
    A --> D["Node 3 certificate"]
    A --> E["HTTP layer certificate"]
    B --> F["Private key stays on Node 1 only"]
    C --> G["Private key stays on Node 2 only"]
Figure 3: One authority signs many certificates. Every party that trusts the authority accepts all of them, while each private key stays with its owner.
Everyday Analogy

A company issues employee badges from its security office. Doors around the building are set to open for any badge stamped by that office. A stranger cannot create a badge that works, because they lack the stamp. Adding a new employee means the office stamps a new badge, and no door needs to be changed. The security office is the CA, the badges are node certificates, and the door rule is the truststore.

Names inside certificates

A certificate lists the names or addresses that it is valid for, in a field called Subject Alternative Name, or SAN. When a client connects to search.example.com, it expects to find that name, or a matching wildcard, in the certificate. If the client connects using an address like 10.0.4.17, the certificate needs that address in its list. A mismatch produces an error even when the CA is trusted, because the client cannot be sure that it reached the intended server and not an impostor holding a valid certificate for a different name.

Validity periods

Every certificate has a start date and an end date. After the end date, it is no longer accepted. Shorter lifetimes limit the damage of a stolen key, but they require regular renewal. The Elasticsearch certificate tool creates certificates that last about three years by default, and you can choose a different length. Chapter 13 explains how to renew without downtime.

Intermediate authorities

Large organizations often use a small chain: a very protected root authority that rarely comes online, which signs an intermediate authority that does the daily signing. The chain of trust then has three or more links, and the client must have or receive the whole chain. It is just a longer path of vouching, and the same principles apply.

!
Guard the CA private key

Whoever holds the CA’s private key can create a badge that every node will accept. Keep it offline or in a locked, audited place. Do not leave it on the Elasticsearch nodes, and do not copy it around for convenience.

7What TLS Protects and What It Does Not

A security feature is only useful when you know its limits. Here is an honest map of where TLS helps and where you need other tools.

ConcernDoes TLS help?What else you need
Someone reading traffic on the networkYes, it scrambles the messagesNothing more for this threat, if versions and ciphers are strong
Someone altering messages on the wayYes, tampering is detectedNothing more for this threat
A fake server pretending to be your clusterYes, when clients verify certificates and namesClients must actually verify, not skip checks
A stranger node trying to join the clusterYes, on the transport layer with mutual authenticationA well-guarded CA and network rules
A stolen user passwordNoStrong passwords, API keys with limited scope, multi-factor sign-in at the edge
A user reading data they should not seeNoRoles and privileges, document level and field level security
Someone stealing a disk or a backupNoDisk or volume encryption, protected snapshot storage
Someone breaking into a running nodeNoPatching, hardening, access control, monitoring
Knowing who did whatNoAudit logging
Everyday Analogy

An armored truck protects money while it is on the road. It does not protect the money in the bank vault, it does not check whether the person who ordered the delivery is allowed to withdraw that amount, and it does not stop a dishonest bank employee. TLS is the armored truck. You still need a vault, a rulebook, and a camera system.

Encryption at rest is a separate job

Elasticsearch stores its data in files on disk. TLS does not touch those files. To protect them, teams use disk or volume encryption provided by the operating system or the cloud platform, and they protect snapshot storage with the storage service’s own encryption features. Together with TLS, this covers data both in motion and at rest.

Authentication and authorization sit on top

After TLS has built the safe channel, Elasticsearch still asks who is calling and what they are allowed to do. Authentication proves identity, by password, API key, token, or client certificate. Authorization decides which actions and data that identity may use, through roles. TLS carries these credentials safely, which matters a lot: sending a password over an unencrypted channel is like shouting it across a room.

Client certificates as a second badge

The HTTP layer can also ask clients for certificates, making the connection mutual, as the transport layer does. This is useful for machine-to-machine traffic, where a certificate can act as a strong identity. It is off by default on the HTTP layer, because many clients such as browsers and simple scripts do not have certificates.

Beware of false comfort

A common trap is to believe that a padlock means the whole system is safe. It means only that the channel is private and that the server proved its identity. An application that logs secrets, exposes data to the wrong users, or uses weak passwords is still insecure. Use TLS as a strong foundation, not as the whole house.

i
Good to know

Elasticsearch has no built-in switch that encrypts index files on its own. Most teams rely on disk encryption below Elasticsearch. Managed services often provide it as a platform feature.

8How Nodes Use TLS to Trust Each Other

When a node starts and tries to join a cluster, TLS is the first gate it must pass. The rules of that gate are set by a few important settings.

A node learns about other nodes from a list of seed hosts, which are addresses that it tries first. It opens a connection to the transport port of a seed host, and the TLS handshake begins. Both sides show certificates and check each other. Only if both checks succeed does the real conversation start, in which the joining node announces itself and the cluster decides to accept it.

flowchart TD
    A["New node starts and contacts a seed host"] --> B["TLS handshake on the transport port"]
    B --> C{"Does each side trust the other certificate?"}
    C -->|Yes| D["Nodes exchange cluster join messages"]
    C -->|No| E["Connection is closed and the join fails"]
    D --> F["Shards may be copied to the new node"]
Figure 4: TLS is the first gate for a joining node. A node that fails the certificate check never reaches the stage where it could receive data.

Client authentication on the transport layer

The setting xpack.security.transport.ssl.client_authentication controls whether the receiving node demands a certificate from the connecting node. On the transport layer, its default is required. That default is what makes rogue nodes hard to add. It is best left as it is.

Verification modes

The setting xpack.security.transport.ssl.verification_mode decides how strictly a certificate is checked. There are three choices, and the difference is about names.

ModeWhat is checkedWhen to use it
fullThe chain of trust, the dates, and that the name or address in the certificate matches the peerBest choice when each node has its own certificate listing its own names and addresses
certificateThe chain of trust and the dates, but not the namesCommon when nodes share a certificate or when addresses change often; still safe if the CA is guarded
noneNothingNever in production. It removes the protection against impostors.
Everyday Analogy

A guard at a staff door can be strict at three levels. At the strictest level, the guard checks that the badge is real, still valid, and that the name on it matches the person’s face, which is the full mode. At the middle level, the guard checks that the badge is real and valid but does not compare names, which is the certificate mode. At the loosest level, the guard waves everyone through, which is the none mode and defeats the purpose of having a guard.

Choosing between full and certificate

Full verification is more secure, because a stolen certificate for one node cannot be used from another machine. It requires each node to have its own certificate with the right names, which means more certificates to create and renew. The certificate mode is easier to run, especially in environments where addresses are dynamic, such as containers. Many clusters run happily in certificate mode with a private authority that is well protected. If your team can automate certificate issuance, choose full.

What is exchanged over the transport channel

Once the connection is protected, everything the cluster needs goes through it: cluster state updates, replication of each new document to its copies, search requests fanning out to shards, results coming back, and whole shards moving during recovery. On a busy cluster this is a large volume of data, so the efficiency of the encryption matters, which Chapter 15 covers.

i
Keep transport trust narrow

Use a dedicated authority for the transport layer, separate from the one used for browsers or public websites. Then only certificates you issued for the cluster are accepted by the nodes, and no unrelated certificate can ever be used to join.

9Security by Default and Automatic Setup

Modern Elasticsearch makes a first-time installation safe without any manual certificate work. It is worth knowing what happens behind the scenes.

Starting with version 8, when you start a brand-new node for the first time with no special security settings, Elasticsearch turns security on and configures TLS by itself. It creates a private authority and certificates for both the transport layer and the HTTP layer. It prints a password for the built-in elastic user and a token that lets Kibana or another node enroll. It saves the generated files inside a certificates folder in the configuration directory, including the authority certificate that clients need in order to trust the HTTP layer.

flowchart TD
    A["Start the first node for the first time"] --> B["Elasticsearch creates a CA and certificates"]
    B --> C["Console shows a password and an enrollment token"]
    C --> D["Kibana enrolls using the token"]
    C --> E["Another node joins using a new enrollment token"]
    E --> F["The new node receives what it needs and joins the cluster"]
Figure 5: Automatic configuration on first start gives a working, encrypted cluster without manual certificate work.

Enrollment tokens

An enrollment token is a short-lived code that carries just enough information for a new component to find the cluster and trust it. When you connect Kibana, you paste the token, and Kibana learns the address and the authority certificate and sets itself up. When you add another node, you give it a token, and the new node is configured to join over a protected connection. Tokens expire after a short time, so an old token lying around in a chat message is not a lasting risk. You can create a fresh token whenever you need one using the tool that comes with Elasticsearch.

Everyday Analogy

Think of a hotel front desk that hands a guest a key card and a printed welcome sheet at check-in. The card opens only the guest’s room and expires at check-out, and the sheet explains how to reach the breakfast room. An enrollment token is the welcome sheet with a time limit: it gives a new component just what it needs to get started and stops working soon after.

When automatic setup applies

Automatic configuration is designed for the first start of a fresh node. It does not run when the node already has data, or when you have already written security settings by hand. That is intentional, so that it never overrides your choices or damages an existing cluster.

Is the automatic setup enough for production?

For learning, testing, and small setups, it is a great start. For serious production clusters, most teams take control of certificates so that they can follow company rules: their own authority, longer or shorter lifetimes, names that match their DNS, automated renewal, and central storage of secrets. The automatic setup also generates certificates that are tied to that first installation, so treat them as a starting point that you can replace, not as a permanent design.

Development mode and production mode

Elasticsearch behaves differently depending on how it is bound to the network. A node that listens only on the local machine is considered to be in development mode and is lenient. A node that listens on a real network address is in production mode, and it runs strict startup checks called bootstrap checks. One of these checks refuses to start a node in production mode with security enabled if transport TLS is not on. This safety net exists to stop people from accidentally exposing an unprotected cluster.

!
Do not turn security off to make an error go away

When a certificate error blocks progress, some people set the security switch to off. That removes authentication, authorization, and TLS at once. The right fix is almost always a certificate, a name, or a trust setting, and Chapter 21 walks through the common ones.

10Configuring TLS in Your Own Cluster

Setting up TLS by hand follows a clear order: plan the names, create the authority, issue certificates, place the files, set the options, and verify.

Enable

Turn on each layer

The settings xpack.security.transport.ssl.enabled and xpack.security.http.ssl.enabled switch TLS on for the two layers independently.

Identity

Point to key material

Use keystore settings for PKCS#12 files, or use separate certificate and key settings for PEM files. This tells each node which certificate and private key to present.

Trust

Point to the authority

Use a truststore setting, or the certificate authorities setting for PEM, so that the node knows which authorities it accepts.

Strictness

Choose verification

Set the verification mode to full or certificate for the transport layer. Keep client authentication required on that layer.

The usual order of work

1

Plan names and addresses

List every node, its host name, and its address. Decide which names clients will use to reach the HTTP layer, including load balancer names.

2

Create the authority

Use the certificate tool that ships with Elasticsearch, or your company’s own authority. Store the authority private key safely, away from the nodes.

3

Issue node certificates

Create a certificate for each node, or one for all nodes, with the right names and addresses inside. Choose a sensible validity period.

4

Place the files

Copy each node’s key material into its configuration folder. Restrict file permissions so that only the Elasticsearch service account can read them.

5

Store passwords safely

If files are protected by passwords, put those passwords in the Elasticsearch secure keystore, not in the plain configuration file.

6

Set the options

Edit the configuration on every node for the transport layer and then the HTTP layer, following the setting families above.

7

Restart and verify

Restart the nodes in a safe order, check that they form a cluster, and test the HTTP layer from a client that trusts your authority.

8

Update the clients

Give Kibana, Beats, Logstash, and applications the authority certificate so that they trust the cluster, and switch their addresses to HTTPS.

File formats

Elasticsearch accepts key material in a few formats. PKCS#12 files, with a .p12 ending, bundle a certificate and its key in one password-protected file and are the default output of the certificate tool. PEM files are plain text, with separate files for certificates and keys, and are popular with tools from other ecosystems. Older JKS files from the Java world are also accepted. Choose one format for your organization and stay consistent, because mixing formats causes confusion during renewals.

The certificate tool

Elasticsearch includes a command-line helper named elasticsearch-certutil. It can create an authority, issue node certificates, produce certificate signing requests to send to a company authority, and run a guided flow for the HTTP layer. It is convenient and correct, but it is only a helper. If your organization already runs an authority with its own rules and audit trail, use that and give Elasticsearch the results.

Secure settings and passwords

Elasticsearch has its own encrypted store for secrets called the keystore (not to be confused with the certificate keystore). Passwords for TLS files belong there, under names such as the keystore secure password and the key passphrase settings. This keeps them out of configuration files that are copied into tickets, backups, and version control.

Everyday Analogy

Setting up TLS is like setting up staff badges for a new office. First decide who works there and which doors exist. Then choose who prints the badges and lock away the printing machine. Give each person a badge, tell each door which printing office to trust, and test the doors before opening day. Finally, tell visitors how to recognize the real front desk.

!
Enabling TLS on a running cluster

Nodes that use transport TLS cannot talk to nodes that do not. Turning it on for an existing plain-text cluster therefore usually means stopping and restarting the whole cluster together, not one node at a time. Plan a maintenance window, take a snapshot first, and rehearse in a test environment. Confirm the exact procedure in the documentation for your version.

11The HTTP Layer: Clients, Kibana, and Load Balancers

The HTTP layer is where most people first meet TLS. Every program that talks to the cluster must trust the certificate that the cluster presents.

When TLS is enabled on the HTTP layer, plain web addresses that begin with http stop working, and clients must use https instead. Sending a plain request to a TLS port produces an error, because the server expects the start of a handshake and receives ordinary text. This is the most common first symptom people see after enabling HTTPS.

What every client needs

A client needs three things. First, the right address, using a name that appears in the server certificate. Second, the certificate of the authority that signed the server certificate, so that it can verify the badge. Third, its own credentials, such as a username and password or an API key. Kibana, Beats, Logstash, Elastic Agent, and the official language clients all have settings for the authority certificate.

The authority fingerprint shortcut

Some official clients and agents accept the fingerprint of the authority certificate instead of the whole file. A fingerprint is a short code computed from the certificate, like the serial number of a stamp. The client connects, receives the certificate chain, and checks that the authority’s fingerprint matches the one you provided. This makes first-time setup easier, and the automatic configuration prints the fingerprint for you. For long-term use, storing the actual authority certificate is a bit more transparent.

!
Never skip verification

Most clients offer an option to ignore certificate errors. It makes the error vanish, and it also makes the connection open to impostors. Use it only for a throwaway experiment on your own laptop, and never in a script that will be copied to a server.

Kibana has two TLS conversations

Kibana talks to Elasticsearch as a client, so it needs the authority certificate for the HTTP layer. Kibana also serves web pages to people’s browsers, and that connection has its own TLS settings on the Kibana side. Many teams put a load balancer or reverse proxy in front of Kibana to handle the browser side. Remember that these are two separate conversations with two sets of certificates.

Load balancers and API gateways

In most production designs, clients do not reach the nodes directly. They go through a load balancer, which spreads the traffic over the nodes, or an API gateway, which also applies rules like rate limits and authentication. That middle device has to deal with TLS, and there are two main designs.

DesignHow it worksStrengthsWatch out for
Pass-throughThe load balancer forwards the encrypted bytes without opening them, so the TLS session runs from the client all the way to the nodeEnd-to-end encryption; the node’s certificate is what the client seesThe balancer cannot read requests, so it cannot route by path or apply web rules
Terminate and re-encryptThe balancer ends the client’s TLS session, reads the request, and opens a second TLS session to the nodeCan inspect, route, and log requests; can present a public certificate to clientsTwo sets of certificates to manage; the balancer must trust the cluster authority
Terminate and forward plainThe balancer ends TLS and sends plain traffic to the nodeSimpleTraffic is exposed inside your network; usually not acceptable for sensitive data
flowchart LR
    A["Client"] -->|TLS session 1| B["Load balancer or API gateway"]
    B -->|TLS session 2| C["Elasticsearch node"]
    C |Transport TLS| D["Other nodes"]
Figure 6: In the terminate and re-encrypt design, there are two separate TLS sessions. Each has its own certificate and trust settings.
Everyday Analogy

Imagine a receptionist in a large office building. In the pass-through design, the receptionist points visitors to a sealed corridor that leads straight to the department, and cannot see what visitors carry. In the terminate and re-encrypt design, the receptionist opens each visitor’s package, checks it, and puts it into a new sealed bag for the trip to the department. Both are safe when the receptionist is trustworthy, but the second gives the receptionist more power, and more responsibility.

Names must match what clients type

If clients connect to search.example.com, the certificate they see, whether from the balancer or from the node, must list that name. A cluster with a balancer often needs two sets of names: the public name on the balancer’s certificate, and the node names on the node certificates that the balancer verifies.

Public or private authority for the HTTP layer?

If your clients are all inside your company, a private authority is enough, provided that every client is given its certificate. If external partners or browsers must connect, a certificate from a public authority on the balancer avoids handing your private authority to outsiders. Many teams use a public certificate at the edge and a private one inside.

i
Tip

Test the HTTP layer from a machine that is set up like a real client, not from the node itself. Passing a test from the node can hide missing authority certificates or name mismatches that real clients will hit.

12Protocol Versions and Cipher Suites

TLS is not one fixed recipe. There are versions and menus of encryption methods, and old ones have been broken over the years.

Two settings shape what the connection may use. The protocol version is the edition of the TLS rulebook, such as TLS 1.2 or TLS 1.3. The cipher suite is the specific combination of methods used for key agreement, encryption, and integrity checking. During the handshake, the client offers what it supports and the server picks the best match.

Older versions are unsafe

Early versions such as SSL 3.0, TLS 1.0, and TLS 1.1 have known weaknesses and are switched off in modern Elasticsearch. Recent versions of Elasticsearch allow TLS 1.2 and, when the Java runtime supports it, TLS 1.3 by default. The supported_protocols setting under each layer lets you narrow this list, for example to allow only TLS 1.3 in an environment where every client is modern.

Cipher suites in plain words

A cipher suite name is a long string, but it is built from a few parts. One part says how the two sides agree on a secret, another says which fast lock protects the data, and another says how tampering is detected. Good suites use forward secrecy, which means that even if someone steals a server’s private key next year, they still cannot unlock traffic that they recorded last year, because each session used a fresh temporary secret.

Everyday Analogy

Consider a locksmith’s catalog. Old catalog pages show locks that burglars learned to pick years ago. New pages show modern locks. The handshake is a customer and a locksmith agreeing on a page they both know. If the customer only knows the old pages, a careful locksmith refuses the sale, because selling a lock that anyone can pick would be worse than selling none.

The default is usually right

Elasticsearch relies on the Java runtime for its default list of strong cipher suites. For most clusters, the best approach is to leave the cipher list alone and keep the runtime updated. Restrict it only when a security policy demands it, and test before rollout. A cipher list that is too narrow can lock out legitimate clients, which shows up as handshake failures with a message about no shared cipher.

Compliance and special modes

Some organizations must follow standards that limit which algorithms are allowed. Elasticsearch supports a special mode that follows one such standard, called FIPS 140-2, in which only certain key formats and algorithms are permitted. Enabling it changes what file formats and settings you can use, so it needs to be planned from the start. If you work in such an environment, read the documentation for your version carefully before designing the certificates.

Balance security with compatibility

Stricter is not always better if you have older clients that cannot follow. The best approach is to know your clients. List every application, agent, and tool that connects, find their TLS versions, and upgrade the old ones before you tighten the settings. Then choose the strictest configuration that all of them can meet.

i
A safe habit

Whenever you change protocol or cipher settings, test with a client from each family you support before rolling to production. A five-minute test avoids a long outage caused by an old script that nobody remembered.

13Certificate Lifecycle: Renewal, Rotation, and Expiry

Certificates do not last forever. A cluster that runs well for years needs a calm, practiced routine for renewing them before they expire.

The number one cause of TLS outages in real life is not an attack. It is an expired certificate. On the day it runs out, connections that once worked start to fail, and if the cause is not obvious, the team scrambles. A steady lifecycle habit removes this whole class of incident.

The life of a certificate

1

Issue

The authority signs a certificate with a start date, an end date, and the list of names. Record the end date somewhere visible.

2

Use

Nodes and clients present it during handshakes. Nothing needs attention while it is healthy.

3

Warn

Alerts fire well before the end date, for example at sixty, thirty, and fourteen days, so that renewal is never a rush.

4

Renew

A new certificate is issued and placed on the node. Elasticsearch watches its TLS files and picks up changes without a restart within a short time.

5

Retire

The old certificate is removed, and, if a key was ever exposed, it is revoked according to your organization’s process.

Renewing node certificates

If the authority stays the same, renewing a node certificate is simple: issue a new one, replace the file, and let Elasticsearch reload it. Because the nodes trust the authority and not one particular certificate, the new certificate is accepted at once. Do this for one node at a time, and check the health of the cluster between steps.

Rotating the authority itself

Replacing the authority is harder, because every node and every client trusts the old one. The trick is a period of overlapping trust. First, add the new authority certificate to every truststore, alongside the old one, so that everyone accepts both. Then issue new node certificates from the new authority and roll them out node by node. Finally, once every node uses the new certificates, remove the old authority from the truststores.

flowchart LR
    A["Stage 1: add the new CA to every truststore"] --> B["Stage 2: issue node certificates from the new CA"]
    B --> C["Stage 3: roll out the new certificates node by node"]
    C --> D["Stage 4: remove the old CA from every truststore"]
Figure 7: Overlapping trust lets you change the authority with no downtime, because at every stage each pair of nodes still trusts each other.
Everyday Analogy

A company changes the design of its staff badges. On the first day, the doors are updated to accept both the old and the new design. Then everybody receives a new badge over several weeks. Only when every person has the new badge does the company tell the doors to stop accepting the old one. Nobody is locked out at any point.

Seeing what is about to expire

Elasticsearch has an operation that lists the certificates it is using, with their subjects, paths, and expiry dates. It is a quick way to check every node and to feed a monitoring job. Combine it with an alert so that expiry becomes an item on a calendar, not a surprise.

What happens at expiry

Expiry is checked when a connection is set up. Connections that are already open may continue for a while, which can hide the problem until a node restarts or a connection is dropped. Then the handshake fails, nodes cannot rejoin, and clients see errors. This delayed effect makes it wise to check dates proactively instead of waiting for symptoms.

Automating the routine

The most reliable renewal is one that no human has to remember. Many teams automate issuance and delivery with secret management tools and configuration management, and they set certificate lifetimes short enough to force the automation to work. Where automation is not possible, a calendar reminder with a written procedure is better than nothing.

!
Keystore passwords and reloads

If a renewed file is protected by a new password, the new password must also be updated in the secure keystore and reloaded. A file that changes without its matching password change is a classic cause of a failed reload. Change both together and check the logs.

14Other Places TLS Appears

Beyond the two main layers, several other parts of the Elastic ecosystem use TLS. Each is its own conversation with its own certificates.

Cross-cluster

Linking two clusters

Clusters can search or replicate across each other. Older designs rely on trust between the transport layers of both clusters. Newer designs use a dedicated remote cluster interface with its own TLS settings and API keys, which limits what the remote side can do.

Kibana

Browser connection

Kibana has separate settings to serve pages over HTTPS to users. This is independent of how Kibana reaches Elasticsearch.

Agents

Beats, Logstash, and Elastic Agent

Shippers act as clients when they send data to Elasticsearch, so they need the authority certificate. Some can also present client certificates.

Snapshots

Backup storage

Snapshots are sent to remote storage over connections that are normally protected with HTTPS by the storage service. Confirm that your repository client uses secure connections.

Identity

Single sign-on and directories

Connections to identity systems, such as directory servers, should use TLS too, or user credentials travel in the clear.

Monitoring

Metric collection

Tools that scrape or receive cluster metrics should reach the HTTP layer over HTTPS and verify certificates like any other client.

Cross-cluster in more detail

When two clusters cooperate, each becomes a client of the other, and each must decide whom to trust. In the older certificate-based model, the two clusters trust each other’s authorities on the transport layer, which gives the remote cluster wide power. In the newer model, the remote cluster exposes a separate, narrow interface protected by TLS and by API keys that list exactly which indices can be reached. This reduces the risk if a remote cluster is compromised. Check the documentation for the versions you run before choosing a model.

Everyday Analogy

Two companies decide to share a meeting room. In the old approach, employees of each company get badges that open every door in the other’s building. In the new approach, visitors receive a visitor pass that opens only the meeting room and the front lobby. The second way is safer if a badge is ever lost.

Do not forget the smaller connections

A common blind spot is the set of small, quiet connections around the cluster: a script that posts alerts, a scheduled job that pulls reports, an old dashboard tool. If they use plain HTTP against a cluster that has just turned on HTTPS, they simply stop working. Before changing any layer, list every client and plan its update.

i
Inventory first

Make a list of every system that talks to the cluster: name, owner, address used, credentials, and library version. That list is the best tool for a smooth TLS rollout.

15Performance and Scalability

Encryption costs some work, but on modern hardware the cost is usually small. The habits that keep it small are simple.

Where the cost comes from

TLS adds work in two places. The handshake uses heavy public-key math and some network round trips, and it happens once per connection. After that, encrypting and decrypting each message with the shared key is much cheaper, and most modern processors have special instructions that make it faster. The result is that a healthy, well-configured cluster usually sees only a modest increase in CPU use. The exact number depends on your hardware, traffic, and message sizes, so measure it in your own environment.

Reuse connections

Nodes keep transport connections open, so the handshake is rare inside the cluster. On the HTTP layer, the biggest saver is to reuse connections. A client that opens a fresh connection for every request pays the handshake each time, which can multiply latency. Use client libraries with connection pooling and keep-alive enabled, and create one long-lived client object instead of a new one per request.

Everyday Analogy

Think of a phone call. Dialing, waiting for the answer, and saying hello take some seconds, but once the call is on, talking is quick. Hanging up after each sentence and dialing again would make any conversation painfully slow. Keeping the connection open is like staying on the line.

Session resumption

TLS can also remember a recent session so that a returning client can skip parts of the handshake. This helps clients that reconnect often. It is handled by the TLS libraries and needs little configuration from you.

Big data movements

Recovery and rebalancing move whole shards across the transport layer, which can be many gigabytes. Encryption adds CPU load on both ends during such moves. On clusters with many nodes and large shards, watch CPU during recovery, and plan bulk movements outside peak search hours.

Load balancers and scale

If a load balancer terminates TLS for thousands of clients, it needs enough capacity to handle the handshakes. Balancers built for this usually have dedicated hardware support, but capacity still needs planning. In the pass-through design, the nodes take on the handshake work instead, so make sure they have headroom.

Scaling the number of nodes

Every node pair may hold a connection, so the number of connections grows with the cluster size. Each connection is set up once, and certificates are validated at setup. Larger clusters make certificate expiry checks and certificate distribution more important, because there are simply more files to manage. Automation pays for itself here.

Measure, do not guess

To learn the real cost, run a load test with TLS off and on in a test environment and compare CPU, latency, and throughput. The measured difference tells you whether you need to change anything at all. For most clusters, the answer is no, and the security gain far exceeds the cost.

i
Do not remove TLS to win speed

If performance is a problem, the cause is almost never TLS alone. Look at queries, shard layout, and hardware first. Turning off encryption saves little and adds serious risk.

16Advantages, Disadvantages, and Trade-offs

No security feature is free. Here is an honest scorecard so you can decide how to use TLS and where to invest effort.

Advantages

  • Protects data in motion from eavesdropping and tampering.
  • Stops rogue nodes from joining, thanks to mutual authentication on the transport layer.
  • Lets clients confirm that they reached the real cluster.
  • Protects credentials such as passwords and API keys while they travel.
  • Helps meet legal and industry rules about encryption in transit.
  • Built in, standard, and well understood, with strong tooling.
  • Enabled by default on new installations in modern versions.
  • Certificates reload without a restart, which makes renewal smooth.

Disadvantages

  • Adds certificates to manage, renew, and monitor for the life of the cluster.
  • Expired or mismatched certificates cause outages that can be confusing.
  • Uses some extra CPU and network round trips.
  • Makes network debugging harder, because traffic cannot be read directly.
  • Requires every client to be updated to trust the authority.
  • Enabling it on an existing plain cluster typically needs downtime.
  • Does not protect data at rest or decide who may see which data.
  • Needs care with private key storage and file permissions.

The central trade-off: convenience against protection

The easiest cluster to run is one with no encryption, no certificates, and no client settings. It is also the easiest to attack. Every step toward stronger TLS, such as full verification and short lifetimes, adds work for the team. The best balance is to make the secure path the automated path, so that strong settings are also the low-effort ones.

The second trade-off: strict names against flexibility

Full verification catches misuse of stolen certificates but demands correct names everywhere, which is difficult in dynamic environments where addresses change. Certificate mode is more flexible and still strong when the authority is well guarded. Choose according to how well your team can automate certificate issuance.

The third trade-off: one authority against many

One shared authority for everything is easy to manage but has a wide blast radius if its key leaks. Separate authorities for the transport layer, the HTTP layer, and each environment are more work but limit damage. Larger organizations usually lean toward separation.

When TLS alone is the wrong answer

If your worry is who can read which data, use roles and privileges. If your worry is stolen disks, use disk encryption. If your worry is knowing who did what, use audit logs. If your worry is a malicious insider with valid credentials, use least privilege, monitoring, and reviews. TLS is the base layer, and each of these builds on it.

17Design Patterns for Healthy TLS

A secure and calm TLS setup does not happen by accident. These six habits make it strong and easy to run.

Pattern 1

Dedicated private authority

Run one private authority for the cluster’s transport layer, kept offline or in a guarded system, and issue certificates only for cluster purposes.

Pattern 2

Certificate per node

Give each node its own certificate with its own names and addresses, and use full verification. A leaked certificate then only works for one identity.

Pattern 3

Two-tier HTTP design

Present a public-authority certificate at the edge for outside users, and use private certificates inside for the hop from the balancer to the nodes.

Pattern 4

Automated lifecycle

Automate issuing, delivery, and reloading of certificates, with alerts far ahead of expiry, so that renewal is a routine event.

Pattern 5

Overlapping trust for rotations

Whenever the authority changes, add the new one to truststores first, roll out new certificates, and remove the old authority last.

Pattern 6

Network segmentation

Allow the transport port only between nodes and the HTTP port only from known sources. TLS and firewalls protect each other.

Pattern 2 in action

A team creates a certificate for each of nine nodes with the node’s host name and address listed. They set the transport verification mode to full. One day a laptop of a former administrator turns out to contain a copy of the certificate and key of node four. Because the certificate lists only node four’s names, and the cluster checks names, an attacker cannot use it from another address without also spoofing the network. The team revokes and replaces the certificate for node four alone, without touching the other eight.

Pattern 4 in action

A platform team uses a secret management system that issues node certificates valid for 90 days. A small job renews each certificate at day 60 and places the new files on the node. Elasticsearch reloads the files automatically. A dashboard shows the days left for every certificate in the cluster, and an alert triggers if any falls below 30. Over two years, the team has not had a single certificate incident.

A pattern for documentation

Write a short runbook that answers five questions: where the authority key lives, how to issue a certificate, how to place and reload it, how to check expiry, and who to call. The best time to test the runbook is on a quiet afternoon, not during an outage.

i
Practice the failure

In a test cluster, let a certificate expire on purpose and fix it using your runbook. Teams that rehearse this once handle the real event calmly.

18Anti-Patterns and Common Mistakes

These are the traps that quietly weaken TLS or cause avoidable outages. Each one is common in real projects and easy to avoid once you know it.

ANTI-PATTERN 01Avoid
What people do

They set the verification mode to none, or tell clients to ignore certificate errors, to make a connection problem disappear.

Why it hurts

The channel is still encrypted, but nobody checks who is on the other end. An impostor can sit in the middle and read everything, and a rogue node can join.

Better approach

Find the real cause, which is usually a missing authority certificate, a wrong name, or an expired date, and fix that.

ANTI-PATTERN 02Avoid
What people do

They enable HTTPS for clients and leave the transport layer without protection, or the other way around.

Why it hurts

Half a lock is not a lock. Unprotected node traffic exposes data and cluster control messages. Unprotected client traffic exposes passwords and search results.

Better approach

Secure both layers together, each with its own settings and certificates.

ANTI-PATTERN 03Avoid
What people do

They leave the authority private key on the Elasticsearch nodes or share it in a team folder for convenience.

Why it hurts

Anyone who reaches the key can create certificates that every node accepts. A single compromised node then becomes a way to forge identities across the whole cluster.

Better approach

Keep the authority key offline or in a locked, audited system, and distribute only certificates and node keys.

ANTI-PATTERN 04Avoid
What people do

They ignore certificate expiry dates until something breaks.

Why it hurts

Expiry always arrives on a fixed date, and the failure often shows up at a restart or a reconnect, when people are least prepared. The outage is completely avoidable.

Better approach

Track expiry dates, alert early, and automate renewal.

ANTI-PATTERN 05Avoid
What people do

They turn off the security switch in production because it was a barrier during setup.

Why it hurts

This removes passwords, roles, and encryption all together. An open cluster on a network is often found and abused quickly, and data theft or deletion can follow.

Better approach

Keep security on and solve the specific configuration problem. Use a test environment for experiments.

ANTI-PATTERN 06Avoid
What people do

They copy the automatically generated development certificates from a test machine into production, and reuse the same files everywhere.

Why it hurts

Those certificates were made for a quick start and may be tied to one installation and its names. Sharing them widely spreads a single secret across many places and makes rotation painful.

Better approach

Create a proper authority and certificates for each environment, with names that match your real hosts.

Other frequent mistakes

  • Putting keystore passwords in the plain configuration file instead of the secure keystore.
  • Leaving key files readable by every user on the machine.
  • Forgetting to add the load balancer name or a service address to the certificate names.
  • Updating certificates on some nodes and not on others, leaving mixed trust.
  • Testing only from the node itself, so that missing client trust goes unnoticed.
  • Assuming that a padlock means that access control is also in place.

19Monitoring and Logging TLS Health

TLS problems are quiet until they are sudden. A few simple checks turn them into visible, calendar-friendly tasks.

Monitoring TLS means watching three things: whether certificates are close to expiring, whether handshakes are failing, and whether the settings are what you think they are. Each has a simple tool.

What to watchHow to check itWhat to do about it
Days until certificate expiryThe Elasticsearch operation that lists certificates and their dates, run on a schedule and stored as a metricAlert at sixty, thirty, and fourteen days, and renew early
Failed handshakesElasticsearch logs and the logs of clients, load balancers, and shippersRead the message to see which handshake step failed
Nodes leaving and rejoiningCluster health and node membership events in the logsCheck whether certificates or trust changed just before the event
Protocol and cipher useLoad balancer statistics and client version inventoryFind old clients before tightening settings
Endpoint checks from outsideA synthetic check that connects over HTTPS the way a real client would and reads the certificate datesCatch mismatched names and missing authorities early
Configuration driftCompare TLS settings across nodes with a script or configuration managementFix nodes that differ from the standard
Everyday Analogy

A building manager keeps a wall calendar of fire extinguisher inspections, elevator permits, and licence renewals. Nothing dramatic happens on most days, but the calendar prevents the one bad day when an inspector arrives and a permit has lapsed. Certificate expiry belongs on the same kind of calendar.

Reading Elasticsearch logs

When a TLS problem occurs, Elasticsearch writes messages in its regular log. On the transport layer, look for lines about failed handshakes, unknown certificates, or nodes that could not join. On the HTTP layer, look for messages about clients that failed to complete a handshake. The messages often quote a short reason, such as an unknown authority, an expired certificate, or a mismatch of names.

Turning on more detail

For a hard case, you can raise the logging level for the security and TLS parts of Elasticsearch to see more. The Java runtime also has a debug switch, javax.net.debug, which prints the details of each handshake step. Use these only for a short time, because they produce a lot of output and can reveal sensitive details in logs.

Client side evidence

Half of every handshake happens on the client, so the client’s logs matter. Language libraries, Kibana, and shippers usually print the reason for a failure. Compare the client’s message with the server’s message, and you will often see both halves of the story.

A simple dashboard

A useful small dashboard shows the days left on each certificate, the count of TLS-related errors per hour, the number of nodes in the cluster over time, and the number of client connections. Five or six numbers are enough. Link each alert to a runbook page that says what to do.

i
Check from the outside too

An inside check on the node may pass while clients still see an error, for example because the load balancer presents a different certificate. A regular outside-in check, made the way a real client connects, catches this class of problems.

20Failure Scenarios and Recovery

TLS failures are usually not mysterious. They fall into a handful of patterns, and each has a calm, practical recovery.

Certificate expired

Symptoms: nodes cannot reconnect after a restart, clients report expired certificates, and the cluster may split into smaller groups if some nodes have valid certificates and others do not. Recovery: issue new certificates, place them on the affected nodes, and let Elasticsearch reload them or restart if needed. Then review the alert setup so that it does not happen again.

Authority rotated without overlap

Symptoms: after a change, nodes reject each other with unknown authority errors. Recovery: put both the old and the new authority in every truststore, restore the cluster, and then continue the rotation in the proper order. This is the reason why Chapter 13 stresses overlapping trust.

Names do not match

Symptoms: clients or nodes complain that no name in the certificate matches the address used. Recovery: reissue the certificate with the right names and addresses, or change the address the client uses to one that is listed. Also review whether a balancer or a service alias is missing from the list.

Clock problems

Certificates are valid between two dates, and the check uses the machine’s clock. A node with a clock set far in the past or the future can reject good certificates, complaining that they are not yet valid or already expired. Keep clocks synchronized with a time service.

Keystore password mismatch

Symptoms: a node refuses to start or fails to reload its certificates, with a message about not being able to open the keystore or recover the key. Recovery: confirm that the password in the secure keystore matches the file, and that the file is not corrupted. Keep a record of which password belongs to which file, in your secret manager.

Everyday Analogy

Most TLS failures are like a door that will not open. Either the key card has expired, the door does not know the card issuer, the name on the card does not match the room, the clock on the door is wrong, or the card reader cannot read the card. Checking these five possibilities in order resolves nearly every case.

The cluster is split or degraded

When some nodes cannot talk to others because of certificates, the cluster may lose its master, refuse writes, or mark shards as unassigned. The first goal is to restore trust between nodes so that they see each other. After that, the cluster recovers on its own by rebuilding missing shard copies. Avoid deleting data or forcing shard allocation in a panic, because the data is usually fine and only communication is blocked.

Locked out after enabling

Sometimes a team enables HTTPS and finds that no client can connect. The usual causes are clients still using plain addresses, missing authority certificates on clients, or a balancer that has not been updated. A well-prepared rollout plan includes a rollback, such as keeping the old configuration ready and a snapshot taken beforehand.

Recovery habits that help

  • Keep copies of certificates and configuration in a secure, versioned place.
  • Take a snapshot before changes that touch the cluster’s communication.
  • Change one node at a time whenever the procedure allows it, and check cluster health between steps.
  • Write down the exact steps used to fix each incident, and add them to the runbook.
!
Stay calm with data

A communication failure does not mean that data is lost. Do not delete indices or reset nodes before you have confirmed that the shard files are intact. Fix trust first and let the cluster heal.

21Troubleshooting Common TLS Errors

When an error appears, match the message to its meaning. This table covers the messages that people meet most often.

What you seeMost likely meaningFirst things to check
Unable to find valid certification path, or PKIX path building failedThe client does not trust the authority that signed the server certificateGive the client the authority certificate, and check that it is the right one
Self-signed certificate in certificate chainSame idea: the chain ends at an authority the client does not knowAdd the authority to the client’s trust settings
No subject alternative names matching the host or addressThe name or address used is not listed in the certificateUse a listed name, or reissue with the correct names
Certificate expired, or not yet validDates are outside the validity range, or the clock is wrongCheck the dates and the machine clocks
Not an SSL or TLS record, or a plain-text response to a TLS requestA client used plain HTTP on a TLS port, or the other way aroundUse https on the HTTP layer, and check port numbers
Received fatal alert about a bad or unknown certificateThe other side rejected the certificate that was presentedRead the log on the rejecting side to see why
Handshake failure or no shared cipherThe two sides have no common protocol version or cipher suiteCompare supported protocols and ciphers, and update old clients
Client certificate required or missingThe server asks for a client certificate, and the client did not send oneConfigure the client’s certificate, or review the client authentication setting
Node cannot join the cluster after enabling TLSNodes have different TLS settings, or trust different authoritiesCompare settings on all nodes, and confirm every truststore holds the right authority
Unable to open keystore, or keystore password incorrectThe secure password does not match the fileCheck the secure keystore entries and the file itself

A calm way to debug

1

Name the layer

Is the failing connection between nodes, or between a client and the cluster? The two use different settings.

2

Read both logs

Look at the log of the side that rejected the connection and the side that was rejected. The reason is usually printed on one of them.

3

Check the five basics

Authority trusted, dates valid, names match, protocol and cipher in common, and client certificate present if required.

4

Look at the certificate itself

Use a standard tool to print the certificate presented by the server. Read its names, dates, and issuer, and compare with what you expected.

5

Change one thing at a time

Fix one suspected cause, test, and record the result. Changing many settings at once hides which change worked.

6

Write it down

Add the symptom and the fix to your runbook so that the next person finds it in minutes.

i
A clean test

From a client machine, connect to the HTTPS address and ask for the certificate chain. If the tool shows the chain and the names you expect, the server side is likely fine, and the problem is in the client’s trust settings.

22Real-World Scenarios

Here are four common situations, with rough numbers, showing TLS at work. The companies are imaginary, but the patterns are the ones teams meet every day.

Scenario 1: The payment events cluster

The imaginary fintech PayLoop stores payment events in a twelve-node cluster. Its auditors ask for proof of encryption in transit. The team creates a private authority kept in a hardware-backed secret system, issues one certificate per node with full verification, and puts a public certificate on the load balancer for partners. The transport port is allowed only between nodes. Audit questions about encryption are answered with one diagram and a certificate report.

Scenario 2: The surprise expiry

At the imaginary retailer BrightCrate, a cluster runs for three years on the certificates created on day one. On a Sunday, a routine restart of one node fails to rejoin, because the certificate expired weeks ago and open connections had hidden the problem. Two more nodes restart during patching and fail the same way. The team restores service by issuing new certificates within two hours. Afterward, they add a daily expiry check and an alert at sixty days.

Scenario 3: The old script

The imaginary agency GreenLeaf turns on HTTPS for its cluster on a Friday. By Monday, the monthly report has silently failed, because a forgotten script still calls the plain address and was never updated. The team adds an inventory of all clients to its change checklist. Now every change to the cluster’s front door starts with a list of who calls it.

Scenario 4: Two clusters in two regions

The imaginary media company NorthPeak searches across a cluster in each of two regions. The team picks the newer remote cluster interface with API keys, so the far cluster exposes only the indices it must, over TLS. When a key is exposed in a chat by mistake, they revoke that one key without touching certificates, and nothing else is affected.

A worked example: one year in the life of a certificate plan

1

Day 0: build the foundation

A team creates a private authority valid for five years and node certificates valid for one year. They record every expiry date in a shared calendar and in monitoring.

2

Day 305: the sixty-day alert fires

The monitoring job reports that node certificates have sixty days left. A ticket is created automatically.

3

Day 320: renew one node

The team issues a new certificate for the first node, replaces the files, and watches Elasticsearch reload them. Cluster health stays green.

4

Day 321 to 325: the remaining nodes

They repeat the steps for each node, one at a time, checking health between them. The whole cluster is renewed with a month to spare.

5

Day 330: review and improve

The team writes down what was slow and turns the manual steps into a script for next year. The alert moves to ninety days.

23Frequently Asked Questions

Q1Is TLS turned on by default in Elasticsearch?
In modern versions, a brand-new node that starts for the first time with default settings enables security and configures TLS on both layers automatically. Older versions needed manual setup, and nodes that already have their own security settings are not changed.
Q2What is the difference between transport TLS and HTTP TLS?
Transport TLS protects traffic between Elasticsearch nodes, and it uses mutual authentication so that only trusted nodes can join. HTTP TLS protects traffic between clients and the cluster, where the server proves its identity to the client. They have separate settings and can use different certificates.
Q3Do I need to buy certificates?
Not for the transport layer. A private authority that you create yourself is the usual choice. For the HTTP layer, a private authority works when all clients are yours. If outside parties or browsers connect, a public authority certificate at the edge is common.
Q4Is SSL the same as TLS?
TLS is the modern successor of SSL. The word SSL survives in setting names and everyday speech, but the old SSL versions are no longer used or allowed, and modern connections run on TLS.
Q5Which verification mode should I choose?
Use full when each node has its own certificate with correct names, because it also checks names. Use certificate when nodes share a certificate or addresses change often, and guard the authority well. Never use none in production.
Q6Can I renew certificates without restarting nodes?
Generally yes. Elasticsearch watches the files used for TLS and reloads them when they change. If a password changes together with the file, update the secure keystore as well. Check the logs after each renewal.
Q7Can I enable TLS on a running plain-text cluster one node at a time?
Usually not, because nodes with TLS cannot talk to nodes without it. Plan a full restart in a maintenance window, take a snapshot first, and confirm the procedure in the documentation for your version.
Q8Does TLS encrypt my data on disk?
No. TLS protects data while it moves. To protect stored data, use disk or volume encryption and protect snapshot storage.
Q9Will TLS slow down my cluster?
Slightly, mostly through the handshake and encryption work, which modern processors handle efficiently. Keeping connections open and reusing them keeps the cost small. Measure in your own environment.
Q10What happens when a certificate expires?
New handshakes fail. Existing connections may continue for a while, which can hide the problem until a restart or a reconnect. Then nodes cannot rejoin, and clients see errors. Monitor expiry dates and renew early.
Q11Why does my client say it does not trust the certificate?
The client does not have the certificate of the authority that signed the server’s certificate. Give the client that authority certificate, and make sure the name it connects to is listed in the server certificate.
Q12Should clients present certificates to the HTTP layer?
It is optional and off by default. It is useful for machine-to-machine traffic where a certificate makes a strong identity. Many teams use passwords or API keys for clients and reserve client certificates for special cases.

24Summary and Key Takeaways

TLS is a simple idea with a big payoff: locked boxes, badge checks, and tamper seals for every conversation in your cluster. Here is everything to remember.

Key Takeaways

  • What it is: TLS encrypts traffic, detects tampering, and verifies identities, and Elasticsearch uses it on the transport layer between nodes and on the HTTP layer for clients.
  • Why two layers: each has its own audience, port, settings, and certificates, so secure both and never only one.
  • How trust works: a certificate authority signs certificates, and every node or client trusts that authority; keep its private key safe and offline.
  • How nodes protect the cluster: mutual authentication on the transport layer keeps rogue nodes out, and verification modes control how strict name checks are.
  • How to start: modern versions configure TLS on first start, and production clusters usually replace that with their own authority and planned names.
  • How to keep it healthy: monitor expiry dates, renew early, automate delivery, and use overlapping trust when changing the authority.
  • What it cannot do: it does not encrypt data at rest, control who sees which data, or replace passwords, roles, and audit logs.

Keep in mind that setting names, defaults, and tools can change between Elasticsearch versions, so confirm exact details against the documentation of the release you run. With that habit, and the ideas in this guide, you can keep every conversation in your cluster private, verified, and calm.