php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72575 Using --allow-to-run-as-root should ignore missing user directive
Submitted: 2016-07-11 10:53 UTC Modified: 2016-07-11 10:53 UTC
From: gooh@php.net Assigned: gooh
Status: Closed Package: FPM related
PHP Version: 7.1.0alpha1 OS:
Private report: No CVE-ID:
 [2016-07-11 10:53 UTC] gooh@php.net
Description:
------------
Trying to start PHP-FPM with the --allow-to-run-as-root flag will not work when the user directive is not given in the FPM worker pool configuration. Parsing the config will fail. Consequently, FPM cannot start.

The offending code is in /master/sapi/fpm/fpm/fpm_conf.c:

766		/* alert if user is not set only if we are not root*/
767		if (!wp->config->user && !geteuid()) {
768			zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name);
769			return -1;
770		}

On a side note: the comment is wrong (should be "if we are root").

Related https://bugs.php.net/bug.php?id=61295

Test script:
---------------
Comment the user directive in a worker pool confing. Then try to start php-fpm as root.

Actual result:
--------------
root@4d9ea34ff691:/var/www/html# php-fpm -D
[11-Jul-2016 08:27:46] ALERT: [pool www] user has not been defined
[11-Jul-2016 08:27:46] ERROR: failed to post process the configuration
[11-Jul-2016 08:27:46] ERROR: FPM initialization failed

Patches

72575 (last revision 2016-07-11 11:54 UTC) by gooh@php.net)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-11 10:53 UTC] gooh@php.net
-Assigned To: +Assigned To: gooh
 [2016-07-11 11:54 UTC] gooh@php.net
The following patch has been added/updated:

Patch Name: 72575
Revision:   1468238058
URL:        https://bugs.php.net/patch-display.php?bug=72575&patch=72575&revision=1468238058
 [2016-07-12 08:38 UTC] jpauli@php.net
Automatic comment on behalf of gooh
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fb49f137ecdec2c6273ee8acf6a34ce98f503eab
Log: Fix #72575: using --allow-to-run-as-root should ignore missing user directive
 [2016-07-12 08:38 UTC] jpauli@php.net
-Status: Assigned +Status: Closed
 [2016-10-17 10:11 UTC] bwoebi@php.net
Automatic comment on behalf of gooh
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fb49f137ecdec2c6273ee8acf6a34ce98f503eab
Log: Fix #72575: using --allow-to-run-as-root should ignore missing user directive
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Jul 25 16:01:42 2017 UTC