Support Apache 2.4

Apache version 2.4 changes the Order Allow,Deny security configuration options.
This patch modifies the vhost template in order to support it and provide
trusty compatibility.

Change-Id: I1514ab788f8bfd9198ae020ea1fab745cee6f305
This commit is contained in:
Marton Kiss 2016-03-29 15:22:02 +02:00
parent aa45388477
commit 4086fbe21c
3 changed files with 29 additions and 2 deletions

View File

@ -89,6 +89,8 @@ class drupal (
$site_ssl_key_file_contents = undef,
$site_vhost_root = '/srv/vhosts',
) {
# Dependencies
require ::drupal::params
include ::httpd
include ::pear
@ -151,6 +153,9 @@ class drupal (
mode => '0755',
}
# Check vhost permission set.
$new_vhost_perms = (versioncmp($::drupal::params::apache_version, '2.4') >= 0)
::httpd::vhost { $site_name:
port => 80,
priority => '50',

18
manifests/params.pp Normal file
View File

@ -0,0 +1,18 @@
# == Class: drupal::params
#
# Centralized configuration management for the drupal module.
#
class drupal::params() {
case $::osfamily {
'Debian': {
if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease >= 13.10 {
$apache_version = '2.4'
} else {
$apache_version = '2.2'
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} The 'storyboard' module only supports osfamily Debian.")
}
}
}

View File

@ -30,8 +30,12 @@ NameVirtualHost <%= @vhost_name %>:443
<Directory <%= @docroot %>>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
<% if @new_vhost_perms %>
Require all granted
<% else %>
Order allow,deny
Allow from all
<% end %>
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny