14 Commits
Author SHA1 Message Date
Javier Bértoli d71e25c0ae Update travis configuration 2013-12-23 18:04:15 -03:00
Javier Bértoli be537ee29b Merge branch 'AddOnline-fix-filter-source' 2013-12-23 18:03:34 -03:00
Javier Bértoli 8e00da08a5 Merge branch 'fix-filter-source' of https://github.com/AddOnline/puppet-fail2ban into AddOnline-fix-filter-source 2013-12-23 17:46:06 -03:00
Romain THERRAT 582b6a1788 Fix test with 1.0 rspec-puppet version 2013-12-23 18:41:15 +01:00
Javier Bértoli 344ed1dbbb Merge branch 'fix-filter-source' of https://github.com/AddOnline/puppet-fail2ban into AddOnline-fix-filter-source 2013-12-23 13:58:50 -03:00
Romain THERRAT 1f2c9a8e8e Fix filter with a specified source 2013-12-23 17:18:46 +01:00
Javier Bértoli ceff3a4ed5 Release v1.2.1 2013-11-26 11:31:23 -03:00
Javier Bértoli 32fcff31f8 Merge branch 'master' of github.com:netmanagers/puppet-fail2ban 2013-11-26 11:28:09 -03:00
Javier Bértoli 2c4731e5c9 Merge pull request #12 from mburger/master
fixed the process name for redhat bases distros
2013-11-26 06:26:53 -08:00
Markus Burger 5eba942fcf fixed the process name for redhat bases distros
Change-Id: I9885235550a1bca8109122812f7b50f39dda12d1
2013-11-26 14:49:12 +01:00
Javier Bértoli 78a12ac0de Merge branch 'issue_11' 2013-11-24 19:28:50 -03:00
Javier Bértoli 4128ee5bc5 Bump version 2013-11-24 19:28:33 -03:00
Javier Bértoli 80a6650164 Add multiple logpaths support (closes #11) 2013-11-24 19:24:09 -03:00
Javier Bértoli 38f9a89235 Release v1.1.2 2013-10-27 08:56:33 -03:00
9 changed files with 76 additions and 29 deletions
+22 -11
View File
@@ -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
View File
@@ -1,5 +1,5 @@
name 'netmanagers-fail2ban' name 'netmanagers-fail2ban'
version '1.1.1' version '1.2.1'
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
View File
@@ -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":
+6 -3
View File
@@ -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
View File
@@ -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 ? {
+3 -6
View File
@@ -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
+1
View File
@@ -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
+33 -2
View File
@@ -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
+2 -2
View File
@@ -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 %>