I just made a clean opensearch installation and wanna grant permissions to logstash user for creating indices with specific prefix (default logstash-* for examples below). I took a built-in logstash role as a basis. Here is example, it works as expected:
# curl -s -X PUT -k -u 'logstash:321654' https://10.10.1.2:9200/logstash-logstash | jq
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "logstash-logstash"
}
Then i have copied logstash role using Opensearch Dasbords UI to logstash_copy and replaced previously assigned logstash role to created one in logstash user config. Now it doesn’t work.
# curl -s -X PUT -k -u 'logstash:321654' https://10.10.1.2:9200/logstash-copy | jq
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "no permissions for [indices:admin/create] and User [name=logstash, backend_roles=[logstash_copy], requestedTenant=null]"
}
],
"type": "security_exception",
"reason": "no permissions for [indices:admin/create] and User [name=logstash, backend_roles=[logstash_copy], requestedTenant=null]"
},
"status": 403
}
It dies due to “no permissions for [indices:admin/create]” but it is absent also in built-in logstash role that is working fine. Here are both roles configs.
built-in:
# curl -s -X GET -k -u 'admin:321654' https://10.10.1.2:9200/_plugins/_security/api/roles/logstash | jq
{
"logstash": {
"reserved": true,
"hidden": false,
"description": "Provide the minimum permissions for logstash and beats",
"cluster_permissions": [
"cluster_monitor",
"cluster_composite_ops",
"indices:admin/template/get",
"indices:admin/template/put",
"cluster:admin/ingest/pipeline/put",
"cluster:admin/ingest/pipeline/get"
],
"index_permissions": [
{
"index_patterns": [
"logstash-*"
],
"fls": [],
"masked_fields": [],
"allowed_actions": [
"crud",
"create_index"
]
},
{
"index_patterns": [
"*beat*"
],
"fls": [],
"masked_fields": [],
"allowed_actions": [
"crud",
"create_index"
]
}
],
"tenant_permissions": [],
"static": true
}
}
copy:
# curl -s -X GET -k -u 'admin:321654' https://10.10.1.2:9200/_plugins/_security/api/roles/logstash_copy | jq
{
"logstash_copy": {
"reserved": false,
"hidden": false,
"cluster_permissions": [
"cluster_monitor",
"cluster_composite_ops",
"indices:admin/template/get",
"indices:admin/template/put",
"cluster:admin/ingest/pipeline/put",
"cluster:admin/ingest/pipeline/get"
],
"index_permissions": [
{
"index_patterns": [
"logstash-*"
],
"fls": [],
"masked_fields": [],
"allowed_actions": [
"crud",
"create_index"
]
},
{
"index_patterns": [
"*beat*"
],
"fls": [],
"masked_fields": [],
"allowed_actions": [
"crud",
"create_index"
]
}
],
"tenant_permissions": [],
"static": false
}
}
Why the copy of the role doesn’t work?