First, I'm sorry that you have a hard time using Search Guard. Search Guard is like a swiss army knife regarding security: We support many use cases and technologies, but this versatility also comes with some complexity. For example, configuring an OpenID IdP for Kibana SSO is fundamentally different from, say, LDAP or Kerberos. But I do admit that we can do a better job in describing the most common use cases, and we have already started to work on some cookbooks.
Regarding the roles mapping: This is necessary because depending on what technology you use, backend roles can come from anywhere: For example, LDAP groups, SAML assertions or JWT claims. That's why we have the concept of mapping those backend roles to Search Guard roles. For example, you may want to map multiple LDAP groups to only one Search Guard role. That's what the mapping is for.
This is also explained here in more detail:
But judging from your post I assume you do not have an external auth provider in place, and just want to store users in Elasticsearch, right?
In that case, the approach would be:
1. Create your users in the sg_internalusers.yml file
2. Since the users should be able to log into Kibana, you can use the built-in kibanauser backend role to assign all Kibana related privileges to the user:
myuser:
hash: ...
roles:
- kibanauser
(note that this only gives basic Kibana access, it does not define what indices the user is able to see, we do that in a next step)
3. Because we already have a corresponding entry in the roles mapping file Search Guard ships with, these users will all get assigned to the sg_kibanauser Search Guard role. The mapping looks like:
sg_kibana_user:
backendroles:
- kibanauser
This basically says: Assign all user that have the backend role "kibanauser" to the Search Guard role "sg_kibana_user". In your case, the backend role comes from the internalusers.yml file, but it could as well be an LDAP group or a JWT claim.
4. You can then use the same approach to assign permissions to your operators. In the internalusers file, assign a second backend role to your users, like:
myuser:
hash: ...
roles:
- kibanauser
- operator
5. Map this "operator" backend role to a SG role in the roles mapping file, like:
sg_operators:
backendroles:
- operator
6. This maps all users that have the "operator" role to the sg_operators SG role. In the roles.yml file, you can then define access permissions to indices, and advanced stuff like document and field level security:
sg_operators:
cluster:
- CLUSTER_COMPOSITE_OPS
indices:
'index-1':
'*':
- READ
'index-2':
'*':
- CRUD
'index-3':
'*':
- ...
For the index names, you can also use wildcards and regular expressions.
For a list of permissions you can use in the roles.yml file please have a look at:
If you run into permission problems, there are two troubleshooting guides which will help you pinpoint the issue:
Finally, it would be super helpful to understand where you struggled most, so we can work on improvinf the docs.