Opster Team
Before you begin reading this guide, we recommend you run the Elasticsearch Error Check-Up which can resolve issues that cause many errors.
This guide will help you check for common problems that cause the log “Authentication of Elastic was terminated by realm [reserved]” to appear. It’s important to understand how authentication works and what role realms play in the process, so read the guide below and follow the steps to resolve this error.
What does authentication mean in Elasticsearch?
Authentication refers to the process or action of verifying the identity of a user or process. Elastic stack authenticates the user by identifying and verifying them. The authentication process is handled by one or more authentication services called realms.
There are various types of realms. Reserved realm is the realm containing the built-in users. Then, there’s the native realm for users defined through the security API (and/or inside Kibana). Lastly, file realm is for users defined in security files on disk.
What this error means
This log message is an INFO message saying that the credentials with which you are trying to authenticate do not match the saved credentials. You will not be able to use the ES cluster, until and unless the username and password match, i.e. until authentication is successful.
How to reproduce this log
First, you need to enable the security settings of Elasticsearch.
Enable security features
To enable security features on the node, turn on the xpack.security.enabled setting. You need to add this setting in the elasticsearch.yml configuration file.
xpack.security.enabled: true
Setting built-in user password
The next step is to set the built-in user credentials, using this command:
bin/elasticsearch-setup-passwords interactive
Restart Elasticsearch
- After setting up the password, you need to restart Elasticsearch. By now, Elasticsearch should be running on port 9200.
- Now go to your browser, and hit http://localhost:9200.
- After hitting that URL, a pop up will open, asking for sign in credentials that you have set while setting the built-in user passwords.
- If either the username or the password does not match with the saved credentials, the following logs will be generated.
The logs generated are:
[INFO ][o.e.x.s.a.AuthenticationService] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]
Quick troubleshooting steps
You need to enter the correct username and password that should match with the credentials that you have set while setting the built-in user password.
If by any chance you’ve forgotten the password, you can reset the password by following the steps mentioned in this post.
Log Context
Log “Authentication of [{}] was terminated by realm [{}] – {}” classname is AuthenticationService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
userListener.onResponse(result.getUser()); } else { // the user was not authenticated; call this so we can audit the correct event request.realmAuthenticationFailed(authenticationToken; realm.name()); if (result.getStatus() == AuthenticationResult.Status.TERMINATE) { logger.info("Authentication of [{}] was terminated by realm [{}] - {}"; authenticationToken.principal(); realm.name(); result.getMessage()); Exception e = (result.getException() != null) ? result.getException() : Exceptions.authenticationError(result.getMessage()); userListener.onFailure(e); } else {
Find & fix Elasticsearch problems
Opster AutoOps diagnoses & fixes issues in Elasticsearch based on analyzing hundreds of metrics.
Fix Your Cluster IssuesConnect in under 2 minutes
Jose Rafaelly
Head of System Engineering at Everymundo