Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Security Manager Policy #127

Open
simmel opened this issue Mar 5, 2018 · 0 comments
Open

Add Security Manager Policy #127

simmel opened this issue Mar 5, 2018 · 0 comments

Comments

@simmel
Copy link
Contributor

simmel commented Mar 5, 2018

Hey!

While trying to use jmxtrans-agent for Elasticsearch it seems that they enforce usage of the Java Security Manager so I had to create a short policy for jmxtrans-agent to work under Elasticsearch.

It would be nice if this is something that jmxtrans-agent could provide for it self. If I've understood it correctly you can provide it but you don't have to turn it on by default (but you can) so everything should work normally for everyone except for those who want to use the SM.

Naturally all tests must also be run with the SM disabled and enabled to catch any policy violations.

Here is my very basic one which allows JMX and connecting to Graphite:

grant {
   // java.security.AccessControlException: access denied ("javax.management.MBeanPermission" "-#-[-]" "queryNames")
   permission javax.management.MBeanPermission "*", "queryNames";
   // org.jmxtrans.agent.Query - Failed to fetch attribute for 'java.lang:type=Memory'#HeapMemoryUsage, exception: access denied ("javax.management.MBeanPermission" "sun.management.MemoryImpl#HeapMemoryUsage[java.lang:type=Memory]" "getAttribute")
   permission javax.management.MBeanPermission "*", "getAttribute";
   // java.security.AccessControlException: access denied ("java.net.SocketPermission" "193.11.30.134:2003" "connect,resolve")
   permission java.net.SocketPermission "*", "connect,resolve";
};

Here are some docs on SM and the policy files but I'm sure you can find better tutorials out there:
https://docs.oracle.com/javase/8/docs/api/index.html?java/lang/SecurityManager.html
https://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant