-
Notifications
You must be signed in to change notification settings - Fork 582
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
Allow running as arbitrary UID for unprivileged Container Environments (OpenShift) #10307
Comments
Thanks for creating this issue. Unless I am missing something, you cited code is about the user and not group switching logic.
After having taken a first look at your PR #10308, I followed the definition logic of Lines 225 to 234 in 866db3b
As verified below, icinga2 may run with the configured user and group.
Does this already help you with your OpenShift setup? Furthermore, how does your Icinag 2 container startup script look like? After switching/impersonating (or re-configuring) the desired user, this user needs access to the |
Thanks @oxzi for taking a look - unfortunately I don't think this alone solves the problem - the containers run with an arbitrary UID within a pre-set range that cannot be user-selected, and for said UID, no passwd entry exists, hence Edit: |
By default, icinga2 uses icinga:icinga as user and group, or whatever is configured via ICINGA2_USER and ICINGA2_GROUP. Thus, it is required to launch icinga2 as this user or as a privileged user, allowed to setuid. The only command where no user impersonation is necessary is "icinga2 console". However, in certain scenarios one cannot switch to a static user. There might also be the case that privileges are already dropped, e.g., by an init manager. Therefore, the "--no-impersonate" flag was introduced, skipping all impersonation logic. > $ icinga2 daemon critical/cli: Invalid group specified: icinga > $ icinga2 daemon --no-impersonate [2025-01-24 10:42:41 +0100] information/cli: Icinga application loader (version: v2.14.0-439-ga5980d362) Closes #10307.
Thanks for the input @oxzi - from what I can tell, this solves the issue - my tests run fine on your feature branch! |
Is your feature request related to a problem? Please describe.
In order to be able to run Icinga in a context with indeterminate User IDs, such as OpenShift, the group-injection logic from
icinga.cpp
seems to be an obstacle:Describe the solution you'd like
From my testing, activating additional groups in such a context is superfluous, since there are none; since the process is run as an arbitrary UID with GID 0, removing the
if (!pw) {
check and instead wrapping the group activating logic inworks fine
Describe alternatives you've considered
I've considered wrapping the image with dynamic user and group renaming, but this adds unnecessary complexity and image layers
The text was updated successfully, but these errors were encountered: