Bug #80669 [NEW]: Can't initgroups() when specifying numeric user

From: Date: Mon, 25 Jan 2021 16:49:48 +0000
Subject: Bug #80669 [NEW]: Can't initgroups() when specifying numeric user
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231765@lists.php.net to get a copy of this message
From:             andreas dot ley at kit dot edu
Operating system: Debian GNU/Linux
PHP version:      Irrelevant
Package:          *Configuration Issues
Bug Type:         Bug
Bug description:Can't initgroups() when specifying numeric user

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 bug report at https://bugs.php.net/bug.php?id=80669&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80669&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80669&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80669&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80669&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80669&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80669&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80669&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80669&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80669&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80669&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80669&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80669&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80669&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80669&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80669&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80669&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80669&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#231765) next »