Skip to content

Commit 2c7e2c7

Browse files
authored
Merge pull request puppetlabs#1687 from MiamiOH/add_enable_capabilities_to_itk
Add enable capabilities to itk
2 parents 7e54d87 + c274ae5 commit 2c7e2c7

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,54 @@ Installs and manages [`mod_info`][], which provides a comprehensive overview of
21612161

21622162
Default: `true`.
21632163

2164+
##### Class: `apache::mod::itk`
2165+
2166+
Installs and manages [`mod_itk`][], which is an (MPM) that is loaded and configured for the HTTPD process. [official documentation](http://mpm-itk.sesse.net/)
2167+
2168+
**Parameters**:
2169+
2170+
* `startservers`: The number of child server processes created on startup.
2171+
2172+
Values: Integer.
2173+
2174+
Default: `8`.
2175+
2176+
* `minspareservers`: The desired minimum number of idle child server processes.
2177+
2178+
Values: Integer.
2179+
2180+
Default: `5`.
2181+
2182+
* `maxspareservers`: The desired maximum number of idle child server processes.
2183+
2184+
Values: Integer.
2185+
2186+
Default: `20`.
2187+
2188+
* `serverlimit`: The maximum configured value for MaxRequestWorkers for the lifetime of the Apache httpd process.
2189+
2190+
Values: Integer.
2191+
2192+
Default: `256`.
2193+
2194+
* `maxclients`: The limit on the number of simultaneous requests that will be served.
2195+
2196+
Values: Integer.
2197+
2198+
Default: `256`.
2199+
2200+
* `maxrequestsperchild`: The limit on the number of connections that an individual child server process will handle.
2201+
2202+
Values: Integer.
2203+
2204+
Default: `4000`.
2205+
2206+
* `enablecapabilities`: Drop most root capabilities in the parent process, and instead run as the user given by the User/Group directives with some extra capabilities (in particular setuid). Somewhat more secure, but can cause problems when serving from filesystems that do not honor capabilities, such as NFS.
2207+
2208+
Values: Boolean.
2209+
2210+
Default: `undef`.
2211+
21642212
##### Class: `apache::mod::jk`
21652213

21662214
Installs and manages `mod_jk`, a connector for Apache httpd redirection to old versions of TomCat and JBoss

manifests/mod/itk.pp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
$serverlimit = '256',
66
$maxclients = '256',
77
$maxrequestsperchild = '4000',
8+
$enablecapabilities = undef,
89
$apache_version = undef,
910
) {
1011
include ::apache

spec/classes/mod/itk_spec.rb

+62
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@
3434
it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/itk.load") }
3535

3636
it { is_expected.to contain_package("apache2-mpm-itk") }
37+
38+
context "with enablecapabilities set" do
39+
let :params do
40+
super().merge({:enablecapabilities => true})
41+
end
42+
43+
it { is_expected.not_to contain_file('/etc/apache2/mods-available/itk.conf').with_content(
44+
/EnableCapabilities/) }
45+
end
3746
end
3847

3948
context "with Apache version >= 2.4" do
@@ -53,6 +62,11 @@
5362
})
5463
}
5564
it { is_expected.to contain_file("/etc/apache2/mods-enabled/itk.load").with_ensure('link') }
65+
66+
context "with enablecapabilities not set" do
67+
it { is_expected.not_to contain_file('/etc/apache2/mods-available/itk.conf').with_content(
68+
/EnableCapabilities/) }
69+
end
5670
end
5771
end
5872
context "on a RedHat OS" do
@@ -84,6 +98,15 @@
8498
'require' => 'Package[httpd]',
8599
})
86100
}
101+
102+
context "with enablecapabilities set" do
103+
let :params do
104+
super().merge({:enablecapabilities => 'On'})
105+
end
106+
107+
it { is_expected.not_to contain_file('/etc/httpd/conf.d/itk.conf').with_content(
108+
/EnableCapabilities/) }
109+
end
87110
end
88111

89112
context "with Apache version >= 2.4" do
@@ -102,6 +125,15 @@
102125
'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n"
103126
})
104127
}
128+
129+
context "with enablecapabilities set" do
130+
let :params do
131+
super().merge({:enablecapabilities => false})
132+
end
133+
134+
it { is_expected.to contain_file('/etc/httpd/conf.d/itk.conf').with_content(
135+
/EnableCapabilities Off/) }
136+
end
105137
end
106138
end
107139
context "on a FreeBSD OS" do
@@ -126,5 +158,35 @@
126158
it { is_expected.not_to contain_apache__mod('itk') }
127159
it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/itk.conf").with_ensure('file') }
128160
it { is_expected.to contain_package("www/mod_mpm_itk") }
161+
162+
context "with Apache version < 2.4" do
163+
let :params do
164+
{
165+
:apache_version => '2.2',
166+
}
167+
end
168+
169+
context "with enablecapabilities not set" do
170+
it { is_expected.not_to contain_file('/usr/local/etc/apache24/Modules/itk.conf').with_content(
171+
/EnableCapabilities/) }
172+
end
173+
end
174+
175+
context "with Apache version >= 2.4" do
176+
let :params do
177+
{
178+
:apache_version => '2.4',
179+
}
180+
end
181+
182+
context "with enablecapabilities set" do
183+
let :params do
184+
super().merge({:enablecapabilities => true})
185+
end
186+
187+
it { is_expected.to contain_file('/usr/local/etc/apache24/Modules/itk.conf').with_content(
188+
/EnableCapabilities On/) }
189+
end
190+
end
129191
end
130192
end

templates/mod/itk.conf.erb

+3
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
ServerLimit <%= @serverlimit %>
66
MaxClients <%= @maxclients %>
77
MaxRequestsPerChild <%= @maxrequestsperchild %>
8+
<%- if (not @enablecapabilities.nil?) && (scope.function_versioncmp([@_apache_version, '2.4']) >= 0) -%>
9+
EnableCapabilities <%= scope.function_bool2httpd([@enablecapabilities]) %>
10+
<%- end -%>
811
</IfModule>

0 commit comments

Comments
 (0)