How to add permission to my jar in security.policy?


(Qiang Wang) #1

Here is a jar which named 'cat-client-1.4.0.jar' and I want to grant permissions for it:

grant codeBase "${codebase.cat-client-1.4.0.jar}" {
  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
  permission java.lang.RuntimePermission "*";
  permission java.io.FilePermission "/data/applogs/cat", "write,read";
  permission java.io.FilePermission "/data/appdatas/cat", "write,read";
  permission java.io.FilePermission "/data/applogs/cat/*", "write,read";
};

but it doesn't work. There are other settings below which works

grant codeBase "${codebase.lucene-misc-6.2.1.jar}" {
  // needed to allow shard shrinking to use hard-links if possible via lucenes HardlinkCopyDirectoryWrapper
  permission java.nio.file.LinkPermission "hard";
};

I am wondering why my settings doesn't work?


(David Pilato) #2

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Did you read https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-authors.html#_java_security_permissions ?


(Qiang Wang) #3

I'm sorry for ignoring the rules. I have edited my questions.


(David Pilato) #4

Thanks. Much better.

Still, did you read https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-authors.html#_java_security_permissions ?


(system) closed #5

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