Hi all,
I am running OpenSearch 3.2.0 on my localhost and I am trying to map a user to a specifc role from a specific host (hostname or IP). I followed the docs API - OpenSearch Documentation but it does not seem to be work! I appreciate your help. Below are the steps I followed.
PUT testindex/_doc/1
{
"name": "hello"
}
PUT _plugins/_security/api/internalusers/testuser
{
"password": "SrchUsr12345789@"
}
PUT _plugins/_security/api/roles/testindex_role
{
"cluster_permissions": [],
"index_permissions": [
{
"index_patterns": [
"testindex"
],
"dls": "",
"fls": [],
"masked_fields": [],
"allowed_actions": [
"read"
]
}
],
"tenant_permissions": []
}
PUT _plugins/_security/api/rolesmapping/testindex_role
{
"users": [
"testuser"
],
"backend_roles": [
"testindex_role"
],
"hosts": [
"10.0.0.1"
]
}
The I perform search from 127.0.0.1 using testuser as shown below.
curl -k -u testuser:SrchUsr12345789@ https://localhost:9200/testindex/_search
As you can see in the result it is returning eventhough I am calling from 127.0.0.1 and not from 10.0.0.1
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "testindex",
"_id": "1",
"_score": 1.0,
"_source": {
"name": "hello"
}
}
]
}
}
In addition, “opensearch_security.host_resolver_mode: ip-hostname” mentioned in API - OpenSearch Documentation does not seem to be a valid configuration. Can anyone give a working example of it and of the above?
Thanks