Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47f47e784d | ||
|
|
af31e1fe07 | ||
|
|
dab8e07069 | ||
|
|
a4b5dae912 | ||
|
|
a7458e33ce | ||
|
|
d71e25c0ae | ||
|
|
be537ee29b | ||
|
|
8e00da08a5 | ||
|
|
582b6a1788 | ||
|
|
344ed1dbbb | ||
|
|
1f2c9a8e8e | ||
|
|
ceff3a4ed5 | ||
|
|
32fcff31f8 | ||
|
|
2c4731e5c9 | ||
|
|
5eba942fcf |
+22
-11
@@ -1,22 +1,33 @@
|
|||||||
|
---
|
||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 1.8.7
|
- 1.8.7
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
script:
|
- 2.0.0
|
||||||
- "rake spec SPEC_OPTS='--format documentation'"
|
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
master
|
||||||
env:
|
env:
|
||||||
- PUPPET_VERSION="~> 2.6.0"
|
matrix:
|
||||||
- PUPPET_VERSION="~> 2.7.0"
|
- PUPPET_GEM_VERSION="~> 2.7.0"
|
||||||
- PUPPET_VERSION="~> 3.0.0"
|
- PUPPET_GEM_VERSION="~> 3.0.0"
|
||||||
- PUPPET_VERSION="~> 3.1.0"
|
- PUPPET_GEM_VERSION="~> 3.1.0"
|
||||||
|
- PUPPET_GEM_VERSION="~> 3.2.0"
|
||||||
matrix:
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
# - rvm: ruby-head
|
||||||
exclude:
|
exclude:
|
||||||
|
- rvm: 1.8.7
|
||||||
|
env: PUPPET_GEM_VERSION="~> 2.7.0"
|
||||||
- rvm: 1.9.3
|
- rvm: 1.9.3
|
||||||
env: PUPPET_VERSION="~> 2.6.0"
|
env: PUPPET_GEM_VERSION="~> 2.7.0"
|
||||||
gemfile: .gemfile
|
- rvm: 2.0.0
|
||||||
- rvm: 1.9.3
|
env: PUPPET_GEM_VERSION="~> 2.7.0"
|
||||||
env: PUPPET_VERSION="~> 2.7.0"
|
- rvm: 2.0.0
|
||||||
gemfile: .gemfile
|
env: PUPPET_GEM_VERSION="~> 3.0.0"
|
||||||
|
- rvm: 2.0.0
|
||||||
|
env: PUPPET_GEM_VERSION="~> 3.1.0"
|
||||||
gemfile: .gemfile
|
gemfile: .gemfile
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name 'netmanagers-fail2ban'
|
name 'netmanagers-fail2ban'
|
||||||
version '1.2.0'
|
version '1.3.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'
|
||||||
|
|||||||
+4
-1
@@ -92,7 +92,10 @@ define fail2ban::filter (
|
|||||||
|
|
||||||
$manage_file_content = $filtertemplate ? {
|
$manage_file_content = $filtertemplate ? {
|
||||||
'' => undef,
|
'' => undef,
|
||||||
default => template($filtertemplate),
|
default => $filtersource ? {
|
||||||
|
'' => template($filtertemplate),
|
||||||
|
default => undef,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "${real_filtername}.local":
|
file { "${real_filtername}.local":
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
# Defaults to true
|
# Defaults to true
|
||||||
# $filter - The filter rule to use.
|
# $filter - The filter rule to use.
|
||||||
# If empty, defaults to == $jailname.
|
# If empty, defaults to == $jailname.
|
||||||
|
# $ignoreip - Don't ban a host which matches an address in this list.
|
||||||
# $port - The port to filter. It can be an array of ports.
|
# $port - The port to filter. It can be an array of ports.
|
||||||
# $logpath - The log file to monitor
|
# $logpath - The log file to monitor
|
||||||
# $maxretry - How many fails are acceptable
|
# $maxretry - How many fails are acceptable
|
||||||
@@ -29,6 +30,7 @@ define fail2ban::jail (
|
|||||||
$order = '',
|
$order = '',
|
||||||
$status = '',
|
$status = '',
|
||||||
$filter = '',
|
$filter = '',
|
||||||
|
$ignoreip = '',
|
||||||
$port = '',
|
$port = '',
|
||||||
$action = '',
|
$action = '',
|
||||||
$logpath = '',
|
$logpath = '',
|
||||||
@@ -62,6 +64,14 @@ define fail2ban::jail (
|
|||||||
default => $filter,
|
default => $filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$array_ignoreip = is_array($ignoreip) ? {
|
||||||
|
false => $ignoreip ? {
|
||||||
|
'' => [],
|
||||||
|
default => [$ignoreip],
|
||||||
|
},
|
||||||
|
default => $ignoreip,
|
||||||
|
}
|
||||||
|
|
||||||
$array_port = is_array($port) ? {
|
$array_port = is_array($port) ? {
|
||||||
false => $port ? {
|
false => $port ? {
|
||||||
'' => [],
|
'' => [],
|
||||||
|
|||||||
+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 ? {
|
||||||
|
|||||||
@@ -97,12 +97,10 @@ enabled = true/) }
|
|||||||
describe 'Test customizations - template' do
|
describe 'Test customizations - template' do
|
||||||
let(:params) { {:template => "fail2ban/spec.erb" , :options => { 'opt_a' => 'value_a' } } }
|
let(:params) { {:template => "fail2ban/spec.erb" , :options => { 'opt_a' => 'value_a' } } }
|
||||||
it 'should generate a valid template' do
|
it 'should generate a valid template' do
|
||||||
content = catalogue.resource('file', 'fail2ban.local').send(:parameters)[:content]
|
should contain_file('fail2ban.local').with_content(/fqdn: rspec.example42.com/)
|
||||||
content.should match "fqdn: rspec.example42.com"
|
|
||||||
end
|
end
|
||||||
it 'should generate a template that uses custom options' do
|
it 'should generate a template that uses custom options' do
|
||||||
content = catalogue.resource('file', 'fail2ban.local').send(:parameters)[:content]
|
should contain_file('fail2ban.local').with_content(/value_a/)
|
||||||
content.should match "value_a"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -136,8 +134,7 @@ enabled = true/) }
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
it 'should not automatically restart the service, when service_autorestart => false' do
|
it 'should not automatically restart the service, when service_autorestart => false' do
|
||||||
content = catalogue.resource('file', 'fail2ban.local').send(:parameters)[:notify]
|
should contain_file('fail2ban.local').with_notify(nil)
|
||||||
content.should be_nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ b = 2
|
|||||||
not c
|
not c
|
||||||
"
|
"
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_file('sample2.local').with_path('/etc/fail2ban/filter.d/sample2.local').with_content(expected) }
|
it { should contain_file('sample2.local').with_path('/etc/fail2ban/filter.d/sample2.local').with_content(expected) }
|
||||||
it { should contain_file('sample2.local').without_source }
|
it { should contain_file('sample2.local').without_source }
|
||||||
end
|
end
|
||||||
@@ -75,6 +75,7 @@ not c
|
|||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_file('sample3.local').with_path('/etc/fail2ban/filter.d/sample3.local').with_source('puppet:///some/path/to/source') }
|
it { should contain_file('sample3.local').with_path('/etc/fail2ban/filter.d/sample3.local').with_source('puppet:///some/path/to/source') }
|
||||||
|
it { should contain_file('sample3.local').with_content(nil) }
|
||||||
it { should contain_file('sample3.local').without_template }
|
it { should contain_file('sample3.local').without_template }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ filter = fail2ban::jail
|
|||||||
:port => ['42', '43'],
|
:port => ['42', '43'],
|
||||||
:logpath => '/path/to/somelog',
|
:logpath => '/path/to/somelog',
|
||||||
:enable => true,
|
:enable => true,
|
||||||
|
:ignoreip => [ '10.3.2.0/24', '192.168.56.0/24' ],
|
||||||
:findtime => '9000',
|
:findtime => '9000',
|
||||||
:maxretry => '5',
|
:maxretry => '5',
|
||||||
:bantime => '3600',
|
:bantime => '3600',
|
||||||
@@ -53,6 +54,7 @@ filter = fail2ban::jail
|
|||||||
[fail2ban::jail]
|
[fail2ban::jail]
|
||||||
enabled = true
|
enabled = true
|
||||||
filter = fail2ban::jail
|
filter = fail2ban::jail
|
||||||
|
ignoreip = 10.3.2.0/24 192.168.56.0/24
|
||||||
port = 42,43
|
port = 42,43
|
||||||
action = iptables[name=SSH, port=ssh, protocol=tcp]
|
action = iptables[name=SSH, port=ssh, protocol=tcp]
|
||||||
mail-whois[name=SSH, dest=yourmail@mail.com]
|
mail-whois[name=SSH, dest=yourmail@mail.com]
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ enabled = <%= @real_status %>
|
|||||||
<% if @real_filter != '' -%>
|
<% if @real_filter != '' -%>
|
||||||
filter = <%= @real_filter %>
|
filter = <%= @real_filter %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% if @array_ignoreip != [] -%>
|
||||||
|
ignoreip = <%= @array_ignoreip * ' ' %>
|
||||||
|
<% end -%>
|
||||||
<% if @array_port != [] -%>
|
<% if @array_port != [] -%>
|
||||||
port = <%= @array_port * ',' %>
|
port = <%= @array_port * ',' %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|||||||
Reference in New Issue
Block a user