-
Notifications
You must be signed in to change notification settings - Fork 24.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
Verify Elasticsearch Docker container writes on plugin installation #69533
Comments
Pinging @elastic/es-delivery (Team:Delivery) |
💡An idea to keep consistency Then, user running Elasticsearch Docker container would be able to supply just one bind mount to the Docker container. |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
👍 from me on making the plugins directory configurable. Ping @rjernst / @mark-vieira for their thoughts. |
I should note that there's also an issue with the docs, since we ought to instruct users to bind-mount |
I don't have strong feelings about that, it's really a core/infra issue.
Right, this seems like the core issue here, which is missing documentation when running the container as user other than root. We might also want to ensure we have packaging test coverage for this scenario. |
The plugins directory used to be configurable long ago. We intentionally moved away from that. But it can still be a symlink. I don't think we should add back the configuration option. |
@rjernst do you recall what were the rationale behind not having that path configurable? |
Conceptually, plugins are libraries that Elasticsearch depends on as opposed to user data for which it makes sense for their location to be user-configurable. We don't allow users to relocate the core Elasticsearch JARs and modules, and we want to treat plugins the same. It's a packaging and execution simplification. I'd personally prefer that we remove even the ability for this to be a symlink than we make this user configurable. |
The difference though is that plugins are installed by the user, which places them somewhere between user data and program data. I don't know if that's a sufficiently meaningful distinction to matter, but it makes sense that a Docker user could regard the |
Would a docker user treat installed packages in the OS as non-ephemeral? That is the closest thing to plugins. They are, IMO, part of the image, whether they are installed on the fly or baked in. We make no guarantees one could install on one instance and the directory would be portable to another. Coming back to the original problem: can this be fixed by changing the permissions on launching of the docker image which I believe we have done in other cases? It seems related to docker alone, in that it has this special ability to run as a different uid/gid. |
This is an important point I think. Making this configurable/relocatable I think brings along all sorts of other implications and opens the ability for use cases we don't explicitly support. |
Yeah, I'm with @rjernst here. How they are loaded doesn't place them between user data and program data. They are still program data, they just happen to be loaded through explicit user interaction. |
Alrighty then. I'll update the Docker docs to cover plugins. |
If we consider plugins as part of the image, shouldn't plugin installation just work when using the docker image, regardless of the user and group it's started with? What's the reason behind restricting write access to the plugins directory in the container? AFAIK if ES is compromised and the security manager bypassed wouldn't one still be able to write to the plugins directory (as everything is running with the same user in docker)? I can understand the concern in a non docker world, where a malicious user, other than the one running ES on the machine could compromise ES by installing a plugin. In a docker world, such a user would have to have access to docker AFAIK at which point I don't think there's any protection that could be added at the container level. Could this be solved by making the plugins directory world writable in the docker image only? |
That'd clearly do the trick here. |
@mieciu is this still an issue? |
I believe so:
|
@pugnascotia what is the status of this bug? Its affecting Visa and is one of the "thousand paper cuts" that is slowly killing them. Any updates? |
I'm not sure there is still an existing issue here. As I see it using |
Mark is right, a user has 3 options:
If none of these options are working for a particular user, then we'd like to know more. |
Thanks guys.
…On Fri, Jan 14, 2022 at 2:13 AM Rory Hunter ***@***.***> wrote:
Mark is right, a user has 3 options:
- Create their own images on top of ours, with added plugins
- Add --group-add 0 when running the image
- Bind-mount the plugins directory (for which I'll update the docs)
If none of these options are working for a particular user, then we'd like
to know more.
—
Reply to this email directly, view it on GitHub
<#69533 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHB3YGE3LUSAQ6LF34WESFLUV7ZLLANCNFSM4YEQBL3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
--
*Elastic: Search. Observe. Protect.*
Robert Statsinger | Principal Solutions Architect | www.elastic.co
Self-schedule a meeting with me using Calendly
<https://calendly.com/robert-statsinger/meeting-with-robert-statsinger>
|
Closes #69533. The Docker docs mention bind-mounting the `config`, `data` and `logs` directories when using an arbitrary UID / GID, but they fail to mention that the `plugins` dir must also be mounted in order to install plugins.
Closes #69533. The Docker docs mention bind-mounting the `config`, `data` and `logs` directories when using an arbitrary UID / GID, but they fail to mention that the `plugins` dir must also be mounted in order to install plugins.
Closes #69533. The Docker docs mention bind-mounting the `config`, `data` and `logs` directories when using an arbitrary UID / GID, but they fail to mention that the `plugins` dir must also be mounted in order to install plugins.
@pugnascotia I think there's one other option which is to use a tmpfs mount for |
I suppose not, aside from the startup cost of downloading and installing the plugins on every container restart. |
In general I think that's okay since in-place container restarts are expected to be rare events. |
@pugnascotia I want to call something out here from the cloud end -
|
GID 0 is not the same as UID 0, and has no special privileges associated with it. It's become a common convention in container orchestration to default to GID 0 unless otherwise configured e.g. Kubernetes' runAsGroup option. If none of these options work for you, can you suggest any alternatives that would, and we can discuss? Given that GID 0 isn't special, and that we own the orchestration, using |
@Kushmaro If a consumer of a Docker container (whether that be us orchestrating containers on behalf of users, or an end-user) chooses to deploy a container with That is, Elasticsearch can not get around the fact that it needs to write data somewhere. What Elasticsearch can do is make clear (via documentation) the volumes that it needs mounted to write data to (e.g., |
Elasticsearch version:
8.0.0-SNAPSHOT
OS version: Docker container
When running Elasticsearch Docker container with an arbitrary UID/GID it's impossible to install a plugin:
According to docs, there is a handy workaround for this - since
/usr/share/elasticsearch
is group-writable user can leverage the--group-add 0
option.That is described as a desired way to go unless you bind-mount config/data/logs directory. The
./bin/elasticsearch-plugin
tool however, writes outside of those locations.The text was updated successfully, but these errors were encountered: