Elasticsearch Config Security Audit Guide
Last updated:
An Elasticsearch config audit is a static review of an Elasticsearch cluster's configuration file — elasticsearch.yml — checked line by line against known-good practice, without connecting to the cluster. The file is small, usually a few dozen settings, but it decides who can connect without a password, which network interfaces the cluster listens on, whether a single request can delete every index, and whether anyone will ever know what happened. This guide walks through the settings that matter, the one setting that decides everything, the network exposure hiding in two lines, the destructive settings, bootstrap and cluster formation, and the mistakes that show up again and again — then shows you how to run the same audit yourself with the Elasticsearch Config Auditor.
What an Elasticsearch config audit actually checks
A config audit reads the file the way the server reads it: as settings, one key: value line at a time. Elasticsearch uses YAML in elasticsearch.yml — mostly flat dotted keys like xpack.security.enabled and network.host, though the same setting can be written as nested YAML — plus # comments and quoted values. Because a setting that is simply absent leaves the compiled-in default in force, an audit checks absence as carefully as presence: the line you never wrote can be the one that matters most.
The checks fall into four families. Authentication and access: who can connect, and whether anonymous requests act as a named user. Transport security: which interfaces the cluster listens on, and whether client and node-to-node connections are encrypted. Destructive power: what a single request can delete, and which websites can call the API from a visitor's browser. And cluster formation: how nodes find each other and elect a master. The Elasticsearch Config Auditor runs these rules and scores the result from 0 to 100; the same audit family covers MongoDB and Redis configs.
Authentication is off by default on 7.x — the one setting that decides everything
Elasticsearch 7.x and earlier ship with security OFF. A fresh install with no xpack.security.enabled line accepts any connection and lets it read, write and delete everything — no password, no user, no error. That single default is behind the waves of open Elasticsearch clusters found by scanners, wiped, and left with a ransom note. Everything else in the config is secondary: if security is off, the bind address and the TLS settings are the only things standing between the cluster and the internet, and both of them have permissive defaults of their own. Elasticsearch 8.x changed the default to on — which is why the absence of the line is a warning, not an error: the file alone cannot say which version will read it.
Turning it on takes one line — xpack.security.enabled: true — and then the real work starts: creating users in the native realm, because security enabled with no users means nobody can log in at all, including you, until the first user is created. And enabling security does not encrypt anything: the HTTP layer needs xpack.security.http.ssl.enabled with a keystore, and the transport layer needs its own SSL settings — without them, credentials and replicated data still travel in cleartext. The other half of this section is the setting that must never be present: xpack.security.authc.anonymous.username lets unauthenticated requests act as a named user, which is an open door with a name on it.
Network exposure: network.host, the default port, and why a firewall is not a substitute for auth
Two lines decide whether the cluster is reachable at all. network.host picks the interfaces Elasticsearch listens on: 127.0.0.1 or _local_ means local clients only, 0.0.0.0 means every interface, including the public internet if the host is exposed, and _site_ and _global_ bind wider still. The default when network.host is absent is localhost — but an absent line is an implicit decision, and the auditor flags the absence as well as the exposure, because a config that never says where it listens is a config nobody has thought about.
Then comes encryption, on two layers that are easy to confuse. xpack.security.http.ssl.enabled encrypts the REST API — the port 9200 traffic your clients see — while xpack.security.transport.ssl.enabled encrypts node-to-node traffic, including replicated data. Each needs its own keystore (and the transport layer a truststore), and enabling either without one is a contradictory config: the node will fail to start. The trap inside the trap is verification_mode: none — nodes accept any certificate, so the traffic looks encrypted while a man in the middle can sit between nodes. And http.port deserves a word of caution in the other direction: 9200 on a public interface is trivially scanned, but changing the port is obscurity only — it never substitutes for binding to localhost or a firewall, and a firewall never substitutes for authentication.
The destructive settings: wildcard deletion, CORS *, and the reindex whitelist
Three settings decide what a single request can destroy. action.destructive_requires_name is the cheapest win in the whole file: when it is false, DELETE /* wipes every index in the cluster in one request. It defaults to true since 7.x, so the auditor only flags an explicit false — but a config that sets it false is a config someone deliberately weakened. Next is CORS: http.cors.enabled: true lets browsers call the REST API, and with http.cors.allow-origin: "*" any website a visitor opens can call the cluster API from that visitor's browser — the cluster's authentication, if it is on at all, is the only thing in the way.
The third is the one people forget: reindex.remote.whitelist. Remote reindex pulls documents from another cluster, and a whitelist of * means it can pull from any host — an SSRF vector that turns a reindex request into a probe of your internal network. The fix in all three cases is the same shape: name exactly what is allowed and nothing else — true for destructive_requires_name, one exact origin for CORS, one trusted host for the reindex whitelist — or leave the feature off entirely.
Bootstrap and cluster formation: seed hosts, initial masters, and single-node
A cluster has to agree on who its masters are, and the settings that decide it are easy to leave blank. discovery.seed_hosts lists the nodes a new node contacts to join, and cluster.initial_master_nodes lists the master-eligible nodes that take part in the first election. A multi-node cluster with neither risks split-brain — two halves each believing they are the cluster — and bootstrap failure on restart. The auditor flags the pair's absence as a warning, and a single initial master alongside several seed hosts as an info: one master-eligible node is a single point of failure, and three is the usual floor.
The exception is discovery.type: single-node, which is fine for development and single-node deployments — and the auditor notes it as an info, not a finding to fix. What it must never be is a shortcut: single-node disables bootstrap checks, so using it to paper over a real cluster hides the formation problem instead of solving it. The other quiet settings in this family are the ones the auditor deliberately does not score — node.roles, cluster.routing.allocation.*, indices.recovery.* — deployment and tuning choices, not security findings. They are real decisions, just not this audit's decisions.
The five mistakes the auditor flags most
Across real-world configs, the same five findings recur. First, no xpack.security.enabled at all — the classic unauthenticated Elasticsearch on the public internet, the one behind the ransomware waves that wipe clusters and leave a ransom note. Second, network.host: 0.0.0.0 — the same hole, one section earlier. Third, TLS off on both layers — every credential in cleartext, on a cluster that is often already public. Fourth, action.destructive_requires_name: false with CORS open to every website — one request from any visitor's browser can delete everything. Fifth, no seed hosts and no initial masters — a cluster that cannot agree on who is in charge.
The demo config below manages all five in 18 lines, plus a few extras: anonymous access on, verification_mode none, a reindex whitelist of *, inline scripts allowed by default, and relative data and log paths. The auditor scores it 18 out of 100, band Poor. Its hardened twin — same shape, every finding fixed — scores 100.
What a static audit cannot see — and auditing yours in five minutes
A static audit reads text, and its limits are the limits of text. It cannot see the values the running cluster actually uses — a setting in the file can be overridden at startup, so check GET /_nodes/settings on the cluster for the live truth. It cannot see the users and roles in the native realm — the people who can actually log in live in the cluster, not in elasticsearch.yml. It cannot see the Elasticsearch version or whether it is end-of-life, the firewall in front of port 9200, the keystore permissions on disk, or whether the TLS certificate is valid. And it cannot see heap sizing, which lives in jvm.options, a file this tool does not read.
To audit yours in five minutes: copy the config (or the one file you care about), paste it into the Elasticsearch Config Auditor — it runs entirely in your browser, and the config is never uploaded, which matters because a config names hosts, keystore paths and internal hostnames you do not publish. Fix the errors first (security off, a public bind, anonymous access, CORS open to every website, a reindex whitelist of *), then the warnings, then work through the infos as a list of defaults worth setting explicitly. Export the findings CSV if you want the checklist in a ticket. Then check the live values on the cluster — GET /_nodes/settings and GET /_security/user — and create the users the config alone cannot give you, because a config that enables security without users locks everyone out, including you.
The broken demo config
# Demo elasticsearch.yml — deliberately broken. Do not deploy.
cluster.name: elasticsearch
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.transport.ssl.verification_mode: none
xpack.security.authc.anonymous.username: anonymous_user
action.destructive_requires_name: false
http.cors.enabled: true
http.cors.allow-origin: "*"
reindex.remote.whitelist: "*"
bootstrap.system_call_filter: false
path.data: data
path.logs: logs
thread_pool.search.queue_size: 5000