diff options
-rw-r--r-- | manifests/defines/vhost_files.pp | 3 | ||||
-rw-r--r-- | manifests/defines/vhost_varieties.pp | 65 | ||||
-rw-r--r-- | templates/vhosts/perl/CentOS.erb | 46 |
3 files changed, 114 insertions, 0 deletions
diff --git a/manifests/defines/vhost_files.pp b/manifests/defines/vhost_files.pp index b7e1847..844166e 100644 --- a/manifests/defines/vhost_files.pp +++ b/manifests/defines/vhost_files.pp @@ -23,6 +23,7 @@ define apache::vhost( $allow_override = 'None', $php_upload_tmp_dir = 'absent', $php_session_save_path = 'absent', + $cgi_binpath = 'absent', $options = 'absent', $additional_options = 'absent', $template_mode = 'static', @@ -48,6 +49,7 @@ define apache::vhost( domainalias => $domainalias, php_upload_tmp_dir => $php_upload_tmp_dir, php_session_save_path => $php_session_save_path, + cgi_binpath => $cgi_binpath, allow_override => $allow_override, options => $options, additional_options => $additional_options, @@ -162,6 +164,7 @@ define apache::vhost::template( $allow_override = 'None', $php_upload_tmp_dir = 'absent', $php_session_save_path = 'absent', + $cgi_binpath = 'absent', $options = 'absent', $additional_options = 'absent', $template_mode = 'static', diff --git a/manifests/defines/vhost_varieties.pp b/manifests/defines/vhost_varieties.pp index ba104db..b991fce 100644 --- a/manifests/defines/vhost_varieties.pp +++ b/manifests/defines/vhost_varieties.pp @@ -142,3 +142,68 @@ define apache::vhost::php::standard( mod_security => $mod_security, } } + +define apache::vhost::perl( + $domain = 'absent', + $domainalias = 'absent', + $path = 'absent', + $owner = root, + $group = 0, + $documentroot_owner = apache, + $documentroot_group = 0, + $documentroot_mode = 0750, + $allow_override = 'None', + $cgi_binpath = 'absent', + $options = 'absent', + $additional_options = 'absent', + $mod_security = 'true', + $vhost_mode = 'template', + $vhost_source = 'absent', + $vhost_destination = 'absent', + $htpasswd_file = 'absent', + $htpasswd_path = 'absent' +){ + # cgi_bin path + case $cgi_binpath { + 'absent': { + $real_cgi_binpath = "${path}/cgi-bin" } + } + default: { $real_cgi_binpath = $cgi_binpath + } + file{$real_cgi_binpath: + ensure => directory, + owner => $documentroot_owner, + group => $documentroot_group, + mode => $documentroot_mode; + } + + # create webdir + apache::vhost::webdir{$name: + path => $path, + owner => $owner, + group => $group, + documentroot_owner => $documentroot_owner, + documentroot_group => $documentroot_group, + documentroot_mode => $documentroot_mode, + } + + # create vhost configuration file + apache::vhost{$name: + path => $path, + template_mode => 'perl', + vhost_mode => $vhost_mode, + vhost_source => $vhost_source, + vhost_destination => $vhost_destination, + domain => $domain, + domainalias => $domainalias, + allow_override => $allow_override, + options => $options, + additional_options => $additional_options, + cgi_binpath => $real_cgi_binpath, + ssl_mode => $ssl_mode, + htpasswd_file => $htpasswd_file, + htpasswd_path => $htpasswd_path, + mod_security => $mod_security, + } + +} diff --git a/templates/vhosts/perl/CentOS.erb b/templates/vhosts/perl/CentOS.erb new file mode 100644 index 0000000..9c9e1f7 --- /dev/null +++ b/templates/vhosts/perl/CentOS.erb @@ -0,0 +1,46 @@ +<VirtualHost *:80> + Include conf.d/defaults.inc + + ServerName <%= servername %> + <%- unless serveralias.to_s.empty? then -%> + ServerAlias <%= serveralias %> + <%- end -%> + DocumentRoot <%= documentroot %>/ + + ErrorLog <%= logdir %>/error_log + CustomLog <%= logdir %>/access_log combined + + <Directory "<%= documentroot %>/"> + AllowOverride <%= allow_override %> + <%- unless options.to_s == 'absent' then -%> + Options <%= options %> + <%- end -%> + <%- unless htpasswd_file.to_s == 'absent' then -%> + AuthType Basic + AuthName "Access fuer <%= servername %>" + AuthUserFile <%= real_htpasswd_path %> + require valid-user + <%- end -%> + </Directory> + + ScriptAlias /cgi-bin/ <%= cgi_binpath %>/ + <%- unless htpasswd_file.to_s == 'absent' then -%> + <Directory "<%= cgi_binpath %>/"> + AuthType Basic + AuthName "Access fuer <%= servername %>" + AuthUserFile <%= real_htpasswd_path %> + require valid-user + </Directory> + <%- end -%> + + <IfModule mod_security2.c> + SecRuleEngine <%= if mod_security.to_s == 'true' then "On" else "Off" end %> + </IfModule> + + <%- unless additional_options.to_s == 'absent' then -%> + <%= additional_options %> + <%- end -%> + RewriteEngine on + RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) + RewriteRule .* - [F] +</VirtualHost> |