[FPM] Apply pool group when numeric user has no passwd entry - #292
Open
iliaal wants to merge 1 commit into
Open
Conversation
fpm_unix_conf_wp() set set_uid for a numeric user= directive but only derived set_gid inside the getpwuid() success branch, so configuring a uid with no passwd entry dropped the process to that uid while keeping the root group (gid 0). Fall back to set_gid = set_uid in the no-entry case, matching the group branch which accepts a bare numeric gid. Sibling audit: the listen.owner numeric path is unaffected because socket_gid defaults to -1 (leave gid unchanged) rather than 0. Signed-off-by: Ilia Alshanetsky <ilia@ilia.ws>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In fpm_unix_conf_wp(), a numeric user= directive set set_uid but only derived set_gid inside the getpwuid() success branch, so configuring a uid that has no passwd entry dropped the FPM master and workers to that uid while leaving their group at gid 0 (root), creating a privilege gap. This adds an else branch setting set_gid to the configured uid when no passwd entry exists, mirroring how the numeric group= branch accepts a bare gid, so such pools run with a consistent uid/gid pair instead of retaining the root group. Sibling audit: the numeric listen.owner path is unaffected because socket_gid defaults to -1 (leave gid unchanged) rather than 0.