blob: f39c526418c3b477b6a5bb4372aa70b756f6dbb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
--TEST--
FPM: Test Unix Domain Socket with Posix ACL
--SKIPIF--
<?php
include "skipif.inc";
if (!(file_exists('/usr/bin/getfacl') && file_exists('/etc/passwd') && file_exists('/etc/group'))) die ("skip missing getfacl command");
?>
--XFAIL--
Mark as XFAIL because --with-fpm-acl is not enabled in default build
--FILE--
<?php
include "include.inc";
$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
$socket = dirname(__FILE__).'/php-fpm.sock';
// Select 3 users and 2 groups known by system (avoid root)
$users = $groups = [];
$tmp = file('/etc/passwd');
for ($i=1 ; $i<=3 ; $i++) {
$tab = explode(':', $tmp[$i]);
$users[] = $tab[0];
}
$users = implode(',', $users);
$tmp = file('/etc/group');
for ($i=1 ; $i<=2 ; $i++) {
$tab = explode(':', $tmp[$i]);
$groups[] = $tab[0];
}
$groups = implode(',', $groups);
$cfg = <<<EOT
[global]
error_log = $logfile
[unconfined]
listen = $socket
listen.acl_users = $users
listen.acl_groups = $groups
listen.mode = 0600
ping.path = /ping
ping.response = pong
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
EOT;
$fpm = run_fpm($cfg, $tail);
if (is_resource($fpm)) {
fpm_display_log($tail, 2);
try {
var_dump(strpos(run_request('unix://'.$socket, -1), 'pong'));
echo "UDS ok\n";
} catch (Exception $e) {
echo "UDS error\n";
}
passthru("/usr/bin/getfacl -cp $socket");
proc_terminate($fpm);
echo stream_get_contents($tail);
fclose($tail);
proc_close($fpm);
}
?>
--EXPECTF--
[%s] NOTICE: fpm is running, pid %d
[%s] NOTICE: ready to handle connections
int(%d)
UDS ok
user::rw-
user:%s:rw-
user:%s:rw-
user:%s:rw-
group::---
group:%s:rw-
group:%s:rw-
mask::rw-
other::---
[%s] NOTICE: Terminating ...
[%s] NOTICE: exiting, bye-bye!
--CLEAN--
<?php
$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
@unlink($logfile);
?>
|