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

Experiments with running ES with the entitlements agent enabled #115128

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Oct 18, 2024

Not looking to merge this; just making a PR for reviewability.

The headlines:

The bridge module now has an spi package

The bridge module has become a useful "leaf module" that everything can depend on to interoperate:

  • The api package is what instrumented code calls to perform the checks
    • Needed by the agent and the runtime
  • The spi package is what the agent uses to load its impl module
    • Needed by the agent and by org.elasticsearch.base, which needs access to any interfaces loaded by the embedded provider Gradle plugin

The bridge module itself has no dependencies.

ServerCLI changes

SystemJvmOptions.java now has a stanza for the entitlement command line options. It uses Files.newDirectoryStream to locate the jar file within the working directory. (We could probably calculate this statically instead if that's preferable, but the obstacle is that the jar file name contains the version number, like -9.0.0, which I wasn't sure how to access programmatically.)

Hacks

  • I had to comment out LogManager.getLogger in ModuleQualifiedExportsService

Refactoring

You might want to review this commit separately. It's a simpler, more uniform way to knit together groups of zero or more options.

@prdoyle prdoyle added >non-issue :Core/Infra/Core Core issues without another label labels Oct 18, 2024
@@ -69,3 +69,4 @@ testfixtures_shared/
# Generated
checkstyle_ide.xml
x-pack/plugin/esql/src/main/generated-src/generated/
x-pack/plugin/esql/gen
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this guy again.

@prdoyle
Copy link
Contributor Author

prdoyle commented Oct 18, 2024

Ok I'm getting unit test failures because the jar file doens't exist at the expected path. I guess looking at the filesystem to find the jars wasn't so smart after all.

java.nio.file.NoSuchFileException: ./lib/tools/entitlement-agent
	at __randomizedtesting.SeedInfo.seed([B9C9111FE4D76380:15830EB4CCA5F44C]:0)
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:461)
	at java.base/java.nio.file.Files.newDirectoryStream(Files.java:549)
	at org.elasticsearch.server.cli.SystemJvmOptions.findEntitlementComponent(SystemJvmOptions.java:156)
	at org.elasticsearch.server.cli.SystemJvmOptions.maybeEntitlementAgent(SystemJvmOptions.java:146)
	at org.elasticsearch.server.cli.SystemJvmOptions.systemJvmOptions(SystemJvmOptions.java:76)
	at org.elasticsearch.server.cli.JvmOptionsParserTests.testNodeProcessorsActiveCount(JvmOptionsParserTests.java:356)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >non-issue v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants