Error Log: This is a common error from the OpenSearch Security plugin, found in your opensearch.log files when a login attempt fails.
None
[WARN ][o.o.s.a.BackendRegistry] [your-node-name]
Authentication failed for a specific user [admin]
(org.opensearch.security.authtoken.AuthTokenException: Error while validating auth token)
Or when using basic auth:
None
[WARN ][o.o.s.a.BackendRegistry] [your-node-name]
Authentication failed for a specific user [logstash_user]
from [ip_address:port]
The client will typically just receive an HTTP 401 Unauthorized response.
Why… is this happening? This error means exactly what it says: a user (or application) provided credentials (like a username and password, or an auth token) that the Security plugin’s authc (authentication) backend could not validate.
It is a login failure.
Common reasons include:
- Simple Typo: The username or password being sent by the client is incorrect. This is the most common cause.
- Wrong Authentication Backend: The user exists, but in a different backend. For example, the user
kibana_usermight exist in theinternal_users.ymlfile (the “internal” backend), but your client is configured to use SAML or LDAP, and that user doesn’t exist there. - Client Misconfiguration: The client (e.g., Logstash, Filebeat, your custom application) has the wrong password in its configuration file.
- Hashing Mismatch: You manually edited the
internal_users.ymlfile and provided a plain-text password instead of a bcrypt hash. You must use thehash.shscript (inplugins/opensearch-security/tools/) to generate a correct hash for thehash:property. - Invalid Auth Token: The user is trying to authenticate with a token (like a JWT) that is expired, has an invalid signature, or is not trusted by the cluster.
Best Practice:
1. Check Credentials: Double- and triple-check the username and password in your client configuration. Be mindful of special characters.
2. Test with cURL: Verify the credentials from the command line. This isolates the problem from your client application.
Bash
None
curl -k -u 'my_user:my_password' "https://my-node-ip:9200/_plugins/_security/authinfo"
3. If this works, the credentials are correct, and the problem is in your client’s config. If it fails with a 401, the credentials are wrong.
4. Check config.yml: Look at your config.yml (on the cluster manager nodes) to see which authc (authentication) domains are enabled and in what order.
5. Use hash.sh for Internal Users: When adding users to internal_users.yml, always use the hash.sh script to generate the password hash. Never store plain text.
6. Reload Security Settings: After editing internal_users.yml, you must run the securityadmin.sh script to load the changes into the cluster.
What else can I do? Still locked out? If you’ve locked yourself out of the admin account, the OpenSearch documentation has a password recovery process. For other authentication issues, the OpenSearch community can help you debug your config.yml. You can also contact us in The OpenSearch Slack Channel in #General.