Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove unnecessary GetImpersonationLevel in childs
The base class CLICommand implements the GetImpersonationLevel method to always return ImpersonateIcinga. This method was overridden in some child classes with the exact same implementation.
As this is both unnecessary and I am planning to rewrite the base class implementation, these overridden methods were removed. Now there is only the base implementation and one child with another ImpersonationLevel
left.
Dynamic ImpersonationLevel via --no-impersonate flag
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.
Closes #10307.
Closes #10308.