-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Correct file ownership on node reconfiguration #82789
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
Conversation
When running elasticsearch-reconfigure-node to allow a node that was installed via a package(RPM/DEB) to enroll to an existing secured cluster, we should ensure that the file ownership is proper so that elasticsearch can actually read the files when it starts after reconfiguration. This commits sets the group owner of the keystore files to `elasticsearch` which is the group that we create during installation.
Pinging @elastic/es-security (Team:Security) |
@jkakavas Please verify my understanding:
For me, assuming the tools is run as root, while changing the group owner of the files it creates, is the least preferred option. NB: I'm OK with this approach as well, but when we document it we must say that this assumes the instalation is owned by root and group owned by |
That is correct. This is what is happening with the changes of this PR
Apologies, I didn't follow this.
The files are meant to be owned by root and group owned by elasticsearch. There is no single user with which the tool can be run so that it produces such an ownership on its own.
you mean run this as root but with
We'd need to document that this tool assumes that it's being run immediately after an installation and that it needs to be run as root ( all of our CLI tools have the same requirements in packaged installations due to dir/file ownership ) of a package ( which implies the above ) but I'm ++ to describe this more explicitly. |
In other words, I dislike that the tool hardcodes the ownership of the files that it generates.
Yes, that's what I mean. The command has to be invoked with sudo anyway. I don't see why being explicit with This new code is somewhere between an install script and a cmd line utility. It is not invoked by the system package-manager in the root context, during the install (so it is not 100% an install script), but as you say, we ought document that this be manually invoked only after an install (so if it always follows an install, it is part of an install, hence it is an install script). I think the above to me sounds closer to a cmd line utility (which shouldn't hardcode file ownership), while to you it sounds closer to an install script (where it is fine to hardcode it). I believe this is what we're arguing around. |
Therefore, I'm OK with the proposed change, if what we're building here is an install script in disguise (because it's not quite a "script"), and we document it as such. My suggestion is that we don't have to do that, that we instead can consider this a regular cmd line tool that has to be invoked with |
I don't feel strongly about this tbh.. I'll bring in @bytebilly for an extra opinion and some insights about the user experience. In essence, the options are two:
|
I'm a bit hesitant to require running sudo with If the problem is hardcoding the |
We are hardcoding this in the package installation script too, this is why I felt it is ok to do this here. I think @albertzaharovits did an awesome job at capturing my mental model without even discussing it, I consider this a continuation of the installation process, thus in my mind this is ok to do |
Thanks for the deliberation @jkakavas , and thanks for the input @bytebilly ! |
@elasticmachine update branch |
When running elasticsearch-reconfigure-node to allow a node that was installed via a package(RPM/DEB) to enroll to an existing secured cluster, we should ensure that the file ownership is proper so that elasticsearch can actually read the files when it starts after reconfiguration. This commits sets the group owner of the keystore files to `elasticsearch` which is the group that we create during installation.
💚 Backport successful
|
When running elasticsearch-reconfigure-node to allow a node that was installed via a package(RPM/DEB) to enroll to an existing secured cluster, we should ensure that the file ownership is proper so that elasticsearch can actually read the files when it starts after reconfiguration. This commits sets the group owner of the keystore files to `elasticsearch` which is the group that we create during installation.
When running elasticsearch-reconfigure-node to allow a node that
was installed via a package(RPM/DEB) to enroll to an existing
secured cluster, we should ensure that the file ownership is
proper so that elasticsearch can actually read the files when it
starts after reconfiguration.
This commits sets the group owner of the keystore files to
elasticsearch
which is the group that we create duringinstallation.
Partly resolves #80990