-
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
Plugin Installation Permissions Issue #40969
Comments
Pinging @elastic/es-core-infra |
Any news? |
We do this so that we can ensure proper permissions when these directories are created. There may be an improvement here where we set the attributes when creating the directory but that is not going to resolve the issue here. The issue in this setup is that the bitnami image uses root:root for owner and group of the config directory. The plugin installation creates the repository-s3 directory within the configuration directory and attempts to set the owner and permissions of the repository-s3 directory to be the same as those on the config directory. Changing the owner from |
Hi @jaymode Thanks so much for your response! I am a Bitnami developer and I am trying to make this image compatible with OpenShift. OpenShift launches containers with a random non-root user (see https://docs.openshift.com/container-platform/3.3/creating_images/guidelines.html#openshift-container-platform-specific-guidelines, Support Arbitrary User IDs section). Therefore, I cannot assume the user running the container is That's the reason why we add the "non-root" user to the "root" group so we can provide the required permissions to the group. I do not really understand why the owner of each plugin directory must be the same as the one used in the parent directory. I mean, from a "Unix permissions point of view", the user running ElasticSearch has the required permissions even if the owner of the directory is different. |
Hi @jaymode, did you see my last comment? |
Ping @jaymode |
I looked into fixing this and ran into some issues that make a proper fix a much larger problem than just whether or not we change permissions when installing the plugin. The issue is that our default packages do not allow for group writes to the bin, plugin, and config directories. While we could make a smaller change that would enable this use case, I have concerns regarding how such a change would impact different installations and whether allowing a group to write to these directories is the right way forward. There are security implications if the Java Security Manager is bypassed for file system access that could allow a compromised elasticsearch process itself to write a plugin or modify configuration. |
Sorry for the late response @jaymode So, you don't see other alternative rather than configuring the ownership of the folder(s) so the user running ElasticSearch is the owner, do you? |
We have the same issue with ECK. |
Exactly @barkbay Any platform with those requirements (random and not privileged user) will face this issue. |
The original reproduction line provided no longer works:
Furthermore, I believe our more-or-less official advice on plugins for docker containers is:
Since this ticket no longer has a working reproduction line and we don't have any plans to change our security settings, I am going to close this ticket. Please feel free to re-open it or file a new ticket if there is another way of reproducing the problem and the custom-image approach doesn't work for your use case. |
Elasticsearch is unable to install plugins when the plugin requires to install certain configuration (e.g.
repository-s3
) in the config directory.It complains of lacking the corresponding permissions to write in the directory even when the permissions are correct.
Elasticsearch version: 5.6.15
Plugins installed: repository-s3
JVM version: 1.8.201
OS version: Debian 9
Description of the problem including expected versus actual behavior:
I'm using Bitnami ElasticSearch Docker Image which allows to install plugins (using
elasticsearch-plugin install
command) during the bootstrap of the container by listing them in the env. variable "ELASTICSEARCH_PLUGINS".This image is a non-root container (it runs as user
1001
by default) and it uses the directory /opt/bitnami/elasticsearch/config as "config dir". By default, this directory has the permissions configuration below:Please note that the user running the "install plugin command" (the user 1001) belongs to the "root" group and, therefore, it has permissions to write on that directory. You can check it running the command below:
$ docker run --rm bitnami/elasticsearch:6 /bin/bash -c 'mkdir /opt/bitnami/elasticsearch/config/new-directory && ls -la /opt/bitnami/elasticsearch/config'
However, Elasticsearch complains of lacking permissions when trying to install the plugin (see provided logs).
I think the reason might be related to the code below:
https://github.com/elastic/elasticsearch/blob/master/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java#L915
For some reason I don't understand, the
elasticsearch-plugin install
command tries to modify the ownership of the "config dir" and then, it complains about being unable to create therepository-s3
directory even having the proper permissions!Steps to reproduce:
Run the command below:
Provide logs (if relevant):
The text was updated successfully, but these errors were encountered: