Securing elasticsearch Securing elasticsearch elasticsearch elasticsearch

Securing elasticsearch


There's an article about securing Elasticsearch which covers quite a few points to be aware of here: http://www.found.no/foundation/elasticsearch-security/ (Full disclosure: I wrote it and work for Found)

There's also some things here you should know: http://www.found.no/foundation/elasticsearch-in-production/

To summarize the summary:

At the moment, Elasticsearch does not consider security to be its job. Elasticsearch has no concept of a user. Essentially, anyone that can send arbitrary requests to your cluster is a “super user”.

  1. Disable dynamic scripts. They are dangerous.
  2. Understand the sometimes tricky configuration is required to limit access controls to indexes.
  3. Consider the performance implications of multiple tenants, a weakness or a bad query in one can bring down an entire cluster!


Proxying ES traffic through nginx with, say, basic auth enabled is one way of handling this (but use HTTPS to protect the credentials). Even without basic auth in your proxy rules, you might, for instance, restrict access to various endpoints to specific users or from specific IP addresses.

What we do in one of our environments is to use Docker. Docker containers are only accessible to the world AND/OR other Docker containers if you explicitly define them as such. By default, they are blind. In our docker-compose setup, we have the following containers defined:

  • nginx - Handles all web requests, serves up static files and proxies API queries to a container named 'middleware'

  • middleware - A Java server that handles and authenticates all API requests. It interacts with the following three containers, each of which is exposed only to middleware:

    • redis
    • mongodb
    • elasticsearch

The net effect of this arrangement is the access to elasticsearch can only be through the middleware piece, which ensures authentication, roles and permissions are correctly handled before any queries are sent through.

A full docker environment is more work to setup than a simple nginx proxy, but the end result is something that is more flexible, scalable and secure.


Here's a very important addition to the info presented in answers above. I would have added it as a comment, but don't yet have the reputation to do so.

While this thread is old(ish), people like me still end up here via Google.

Main point: this link is referenced in Alex Brasetvik's post:

https://www.elastic.co/blog/found-elasticsearch-security

He has since updated it with this passage:

Update April 7, 2015: Elastic has released Shield, a product which provides comprehensive security for Elasticsearch, including encrypted communications, role-based access control, AD/LDAP integration and Auditing. The following article was authored before Shield was available.

You can find a wealth of information about Shield here: here

A very key point to note is this requires version 1.5 or newer.