# Custom Realm and JarHell

**URL:** <https://discuss.elastic.co/t/custom-realm-and-jarhell/82188>\
**Category:** Elasticsearch\
**Created:** [April 12, 2017, 3:53pm UTC](https://discuss.elastic.co/t/custom-realm-and-jarhell/82188 "2017-04-12T15:53:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jhn134910](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@jhn134910](https://discuss.elastic.co/u/jhn134910)\
**Post date:** [April 13, 2017, 2:24pm UTC](https://discuss.elastic.co/t/custom-realm-and-jarhell/82188/4 "2017-04-13T14:24:45Z")

</div>

I see somebody else had the same issue:

> [@How to customize plugin-security.policy for custom realm](https://discuss.elastic.co/t/how-to-customize-plugin-security-policy-for-custom-realm/71570/5):
>
> So, now, after installing the custom realm extension I have a file named x-pack-extension-security.policy in /usr/share/elasticsearch/plugins/x-pack/extensions/mycustomrealm. The contents of the file is: grant { permission java.net.NetPermission "getProxySelector"; }; I am still getting an error: java.security.AccessControlException: access denied ("java.net.NetPermission" "getProxySelector") when the client is instantiated. Any ideas? This is with 5.1.1.

I followed the steps suggested there. Unfortunately, though it doesn't seem to be picking up the permission I specified in x-pack-extension-security.policy. I add code like:

if(sm != null) {  
sm.checkPermission(new NetworkPermission("getProxySelector"));  
}  
AccessController.doPrivileged((PrivilegedAction) () -\> {  
final AsyncClient asyncClient = new AsyncClient.Builder()  
.withConnectionTimeout(connectionTimeout).withSocketTimeout(socketTimeout)  
.withMaxConnections(maxConnections).withMaxConnectionsPerHost(maxConnectionsPerHost).build();

```
this.imsClient = new IMSClient("http://localhost", Optional.of(asyncClient), imsCacheSize, imsCacheExpiryInMinutes);
return null;

```

});

However, the checkPermission is saying I don't have permission even after the I okayed the permissions when installing the custom realm plugin and the .policy file is present

[root@iel-dev-tfsr-vm1 tango-ims-realm]# pwd  
/usr/share/elasticsearch/plugins/x-pack/extensions/tango-ims-realm  
[root@iel-dev-tfsr-vm1 tango-ims-realm]# ls  
ims-realm-1.0.0-SNAPSHOT.jar x-pack-extension-descriptor.properties x-pack-extension-security.policy

---

_[View the full topic](https://discuss.elastic.co/t/custom-realm-and-jarhell/82188)._
