I am trying to create something similar to the logstash role that allows any user with the ingress_user role to be able to create an index with their own name and push data to it:
role:
sg_igress_user:
cluster:
- UNLIMITED
indices:
'${user_name}-*':
'*':
- UNLIMITED
mapping:
sg_ingress_user:
backendroles:
- ingress_user
internal user:
martin:
readonly: true
hash:
roles:
- ingress_user
When I post data with this curl I get the following error:
$ curl -XPUT -sk -u martin: “https:///martin-2018-11/doc/1?pretty” -H ‘Content-Type: application/json’ -d’{ “d”: “some data”}’
{
“error” : {
"root_cause" : [
{
"type" : "security_exception",
"reason" : "no permissions for [indices:data/write/index] and User [name=martin, roles=[ingress_user], requestedTenant=null]"
}
],
"type" : "security_exception",
"reason" : "no permissions for [indices:data/write/index] and User [name=martin, roles=[ingress_user], requestedTenant=null]"
},
“status” : 403
}
If I post the same with the admin user it works.
Does ${user_name} work in the community edition? Given it’s described on the community doc Search Guard role-based authorization for Elasticsearch | Security for Elasticsearch | Search Guard I’m guessing it should but I’ve been caught out by this before.
Also while I’m posting, is it ${user_name} or ${user.name}? The text in documents uses dot whereas the examples use underscore.
Regards,
Martin