OLD | NEW |
(Empty) | |
| 1 # == Type: fail2ban::filter |
| 2 # |
| 3 # Manage filter information and files for any custom filter. |
| 4 # |
| 5 # == Parameters: |
| 6 # |
| 7 # [*failregex*] |
| 8 # Array of strings containing the regular expressions applied to |
| 9 # the filter. |
| 10 # |
| 11 # [*ensure*] |
| 12 # Translates directly into the state of the file resource. |
| 13 # |
| 14 # === Examples: |
| 15 # |
| 16 # fail2ban::filter => {'CVE-2013-0235': |
| 17 # failregex => [ |
| 18 # '^<HOST>.*\"WordPress\/.*', |
| 19 # '^.*\"WordPress\/.*<HOST>.*' |
| 20 # ], |
| 21 # 'ensure' => 'present', |
| 22 # } |
| 23 define fail2ban::filter ( |
| 24 $failregex = [], |
| 25 $ensure = 'present', |
| 26 ) { |
| 27 |
| 28 include fail2ban |
| 29 include stdlib |
| 30 |
| 31 if (size($failregex) == 0) and ($ensure == 'present') { |
| 32 fail('Require an array of string[s] with the regex patterns to apply.') |
| 33 } |
| 34 |
| 35 file {"/etc/fail2ban/filter.d/$title.conf": |
| 36 ensure => $ensure, |
| 37 content => template("fail2ban/filter.erb"), |
| 38 group => 'root', |
| 39 mode => '0644', |
| 40 owner => 'root', |
| 41 require => Package['fail2ban'], |
| 42 notify => Service['fail2ban'], |
| 43 } |
| 44 } |
OLD | NEW |