| Index: modules/fail2ban/manifests/filter.pp |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/modules/fail2ban/manifests/filter.pp |
| @@ -0,0 +1,41 @@ |
| +# == Type: fail2ban::filter |
| +# |
| +# Manage filter information and files for any custom filter. |
| +# |
| +# == Parameters: |
| +# |
| +# [*failregex*] |
| +# The regular expressions applied to the filter. |
| +# |
| +# [*ensure*] |
| +# A boolean to ensure the state of the file. |
| +# |
| +# === Examples: |
| +# |
| +# filters => { |
| +# 'wordpress' => { |
| +# failregex => [ |
| +# '^<HOST>.*\"WordPress\/.*', |
| +# ], |
| +# } |
| +# }, |
| +define fail2ban::filter ( |
| + $failregex = undef, |
| + $ensure = 'present', |
| +) { |
| + |
| + include fail2ban |
| + include stdlib |
| + |
| + if ($failregex != undef) and ($ensure == 'present') { |
| + file {"/etc/fail2ban/filter.d/$title.conf": |
| + ensure => $ensure, |
| + content => template("fail2ban/filter.erb"), |
| + group => 'root', |
| + mode => '0644', |
| + owner => 'root', |
| + require => Package['fail2ban'], |
| + notify => Service['fail2ban'], |
| + } |
| + } |
| +} |