Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # == Type: fail2ban::filter | 1 # == Type: fail2ban::filter |
2 # | 2 # |
3 # Manage filter information and files for any custom filter we create | 3 # Manage filter information and files for any custom filter. |
mathias
2016/11/24 16:08:48
Please use un-personalized text in documentation,
f.lopez
2016/11/25 15:13:49
Acknowledged.
| |
4 # | 4 # |
5 # == Parameters: | 5 # == Parameters: |
6 # | 6 # |
7 # [*failregex*] | 7 # [*regexes*] |
8 # The regular expressions used to detect break-in attempts, password failures, etc. | 8 # Array of strings containing the regular expressions applied to |
9 # One per line | 9 # the filter. |
mathias
2016/11/24 16:08:48
A bit too specific. Something like "The regular ex
f.lopez
2016/11/25 15:13:48
Acknowledged.
| |
10 # | |
11 # [*ensure*] | |
12 # Translates directly into the state of the file resource. | |
10 # | 13 # |
11 # === Examples: | 14 # === Examples: |
12 # | 15 # |
13 # filters => { | 16 # fail2ban::filter {'CVE-2013-0235': |
14 # 'wordpress' => { | 17 # regexes => [ |
15 # failregex => [ | 18 # '^<HOST>.*\"WordPress\/.*', |
16 # » '^<HOST>.*\"WordPress\/.*', | 19 #» '^.*\"WordPress\/.*<HOST>.*', |
17 # » ], | 20 # ], |
18 # } | 21 # 'ensure' => 'present', |
19 # }, | 22 # } |
mathias
2016/11/24 16:08:48
The example is not valid Puppet code, a snippet at
f.lopez
2016/11/25 15:13:48
Acknowledged.
| |
23 # | |
20 define fail2ban::filter ( | 24 define fail2ban::filter ( |
21 $failregex = undef, | 25 $regexes = [], |
22 $ensure = 'present', | 26 $ensure = 'present', |
mathias
2016/11/24 16:08:48
The $ensure parameter is not documented yet.
f.lopez
2016/11/25 15:13:49
Acknowledged.
| |
23 ) { | 27 ) { |
24 | 28 |
25 include fail2ban | 29 include fail2ban |
26 include stdlib | 30 include stdlib |
27 | 31 |
28 if $failregex != undef { | 32 if (size($regexes) == 0) and ($ensure == 'present') { |
mathias
2016/11/24 16:08:48
This condition does not make much sense in this co
f.lopez
2016/11/25 15:13:49
There can be cases where an already existing filte
| |
29 file {"/etc/fail2ban/filter.d/$title.conf": | 33 fail("An array of one or more regular expressions is needed.") |
30 ensure => $ensure, | |
31 content => template("fail2ban/filter.erb"), | |
32 group => 'root', | |
33 mode => '0644', | |
34 owner => 'root', | |
35 require => Package['fail2ban'], | |
36 notify => Service['fail2ban'], | |
37 } | |
38 } | 34 } |
39 } | 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 | |
LEFT | RIGHT |