OLD | NEW |
(Empty) | |
| 1 # == Type: fail2ban::filter |
| 2 # |
| 3 # Manage filter information and files for any custom filter. |
| 4 # |
| 5 # == Parameters: |
| 6 # |
| 7 # [*regexes*] |
| 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 # regexes => [ |
| 18 # '^<HOST>.*\"WordPress\/.*', |
| 19 # '^.*\"WordPress\/.*<HOST>.*', |
| 20 # ], |
| 21 # 'ensure' => 'present', |
| 22 # } |
| 23 # |
| 24 define fail2ban::filter ( |
| 25 $regexes = [], |
| 26 $ensure = 'present', |
| 27 ) { |
| 28 |
| 29 include fail2ban |
| 30 include stdlib |
| 31 |
| 32 if (size($regexes) == 0) and ($ensure == 'present') { |
| 33 fail("An array of one or more regular expressions is needed.") |
| 34 } |
| 35 |
| 36 # The $name parameter is used to compose the file name. |
| 37 file {"/etc/fail2ban/filter.d/$name.conf": |
| 38 ensure => $ensure, |
| 39 content => template("fail2ban/filter.erb"), |
| 40 group => 'root', |
| 41 mode => '0644', |
| 42 owner => 'root', |
| 43 require => Package['fail2ban'], |
| 44 notify => Service['fail2ban'], |
| 45 } |
| 46 } |
| 47 |
OLD | NEW |