Skip to content

[FPM] Apply pool group when numeric user has no passwd entry - #292

Open
iliaal wants to merge 1 commit into
PHP-8.4from
fix/fpm-numeric-uid-gid-zero-84
Open

[FPM] Apply pool group when numeric user has no passwd entry#292
iliaal wants to merge 1 commit into
PHP-8.4from
fix/fpm-numeric-uid-gid-zero-84

Conversation

@iliaal

@iliaal iliaal commented Aug 24, 2026

Copy link
Copy Markdown
Owner

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.

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>
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.

1 participant