Skip to content

Commit

Permalink
MODULES-1622: Allow multiple Deny directives in a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-mueller authored and Roman Mueller committed Feb 16, 2015
1 parent dd06847 commit c11c622
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ Pass a string of custom configuration directives to be placed at the end of the

######`deny`

Sets a [Deny](http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#deny) directive, specifying which hosts are denied access to the server. **Deprecated:** This parameter is being deprecated due to a change in Apache. It only works with Apache 2.2 and lower.
Sets a [Deny](http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#deny) directive, specifying which hosts are denied access to the server. **Deprecated:** This parameter is being deprecated due to a change in Apache. It only works with Apache 2.2 and lower. You can use it as a single string for one rule or as an array for more than one.

```puppet
apache::vhost { 'sample.example.net':
Expand Down
19 changes: 14 additions & 5 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,20 @@
'access_log_format' => '%h %l %u %t \"%r\" %>s %b',
'access_log_env_var' => '',
'aliases' => '/image',
'directories' => {
'path' => '/var/www/files',
'provider' => 'files',
'deny' => 'from all'
},
'directories' => [
{
'path' => '/var/www/files',
'provider' => 'files',
'allow' => [ 'from 127.0.0.1', 'from 127.0.0.2', ],
'deny' => [ 'from 127.0.0.3', 'from 127.0.0.4', ],
},
{
'path' => '/var/www/foo',
'provider' => 'files',
'allow' => 'from 127.0.0.1',
'deny' => 'from all',
},
],
'error_log' => false,
'error_log_file' => 'httpd_error_log',
'error_log_pipe' => '',
Expand Down
8 changes: 7 additions & 1 deletion templates/vhost/_directories.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@
<%- else -%>
Order allow,deny
<%- end -%>
<%- if directory['deny'] and directory['deny'] != '' -%>
<%- if directory['deny'] and ! [ false, 'false', '' ].include?(directory['deny']) -%>
<%- if directory['deny'].kind_of?(Array) -%>
<%- Array(directory['deny']).each do |restrict| -%>
Deny <%= restrict %>
<%- end -%>
<%- else -%>
Deny <%= directory['deny'] %>
<%- end -%>
<%- end -%>
<%- if directory['allow'] and ! [ false, 'false', '' ].include?(directory['allow']) -%>
<%- if directory['allow'].kind_of?(Array) -%>
Expand Down

0 comments on commit c11c622

Please sign in to comment.