Bug #80669 [Opn->Csd]: Can't initgroups() when specifying numeric user

From: Date: Wed, 23 Nov 2022 10:41:36 +0000
Subject: Bug #80669 [Opn->Csd]: Can't initgroups() when specifying numeric user
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242884@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80669&edit=1

 ID:                 80669
 Updated by:         git@php.net
 Reported by:        andreas dot ley at kit dot edu
 Summary:            Can't initgroups() when specifying numeric user
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            FPM related
 Operating System:   Debian GNU/Linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of bukka
Revision: https://github.com/php/php-src/commit/94702c56e0cc98166b12ebc202e6aebf08b12b5e
Log: Fix bug #80669: FPM numeric user fails to set groups


Previous Comments:
------------------------------------------------------------------------
[2021-01-25 16:49:48] andreas dot ley at kit dot edu

Description:
------------
When using PHP-FPM, you can configure the "user" directive for a pool with either an
(alphanumeric) username or a (numeric) uid. However, if you do the latter, initgroups() won't
set supplementary groups.

This is due to fpm_unix_init_child() in sapi/fpm/fpm/fpm_unix.c calling
"initgroups(wp->config->user, wp->set_gid)".

One possible solution would be changing this to "initgroups(wp->user, wp->set_gid)"
which would require to set wp->user from getpwuid(wp->set_uid) in fpm_unix_conf_wp() in the
very same file, which currently is only done when is_root is false.

One objection could be that a uid might not be unique, but the same applies to the non-root case.
Another possibility then might be an explicit configuration directive for supplementary groups.

If you decide to go for the first solution, I'd volunteer to write a patch for that upon
request.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80669&edit=1


Thread (3 messages)

« previous php.bugs (#242884) next »