File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2248,6 +2248,9 @@ documented here: http://php.net/manual/en/install.fpm.configuration.php.
22482248[ * group* ]
22492249 The group that php-fpm should run as
22502250
2251+ [ * apparmor_hat* ]
2252+ The Apparmor hat to use
2253+
22512254[ * pm* ]
22522255
22532256[ * pm_max_children* ]
Original file line number Diff line number Diff line change 3030# [*group*]
3131# The group that php-fpm should run as
3232#
33+ # [*apparmor_hat*]
34+ # The Apparmor hat to use
35+ #
3336# [*pm*]
3437#
3538# [*pm_max_children*]
127130 $listen_mode = undef ,
128131 $user = $php::fpm::config::user,
129132 $group = $php::fpm::config::group,
133+ Optional[String[1]] $apparmor_hat = undef ,
130134 $pm = ' dynamic' ,
131135 $pm_max_children = ' 50' ,
132136 $pm_start_servers = ' 5' ,
Original file line number Diff line number Diff line change 239239 it { is_expected . to contain_file ( dstfile ) . with_content ( %r{group = nginx} ) }
240240 end
241241
242+ describe 'when configured with a pool with apparmor_hat parameter' do
243+ let ( :params ) { { fpm_pools : { 'www' => { 'apparmor_hat' => 'www' } } } }
244+
245+ it { is_expected . to contain_php__fpm__pool ( 'www' ) . with ( apparmor_hat : 'www' ) }
246+
247+ dstfile = case facts [ :osfamily ]
248+ when 'Debian'
249+ case facts [ :os ] [ 'name' ]
250+ when 'Debian'
251+ case facts [ :os ] [ 'release' ] [ 'major' ]
252+ when '10'
253+ '/etc/php/7.3/fpm/pool.d/www.conf'
254+ when '9'
255+ '/etc/php/7.0/fpm/pool.d/www.conf'
256+ else
257+ '/etc/php5/fpm/pool.d/www.conf'
258+ end
259+ when 'Ubuntu'
260+ case facts [ :os ] [ 'release' ] [ 'major' ]
261+ when '18.04'
262+ '/etc/php/7.2/fpm/pool.d/www.conf'
263+ when '16.04'
264+ '/etc/php/7.0/fpm/pool.d/www.conf'
265+ else
266+ '/etc/php5/fpm/pool.d/www.conf'
267+ end
268+ end
269+ when 'Archlinux'
270+ '/etc/php/php-fpm.d/www.conf'
271+ when 'Suse'
272+ '/etc/php5/fpm/pool.d/www.conf'
273+ when 'RedHat'
274+ '/etc/php-fpm.d/www.conf'
275+ when 'FreeBSD'
276+ '/usr/local/etc/php-fpm.d/www.conf'
277+ end
278+
279+ it { is_expected . to contain_file ( dstfile ) . with_content ( %r{apparmor_hat = www} ) }
280+ end
281+
242282 describe 'when fpm is disabled' do
243283 let ( :params ) { { fpm : false } }
244284
Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ listen.mode = <%= @listen_mode %>
4646user = <%= @user %>
4747; RPM: Keep a group allowed to write in log dir.
4848group = <%= @group_final %>
49+ <% if @apparmor_hat -%>
50+ ; Apparmor hat to change to
51+ apparmor_hat = <%= @apparmor_hat %>
52+ <% end -%>
4953
5054; Choose how the process manager will control the number of child processes.
5155; Possible Values:
You can’t perform that action at this time.
0 commit comments