-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Confirm OpenSearch is running with a strongly configured JVM security manager by default #528
Comments
@mikemccand I took a look, it seems to be unconditionally enabled (also in tests). Look for calls to few notes about how it works from my memory:
|
I will try to do a pass on this stuff tonight and really confirm policies etc are good. cc @uschindler |
I can definitely say that in the main security policy the folowing lines are obsolete, according to: https://github.com/apache/lucene/blob/releases/lucene-solr%2F8.8.1/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java#L385 The other stuff there is from pre Java9 early access releases. This is IMHO obsolete:
The second one may be moved to tests. Lucene core no longer used ramusageestimator. |
BTW, the policy files have wrong license header, @nknize |
I took a pass through all the files (core policies mentioned above, and every If you are worried about network connectivity, you can just |
Opened PR #531 to fix the license header on the security policy files. |
Thanks @rmuir for looking into the policy files. I am taking a look into OpenSearch security (in general) to develop a better understanding and document it somewhere. Here are some of the initial findings. OpenSearch security initialization flow during bootstrap
OpenSearch w/ Java Security Manager
Other security constructs
|
@setiah yes, thats a great summary! To answer some of your questions:
I don't see a module/plugin for groovy scripts anymore. This is a very good thing. So that comment is just outdated/obselete. Looks to me like the only scripting languages here are Note: there's also a ClassLoader-based filtering mechanism, that can be used with scripts to filter which classes can be "seen", example: https://github.com/opensearch-project/OpenSearch/blob/main/modules/lang-expression/src/main/java/org/opensearch/script/expression/ExpressionScriptEngine.java#L197-L204 . You can see how the restrictions integrate into the policy: https://github.com/opensearch-project/OpenSearch/blob/main/modules/lang-expression/src/main/plugin-metadata/plugin-security.policy#L37-L44 . I just mention it as it doesn't actually depend on securitymanager, its really just a classloader thing. It just utilizes a custom permission (ClassPermission) for convenience/integration.
It is by design that core server should have least-privilege, and modules/plugins do any sketchy stuff that requires additional permissions. This keeps any elevated stuff contained to a smaller area (example: only networking module allowed to do network calls). Module/Plugin must declare it in their security file and properly use Given that securitymanager looks to be deprecated and removed from the jvm completely (unless someone complains): https://openjdk.java.net/jeps/411, other steps should to be taken to secure this thing IMO. I will list a few ideas, I realize these will likely be unpopular, but something must be done:
None of this stuff is easy, especially testing. And sandboxing with the OS is a lot harder than via security manager because you have to take care of JDK internals (what system calls does it make, what files does it use, etc). But I think its a bad idea to just remove security manager and do nothing at all and pretend like everything is OK :) |
Thanks @rmuir for providing this wealth of information and useful context.
Right, that's still happening for plugin installation reference
Interesting point on Security Manager deprecation and thanks for pointing this out. These are all great ideas, and probably we should dig deeper into each of these. This seems like a BIG topic in itself. Shall we create a separate issue "Security model for OpenSearch" to discuss path forward on this?
+1, I think authentication is a must have. Probably we can still keep authorization as optional (plugin-supported). WDYT? |
Closing this issue as confirmed by @rmuir that he does not see any issue. "I took a pass through all the files (core policies mentioned above, and every plugin-security.policy) and didn't see anything unexpected." |
Spinoff from #524:
The JVM security manager is an awesome security tool! It is effectively a self-imposed jail, allowing you to express what things your JVM process is and is not allowed to do. Tutorial: https://docs.oracle.com/javase/tutorial/essential/environment/security.html
I think Elasticsearch enabled the security manager by default, but I'm not certain. @rmuir might know?
For this issue let's 1) confirm we are still enabling the security manager by default, and 2) try to tighten its rules (how strong the jail is) based on OpenSearch specific changes like removing Elasticsearch's sneaky "phone home" feature.
This can improve future security by preventing certain categories of dangerous operations.
The text was updated successfully, but these errors were encountered: