Skip to content

Commit

Permalink
Add suexec support
Browse files Browse the repository at this point in the history
This adds the suexec_user_group parameter to vhost and introduces a
class apache::mod::suexec, which is included when the parameter is used.
  • Loading branch information
ekohl committed May 2, 2014
1 parent fe2d1be commit 9d2067c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
include ::apache::mod::mime
include ::apache::mod::mime_magic
include ::apache::mod::vhost_alias
include ::apache::mod::suexec
include ::apache::mod::rewrite
::apache::mod { 'auth_digest': }
::apache::mod { 'authn_anon': }
Expand All @@ -38,7 +39,6 @@
::apache::mod { 'logio': }
::apache::mod { 'speling': }
::apache::mod { 'substitute': }
::apache::mod { 'suexec': }
::apache::mod { 'usertrack': }
::apache::mod { 'version': }

Expand Down
3 changes: 3 additions & 0 deletions manifests/mod/suexec.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class apache::mod::suexec {
::apache::mod { 'suexec': }
}
12 changes: 11 additions & 1 deletion manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@
$fastcgi_socket = undef,
$fastcgi_dir = undef,
$additional_includes = [],
$apache_version = $::apache::apache_version
$apache_version = $::apache::apache_version,
$suexec_user_group = undef,
) {
# The base class must be included first because it is used by parameter defaults
if ! defined(Class['apache']) {
Expand All @@ -200,6 +201,11 @@
validate_hash($rewrites[0])
}

if $suexec_user_group {
validate_re($suexec_user_group, '^\w+ \w+$',
"${suexec_user_group} is not supported for suexec_user_group. Must be 'user group'.")
}

# Deprecated backwards-compatibility
if $rewrite_base {
warning('Apache::Vhost: parameter rewrite_base is deprecated in favor of rewrites')
Expand Down Expand Up @@ -255,6 +261,10 @@
include ::apache::mod::wsgi
}

if $suexec_user_group {
include ::apache::mod::suexec
}

# This ensures that the docroot exists
# But enables it to be specified across multiple vhost resources
if ! defined(File[$docroot]) {
Expand Down
10 changes: 10 additions & 0 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,16 @@
end
end

describe 'when suexec_user_group is specified' do
let :params do
default_params.merge({
:suexec_user_group => 'nobody nogroup',
})
end

it { should contain_file("25-#{title}.conf").with_content %r{^ SuexecUserGroup nobody nogroup$} }
end

describe 'redirect rules' do
describe 'without lockstep arrays' do
let :params do
Expand Down
1 change: 1 addition & 0 deletions templates/vhost.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@
<%= scope.function_template(['apache/vhost/_wsgi.erb']) -%>
<%= scope.function_template(['apache/vhost/_custom_fragment.erb']) -%>
<%= scope.function_template(['apache/vhost/_fastcgi.erb']) -%>
<%= scope.function_template(['apache/vhost/_suexec.erb']) -%>
</VirtualHost>
4 changes: 4 additions & 0 deletions templates/vhost/_suexec.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% if @suexec_user_group -%>

SuexecUserGroup <%= @suexec_user_group %>
<% end -%>

0 comments on commit 9d2067c

Please sign in to comment.