Skip to content
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

Only activate groups for users with passwd entry #10308

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rezemble
Copy link

Addresses #10307 - enables running Icinga with arbitrary UIDs

Copy link

cla-bot bot commented Jan 18, 2025

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @rezemble

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for using Icinga and creating this Pull Request.

Next to my comments in your issue #10307, I am a bit unsure about the proposed changes. This code would result in skipping the user impersonation (which is a kind of dropping privileges) if the configured user does not exists in the system's user database without any notice.

<< "Please re-run this command as a privileged user or using the \"" << user << "\" account.";
return EXIT_FAILURE;
}
// only respect groups if there exists a passwd entry for the current user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment does not represent what actually happens in the following block.

pw is populated by getpwnam(3) on Configuration::RunAsUser, defaulting to icinga2 or nagios (on Debian), but can be overwritten both during compile and runtime via ICINGA2_USER. Thus, if such a user is present in the user database, this if block is being accessed.

I only see one group-related code within, and this is the initgroups(3) call based on the user name and pw->pw_gid. Does this fail for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants