| Left: | ||
| Right: |
| 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 if you want", | |
| 34 "to create a filter file.") | |
|
mathias
2016/12/01 09:28:30
Please do not personalized messages ("you"). There
f.lopez
2016/12/01 10:16:04
Acknowledged.
| |
| 35 } | |
| 36 | |
| 37 file {"/etc/fail2ban/filter.d/$title.conf": | |
|
mathias
2016/12/01 09:28:30
Please use $name (and document that this parameter
f.lopez
2016/12/01 10:16:04
Acknowledged.
| |
| 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 |