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 # [*failregex*] | |
mathias
2016/11/29 13:21:24
Either we allow for passing a single string as wel
f.lopez
2016/12/01 09:13:48
Acknowledged.
| |
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': | |
mathias
2016/11/29 13:21:24
The "=>" here is invalid syntax, and the sub-level
f.lopez
2016/12/01 09:13:48
Acknowledged.
| |
17 # failregex => [ | |
18 # '^<HOST>.*\"WordPress\/.*', | |
19 # '^.*\"WordPress\/.*<HOST>.*' | |
mathias
2016/11/29 13:21:24
Missing a comma here, after the string item.
f.lopez
2016/12/01 09:13:48
Acknowledged.
| |
20 # ], | |
21 # 'ensure' => 'present', | |
22 # } | |
mathias
2016/11/29 13:21:24
Another comment-line (hash-tag in the beginning, o
f.lopez
2016/12/01 09:13:48
Acknowledged.
| |
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.') | |
mathias
2016/11/29 13:21:24
Those square brackets are not necessary. And the e
f.lopez
2016/12/01 09:13:48
Acknowledged.
| |
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 } | |
45 | |
OLD | NEW |