Elastic Search

Elasticsearch Enable Anonymous Login

“Security is one of the most incredible features provided by Elasticsearch, Kibana, and Logstash. The ELK stack comes configured with security features such as SSL/TLS encryption, user permissions, and roles.

Therefore, when performing requests to Elasticsearch, the request includes an authentication token in the incoming request. Elasticsearch extracts and uses this token to authorize and complete the requested action.

Elasticsearch will deny the token and return an error if no authentication token is missing from the request.

However, sometimes you may need to allow the anonymous request. Although this is a serious security issue and should not be implemented in production, it can benefit the development mode.”

Hence, in this tutorial, we will show you how you can configure and enable anonymous login in Elasticsearch.

Elasticsearch Enable Anonymous User

To enable we need to assign one or more roles in the Elasticsearch configuration file.

For example, to allow anonymous access for es_anonymous_user user, edit the Elasticsearch config file:

$ sudo nano /etc/elasticsearch/elasticsearch.yml

 
Add the configuration as:

xpack.security.authc:
  anonymous:
    username: anonymous_user
    roles: admin
    authz_exception: true

 

The configuration specifies anonymous login for the specified username. As mentioned, this defaults to _es_anonymous_user unless specified.

The roles define the roles associated with the anonymous username. In this case, we assign administrator roles to the anonymous user (Not recommended).

Finally, we specify if exceptions should be returned. If true, the request returns HTTP 403 if the anonymous user performs actions to which they do not have permission.

To enable an anonymous user in kibana, add the following entry in kibana.yml.

xpack.security.authc.providers:
  basic.basic1:
    order: 0
  anonymous.anonymous1:
    order: 1
    credentials:
      username: "anonymous_service_account"
      password: "anonymous_service_account_password"

 
Save and reload the services.

Termination

This article describes how to enable anonymous access for Elasticsearch and Kibana by editing their respective configuration files.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list