Skip to content

Commit

Permalink
Stricter data type on apache::vhost::modsec_disable_ips
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Jun 16, 2022
1 parent 32c3cac commit 88d7b26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@
Optional[String] $add_default_charset = undef,
Boolean $modsec_disable_vhost = false,
Optional[Variant[Hash, Array]] $modsec_disable_ids = undef,
Optional[Array[String]] $modsec_disable_ips = undef,
Array[String[1]] $modsec_disable_ips = [],
Optional[Variant[Hash, Array]] $modsec_disable_msgs = undef,
Optional[Variant[Hash, Array]] $modsec_disable_tags = undef,
Optional[String] $modsec_body_limit = undef,
Expand Down Expand Up @@ -2876,7 +2876,7 @@
# - $modsec_disable_tags
# - $modsec_body_limit
# - $modsec_audit_log_destination
if $modsec_disable_vhost or $modsec_disable_ids or $modsec_disable_ips or $modsec_disable_msgs or $modsec_disable_tags or $modsec_audit_log_destination {
if $modsec_disable_vhost or $modsec_disable_ids or !empty($modsec_disable_ips) or $modsec_disable_msgs or $modsec_disable_tags or $modsec_audit_log_destination {
concat::fragment { "${name}-security":
target => "${priority_real}${filename}.conf",
order => 320,
Expand Down
5 changes: 2 additions & 3 deletions templates/vhost/_security.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
</LocationMatch>
<% end -%>
<% end -%>
<% ips = Array(@modsec_disable_ips).join(',') %>
<% if ips != '' %>
SecRule REMOTE_ADDR "<%= ips %>" "nolog,allow,id:1234123455"
<% unless @modsec_disable_ips.empty? %>
SecRule REMOTE_ADDR "<%= @modsec_disable_ips.join(',') %>" "nolog,allow,id:1234123455"
SecAction "phase:2,pass,nolog,id:1234123456"
<% end -%>
<% if @_modsec_disable_msgs.is_a?(Hash) -%>
Expand Down

0 comments on commit 88d7b26

Please sign in to comment.