# Elasticsearch 5.6.2 (x-pack) secured cluster with custom plugin : action \[indices:data/read/search\] is unauthorized for user \[\_system\]

**URL:** https://discuss.elastic.co/t/elasticsearch-5-6-2-x-pack-secured-cluster-with-custom-plugin-action-indices-data-read-search-is-unauthorized-for-user-system/213801
**Category:** Elasticsearch
**Created:** [January 5, 2020, 1:45pm UTC](https://discuss.elastic.co/t/elasticsearch-5-6-2-x-pack-secured-cluster-with-custom-plugin-action-indices-data-read-search-is-unauthorized-for-user-system/213801 "2020-01-05T13:45:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cohavisi](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@cohavisi](https://discuss.elastic.co/u/cohavisi)
#### Post date: [January 5, 2020, 1:45pm UTC](https://discuss.elastic.co/t/elasticsearch-5-6-2-x-pack-secured-cluster-with-custom-plugin-action-indices-data-read-search-is-unauthorized-for-user-system/213801/1 "2020-01-05T13:45:37Z")

</div>

Continuing the discussion from [How to get a NodeClient inside a X-Pack plugin?](https://discuss.elastic.co/t/how-to-get-a-nodeclient-inside-a-x-pack-plugin/156347/14):

Hi All,  
I get the following exception when executing specific operation on my custom plugin.  
the elasticsearch cluster (5.6.2) is using x-pack (ssl enable) and now I cannot execute the plugin:

[2020-01-05T13:42:54,855][ERROR][c.f.a.a.a.a.p.IndexAggregateAction] Index aggregation task failed with exception. State: IAS(1, FINISHED, [TSK(default, bf10be58-406f-4d0f-9ff8-9677b6ccaf10\_10.240.20.234, tmstat-iapp)])  
org.elasticsearch.ElasticsearchSecurityException: action [indices:data/read/search] is unauthorized for user [\_system]  
at org.elasticsearch.xpack.security.support.Exceptions.authorizationError(Exceptions.java:45) ~[?:?]  
at org.elasticsearch.xpack.security.authz.AuthorizationService.denialException(AuthorizationService.java:549) ~[?:?]  
at org.elasticsearch.xpack.security.authz.AuthorizationService.denial(AuthorizationService.java:520) ~[?:?]  
at org.elasticsearch.xpack.security.authz.AuthorizationService.authorize(AuthorizationService.java:169) ~[?:?]  
at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$authorizeRequest$4(SecurityActionFilter.java:195) ~[?:?]  
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.maybeRun(AuthorizationUtils.java:127) ~[?:?]  
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.setRunAsRoles(AuthorizationUtils.java:121) ~[?:?]  
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.authorize(AuthorizationUtils.java:103) ~[?:?]  
at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.authorizeRequest(SecurityActionFilter.java:210) ~[?:?]  
at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$applyInternal$3(SecurityActionFilter.java:186) ~[?:?]  
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:59) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$writeAuthToContext$22(AuthenticationService.java:465) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.writeAuthToContext(AuthenticationService.java:474) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$handleNullToken$15(AuthenticationService.java:361) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.handleNullToken(AuthenticationService.java:368) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.consumeToken(AuthenticationService.java:295) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$extractToken$7(AuthenticationService.java:267) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.extractToken(AuthenticationService.java:284) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$null$0(AuthenticationService.java:218) ~[?:?]  
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:59) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.xpack.security.authc.TokenService.getAndValidateToken(TokenService.java:195) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$2(AuthenticationService.java:214) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$4(AuthenticationService.java:246) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:257) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:210) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:159) ~[?:?]  
at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:122) ~[?:?]  
at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.applyInternal(SecurityActionFilter.java:185) ~[?:?]  
at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.apply(SecurityActionFilter.java:145) ~[?:?]  
at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:168) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:142) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:84) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.client.node.NodeClient.executeLocally(NodeClient.java:83) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.client.node.NodeClient.doExecute(NodeClient.java:72) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80) ~[elasticsearch-5.6.2.jar:5.6.2]  
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54) ~[elasticsearch-5.6.2.jar:5.6.2]  
.  
.  
.

how can I resolve this issue?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 2, 2020, 1:45pm UTC](https://discuss.elastic.co/t/elasticsearch-5-6-2-x-pack-secured-cluster-with-custom-plugin-action-indices-data-read-search-is-unauthorized-for-user-system/213801/2 "2020-02-02T13:45:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
