diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 1b7b01665..d88052a9b 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -93,6 +93,10 @@ # put after everything else inside vhost # [*vhost_cfg_prepend*] - It expects a hash with custom directives to # put before everything else inside vhost +# [*vhost_cfg_ssl_append*] - It expects a hash with custom directives to +# put after everything else inside vhost ssl +# [*vhost_cfg_ssl_prepend*] - It expects a hash with custom directives to +# put before everything else inside vhost ssl # [*rewrite_to_https*] - Adds a server directive and rewrite rule to # rewrite to ssl # [*include_files*] - Adds include files to vhost @@ -169,6 +173,8 @@ $client_max_body_size = undef, $vhost_cfg_prepend = undef, $vhost_cfg_append = undef, + $vhost_cfg_ssl_prepend = undef, + $vhost_cfg_ssl_append = undef, $include_files = undef, $access_log = undef, $error_log = undef, @@ -288,6 +294,12 @@ if ($vhost_cfg_append != undef) { validate_hash($vhost_cfg_append) } + if ($vhost_cfg_ssl_prepend != undef) { + validate_hash($vhost_cfg_ssl_prepend) + } + if ($vhost_cfg_ssl_append != undef) { + validate_hash($vhost_cfg_ssl_append) + } if ($include_files != undef) { validate_array($include_files) } diff --git a/templates/vhost/vhost_ssl_footer.erb b/templates/vhost/vhost_ssl_footer.erb index 70c409889..217660d2f 100644 --- a/templates/vhost/vhost_ssl_footer.erb +++ b/templates/vhost/vhost_ssl_footer.erb @@ -5,6 +5,10 @@ include <%= file %>; <%= key %> <%= value %>; <% end -%> <% end -%> +<% if @vhost_cfg_ssl_append -%><% @vhost_cfg_ssl_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> + <%= key %> <%= value %>; +<% end -%> +<% end -%> } <% if @rewrite_www_to_non_www -%> server { diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index 20bd60c8a..f5992baaa 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -47,7 +47,13 @@ server { access_log <%= @ssl_access_log %>; error_log <%= @ssl_error_log %>; - + +<% if @vhost_cfg_prepend -%><% @vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> + <%= key %> <%= value %>; +<% end -%><% end -%> +<% if @vhost_cfg_ssl_prepend -%><% @vhost_cfg_ssl_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> + <%= key %> <%= value %>; +<% end -%><% end -%> <% if @root -%> root <%= @root %>; <% end -%>