Before running the docker-compose, set owner:group of the ./config/opensearch/config folder to a user with ID 1000:1000
. That will allow to map opnsearch config files in the opensearch containers.
plugins.security.authcz.rest_impersonation_user:
"impersonator":
- "*"
curl -k --header "Content-Type: application/json" --request PUT --data '{"password":"user1","opendistro_security_roles":["alerting_read_access"],"backend_roles":["foo","baz"]}' https://admin:admin@localhost:9200/_plugins/_security/api/internalusers/user1
curl -k --header "Content-Type: application/json" --request PUT --data '{"password":"impersonator","opendistro_security_roles":["alerting_ack_alerts"],"backend_roles": ["foo", "bar"]}' https://admin:admin@localhost:9200/_plugins/_security/api/internalusers/impersonator
curl -XGET -u impersonator:impersonator -k "https://127.0.0.1:9200/_plugins/_security/authinfo?pretty"
curl -XGET -u user1:user1 -k "https://127.0.0.1:9200/_plugins/_security/authinfo?pretty"
curl -XGET -u impersonator:impersonator -k -H "opendistro_security_impersonate_as: user1" "https://127.0.0.1:9200/_plugins/_security/authinfo?pretty"
curl -XGET -u user1:user1 -k "https://127.0.0.1:9200/_plugins/_security/authinfo?pretty"
{
"user" : "User [name=user1, backend_roles=[foo, baz], requestedTenant=null]",
"user_name" : "user1",
"user_requested_tenant" : null,
"remote_address" : "192.168.160.1:36622",
"backend_roles" : [
"foo",
"baz"
],
"custom_attribute_names" : [ ],
"roles" : [
"own_index",
"alerting_read_access"
],
"tenants" : {
"user1" : true
},
"principal" : null,
"peer_certificates" : "0",
"sso_logout_url" : null
}
curl -XGET -u impersonator:impersonator -k "https://127.0.0.1:9200/_plugins/_security/authinfo?pretty"
{
"user" : "User [name=impersonator, backend_roles=[bar, foo], requestedTenant=null]",
"user_name" : "impersonator",
"user_requested_tenant" : null,
"remote_address" : "192.168.160.1:36630",
"backend_roles" : [
"bar",
"foo"
],
"custom_attribute_names" : [ ],
"roles" : [
"own_index",
"alerting_ack_alerts"
],
"tenants" : {
"impersonator" : true
},
"principal" : null,
"peer_certificates" : "0",
"sso_logout_url" : null
}
curl -XGET -u impersonator:impersonator -k -H "opendistro_security_impersonate_as: user1" "https://127.0.0.1:9200/_plugins/_security/authinfo?pretty"
{
"user" : "User [name=user1, backend_roles=[foo, baz], requestedTenant=null]",
"user_name" : "user1",
"user_requested_tenant" : null,
"remote_address" : "192.168.160.1:36634",
"backend_roles" : [
"foo",
"baz"
],
"custom_attribute_names" : [ ],
"roles" : [
"own_index",
"alerting_read_access"
],
"tenants" : {
"user1" : true
},
"principal" : null,
"peer_certificates" : "0",
"sso_logout_url" : null
}