Header "securitytenant" not work properly for select tenant

I’m trying to create diferent index patterns with curl command in different tenants using the -H “securitytenant” header to specify the tenant, but all index-patterns are created in global tenant. I need to configure something more in the curl call? I’m using ODFE 1.9.0

One curl command example is:

curl -X POST
-k -u “user:password”
http://localhost:9200/api/saved_objects/index-pattern/
-H “kbn-xsrf: true”
-H “content-type: application/json; charset=utf-8”
-H “securitytenant: test_tenant
-d ‘{“attributes”:{“title”:“logger-*”,“timeFieldName”:"@timestamp"}}’

Thanks in advance

Hi ogallart,

I had the same experience as you! Basically if Kibana(/Opendistro) does not get its headers correctly it will default to the default tenant ( for me it was my private tenant), correct me if I’m wrong.

This is a snippet from my Python code:

url = '/api/saved_objects/index-pattern/' + index_pattern
headers = {
  'kbn-xsrf': 'true',
  'Content-Type': 'application/json',
  'securitytenant': str(role),
  'user-agent': 'create-role.py/0.0.1'
}
data = { "attributes": { "title": index_pattern, "timeFieldName": '@timestamp' } }

If I recall correctly I’m guessing that kbn-xsrf is supposed to be a string and not a boolean, if that does not fix your issue the content-type looks a bit different than mine.

Hello @oscark,

Thanks for the answer, I put the header as you say and I can create the index-pattern per tenant succesfully.

1 Like