Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32fcff31f8 | ||
|
|
2c4731e5c9 | ||
|
|
5eba942fcf | ||
|
|
78a12ac0de | ||
|
|
4128ee5bc5 | ||
|
|
80a6650164 | ||
|
|
38f9a89235 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name 'netmanagers-fail2ban'
|
name 'netmanagers-fail2ban'
|
||||||
version '1.1.1'
|
version '1.2.0'
|
||||||
author 'Javier Bertoli'
|
author 'Javier Bertoli'
|
||||||
license 'Apache2'
|
license 'Apache2'
|
||||||
project_page 'http://www.netmanagers.com.ar'
|
project_page 'http://www.netmanagers.com.ar'
|
||||||
|
|||||||
+6
-3
@@ -78,9 +78,12 @@ define fail2ban::jail (
|
|||||||
default => $action,
|
default => $action,
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_logpath = $logpath ? {
|
$array_logpath = is_array($logpath) ? {
|
||||||
'' => '',
|
false => $logpath ? {
|
||||||
default => $logpath,
|
'' => [],
|
||||||
|
default => [$logpath],
|
||||||
|
},
|
||||||
|
default => $logpath,
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_maxretry = $maxretry ? {
|
$real_maxretry = $maxretry ? {
|
||||||
|
|||||||
+3
-2
@@ -29,8 +29,9 @@ class fail2ban::params {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$process = $::operatingsystem ? {
|
$process = $::operatingsystem ? {
|
||||||
/(?i:Debian|Ubuntu|Mint)/ => 'fail2ban-server',
|
/(?i:Debian|Ubuntu|Mint)/ => 'fail2ban-server',
|
||||||
default => 'fail2ban',
|
/(?i:RedHat|Centos|Scientific|Fedora|OracleLinux)/ => 'fail2ban-server',
|
||||||
|
default => 'fail2ban',
|
||||||
}
|
}
|
||||||
|
|
||||||
$process_args = $::operatingsystem ? {
|
$process_args = $::operatingsystem ? {
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ filter = fail2ban::jail
|
|||||||
"
|
"
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_concat__fragment('fail2ban_jail_sample1').with_target('/etc/fail2ban/jail.local').with_content(expected) }
|
it 'should create a named jail, enabled and with a filter of the same name' do
|
||||||
|
should contain_concat__fragment('fail2ban_jail_sample1').with_target('/etc/fail2ban/jail.local').with_content(expected)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Test jail.local is created with all options' do
|
describe 'Test jail.local is created with all options' do
|
||||||
@@ -62,6 +64,35 @@ findtime = 9000
|
|||||||
"
|
"
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_concat__fragment('fail2ban_jail_sample1').with_target('/etc/fail2ban/jail.local').with_content(expected) }
|
it 'should create a customized jail, with own actions parsing a single log file' do
|
||||||
|
should contain_concat__fragment('fail2ban_jail_sample1').with_target('/etc/fail2ban/jail.local').with_content(expected)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe 'Test jail.local is created with multiple logpaths' do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
:name => 'title_sample2',
|
||||||
|
:jailname => 'sample2',
|
||||||
|
:port => '44',
|
||||||
|
:logpath => [ '/path/to/somelog_1', '/path/to/somelog_2' ],
|
||||||
|
:bantime => '3003',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let(:expected) do
|
||||||
|
"##################
|
||||||
|
[sample2]
|
||||||
|
enabled = true
|
||||||
|
filter = sample2
|
||||||
|
port = 44
|
||||||
|
logpath = /path/to/somelog_1
|
||||||
|
/path/to/somelog_2
|
||||||
|
bantime = 3003
|
||||||
|
|
||||||
|
"
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should create a customized jail, with own actions parsing a single log file' do
|
||||||
|
should contain_concat__fragment('fail2ban_jail_title_sample2').with_target('/etc/fail2ban/jail.local').with_content(expected)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ port = <%= @array_port * ',' %>
|
|||||||
<% if @array_action != [] -%>
|
<% if @array_action != [] -%>
|
||||||
action = <%= @array_action.join("\n\t") %>
|
action = <%= @array_action.join("\n\t") %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if @real_logpath != '' -%>
|
<% if @array_logpath != [] -%>
|
||||||
logpath = <%= @real_logpath %>
|
logpath = <%= @array_logpath.join("\n\t") %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if @real_maxretry != '' -%>
|
<% if @real_maxretry != '' -%>
|
||||||
maxretry = <%= @real_maxretry %>
|
maxretry = <%= @real_maxretry %>
|
||||||
|
|||||||
Reference in New Issue
Block a user