-
Notifications
You must be signed in to change notification settings - Fork 278
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
[Bug]: RPM packaging enforces insecure permissions and default config values #3262
Comments
[Triage] @peterzhuamazon Can you take a look? Thanks! |
Hi @dmz-uk thanks for the detailed post here. As for the 1st problem here, I used
And for files being 644 and the folders being 755, that is standard. I dont remember the exact reason now, but it might due to that this script in the security plugin still needs to modify things in /etc/opensearch. I do remember a PR was sent sometime before but could not find it. The 2nd problem is more complicated as we are using this spec file to also build rpms when Let me know what you think. Thanks. |
Thanks @peterzhuamazon your understanding is correct. Apologies for duplicating an existing issue, I'm used to working with packaging as its own primary truth, but I can see the intent is to wrapper the existing install. As for the 2nd problem, after all my nonsense it should be as simple as:
which might be sufficient, although it marks the entire of the plugin dir contents as config. Otherwise using the |
Yeah, your proposal is doable but the reason I didnt do that before is due to these reasons 😄
Let me know what you think. I am not against having this change as a result. Thanks. |
Hi @opensearch-project/security could you take a look again on opensearch-project/security#1465 once you have time? Thanks. |
@peterzhuamazon looks like security team has changed the permissions now. Does that help fix this issue? |
Hi, @dmz-uk , I am gonna close this issue for now as it has been a while no dialogues ... please do not hesitate to reopen it if still needed.. thanks again!! |
Describe the bug
This bug concerns the RPM packaging defined by
scripts/pkg/build_templates/opensearch/rpm/opensearch.rpm.spec
and consists of two related problems: default permissions (lack of%attr
) and lack of%config(noreplace)
on config files/dirs expected to be modified according to documentation.First problem:
The spec doesn't define default file/directory permissions in
%defattr
or in%attr
for any of the config files/dirs. This means that the RPM packaging is enforcing the permissions present on the build system, leading to the following enforced permissions in the package:This leads to a situation where the security plugin emits insecure permissions warnings on startup:
The configs will be reset to these permissions on package install/upgrade - any manual fix to secure defaults after install in production will be reset (potentially until a configuration manager corrects them again).
Second problem:
Subdirectories under
/etc/opensearch
have been defined in the spec with config files included under them. The configs are not marked as%config
or%config(noreplace)
, meaning that the default values are enforced on package upgrade. As of 2.6.0, these consist of:If any of these files are modified, those changes will be lost on package upgrade. Although it's understood that many are just used to import initial settings into the indexes, it might reasonably be expected that changes to at least some of these files persist after upgrade.
To reproduce
Install opensearch from RPM, either manually or via YUM repository.
Expected behavior
/etc/opensearch
in the RPM packaging.Sorry, I can't confirm corrections to the specfile as I don't have a build environment for this project, and I'm unsure of the intended behaviour of the plugin config settings on upgrade. Obviously setting
%defattr
has implications for all packaged files (especially Main dirs), so unfortunately it may require plugin subdirectories and files be specified individually in the spec. This leads to something like this (again, sorry, this is unconfirmed), which requires naming/splitting out plugin directories, which may make the packaging more brittle to change going forward:Screenshots
If applicable, add screenshots to help explain your problem.
Host / Environment
No response
Additional context
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: