Skip to content

Commit

Permalink
Merge pull request #760 from oxilion/logrootperms
Browse files Browse the repository at this point in the history
add logroot_mode parameter
  • Loading branch information
Ashley Penney committed Jun 26, 2014
2 parents 23818ac + 2771531 commit 3049676
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ Define additional [LogFormats](https://httpd.apache.org/docs/current/mod/mod_log

Changes the directory where Apache log files for the virtual host are placed. Defaults to '/var/log/httpd' on RedHat, '/var/log/apache2' on Debian, and '/var/log/apache22' on FreeBSD.

#####`logroot_mode`

Overrides the mode the logroot directory is set to. Defaults to undef. Do NOT give people write access to the directory the logs are stored
in without being aware of the consequences; see http://httpd.apache.org/docs/2.4/logs.html#security for details.

#####`manage_group`

Setting this to 'false' will stop the group resource from being created. This is for when you have a group, created from another Puppet module, you want to use to run Apache. Without this parameter, attempting to use a previously established group would result in a duplicate resource error.
Expand Down
2 changes: 2 additions & 0 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
$directoryindex = '',
$vhost_name = '*',
$logroot = $::apache::logroot,
$logroot_mode = undef,
$log_level = undef,
$access_log = true,
$access_log_file = undef,
Expand Down Expand Up @@ -274,6 +275,7 @@
if ! defined(File[$logroot]) {
file { $logroot:
ensure => directory,
mode => $logroot_mode,
require => Package['httpd'],
}
}
Expand Down
12 changes: 12 additions & 0 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,18 @@
expect { subject }.to raise_error(Puppet::Error, /'error_log_file' and 'error_log_pipe' cannot be defined at the same time/)
end
end
describe 'when logroot and logroot_mode are specified' do
let :params do default_params.merge({
:logroot => '/rspec/logroot',
:logroot_mode => '0755',
}) end
it 'should set logroot mode' do
should contain_file(params[:logroot]).with({
:ensure => :directory,
:mode => '0755',
})
end
end
describe 'when docroot owner and mode is specified' do
let :params do default_params.merge({
:docroot_owner => 'testuser',
Expand Down

0 comments on commit 3049676

Please sign in to comment.