I was able to successfully create a user 'test1' and assign it the superuser role.
Execute rest api
POST /_security/user/test1?pretty
{
"password" : "test@1",
"roles" : [ "superuser"],
"full_name" : "Test User",
"email" : "testuser@example.com",
"metadata" : {
"intelligence" : 7
}
}
The user is successfully created
{
"created" : true
}
But when I tried to invoke elastic api using the newly created user 'test1', I got the following error
curl -u test1:test@1 https://es.endpoint
{"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate user [test1] for REST request [/]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}}],"type":"security_exception","reason":"unable to authenticate user [test1] for REST request [/]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}},"status":401}
My elastic stack was set up using the following configuration. The default elastic user works fine. Any idea why test1 does not work?
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
namespace: log-server
spec:
version: 7.5.1
http:
tls:
selfSignedCertificate:
disabled: true
nodeSets:
- name: default
count: 3
config:
xpack.security.authc:
anonymous:
username: anonymous
roles: superuser
authz_exception: false