Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enable capabilities to itk #1687

Merged
merged 3 commits into from
Dec 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,54 @@ Installs and manages [`mod_info`][], which provides a comprehensive overview of

Default: `true`.

##### Class: `apache::mod::itk`

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/)

**Parameters**:

* `startservers`: The number of child server processes created on startup.

Values: Integer.

Default: `8`.

* `minspareservers`: The desired minimum number of idle child server processes.

Values: Integer.

Default: `5`.

* `maxspareservers`: The desired maximum number of idle child server processes.

Values: Integer.

Default: `20`.

* `serverlimit`: The maximum configured value for MaxRequestWorkers for the lifetime of the Apache httpd process.

Values: Integer.

Default: `256`.

* `maxclients`: The limit on the number of simultaneous requests that will be served.

Values: Integer.

Default: `256`.

* `maxrequestsperchild`: The limit on the number of connections that an individual child server process will handle.

Values: Integer.

Default: `4000`.

* `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.

Values: Boolean.

Default: `undef`.

##### Class: `apache::mod::jk`

Installs and manages `mod_jk`, a connector for Apache httpd redirection to old versions of TomCat and JBoss
Expand Down
1 change: 1 addition & 0 deletions manifests/mod/itk.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$serverlimit = '256',
$maxclients = '256',
$maxrequestsperchild = '4000',
$enablecapabilities = undef,
$apache_version = undef,
) {
include ::apache
Expand Down
62 changes: 62 additions & 0 deletions spec/classes/mod/itk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/itk.load") }

it { is_expected.to contain_package("apache2-mpm-itk") }

context "with enablecapabilities set" do
let :params do
super().merge({:enablecapabilities => true})
end

it { is_expected.not_to contain_file('/etc/apache2/mods-available/itk.conf').with_content(
/EnableCapabilities/) }
end
end

context "with Apache version >= 2.4" do
Expand All @@ -53,6 +62,11 @@
})
}
it { is_expected.to contain_file("/etc/apache2/mods-enabled/itk.load").with_ensure('link') }

context "with enablecapabilities not set" do
it { is_expected.not_to contain_file('/etc/apache2/mods-available/itk.conf').with_content(
/EnableCapabilities/) }
end
end
end
context "on a RedHat OS" do
Expand Down Expand Up @@ -84,6 +98,15 @@
'require' => 'Package[httpd]',
})
}

context "with enablecapabilities set" do
let :params do
super().merge({:enablecapabilities => 'On'})
end

it { is_expected.not_to contain_file('/etc/httpd/conf.d/itk.conf').with_content(
/EnableCapabilities/) }
end
end

context "with Apache version >= 2.4" do
Expand All @@ -102,6 +125,15 @@
'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n"
})
}

context "with enablecapabilities set" do
let :params do
super().merge({:enablecapabilities => false})
end

it { is_expected.to contain_file('/etc/httpd/conf.d/itk.conf').with_content(
/EnableCapabilities Off/) }
end
end
end
context "on a FreeBSD OS" do
Expand All @@ -126,5 +158,35 @@
it { is_expected.not_to contain_apache__mod('itk') }
it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/itk.conf").with_ensure('file') }
it { is_expected.to contain_package("www/mod_mpm_itk") }

context "with Apache version < 2.4" do
let :params do
{
:apache_version => '2.2',
}
end

context "with enablecapabilities not set" do
it { is_expected.not_to contain_file('/usr/local/etc/apache24/Modules/itk.conf').with_content(
/EnableCapabilities/) }
end
end

context "with Apache version >= 2.4" do
let :params do
{
:apache_version => '2.4',
}
end

context "with enablecapabilities set" do
let :params do
super().merge({:enablecapabilities => true})
end

it { is_expected.to contain_file('/usr/local/etc/apache24/Modules/itk.conf').with_content(
/EnableCapabilities On/) }
end
end
end
end
3 changes: 3 additions & 0 deletions templates/mod/itk.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
ServerLimit <%= @serverlimit %>
MaxClients <%= @maxclients %>
MaxRequestsPerChild <%= @maxrequestsperchild %>
<%- if (not @enablecapabilities.nil?) && (scope.function_versioncmp([@_apache_version, '2.4']) >= 0) -%>
EnableCapabilities <%= scope.function_bool2httpd([@enablecapabilities]) %>
<%- end -%>
</IfModule>