Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/fail2ban/manifests/filter.pp

Issue 29364214: Issue 2487 - Introduce fail2ban module (Closed)
Left Patch Set: Created Nov. 24, 2016, 3:09 p.m.
Right Patch Set: For comment 22 and 23 Created Dec. 2, 2016, 2:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | modules/fail2ban/manifests/init.pp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
LEFTRIGHT

Powered by Google App Engine
This is Rietveld