New release
* Default behaviour is now to install package as distros configure them. If you want to change the configuration you need to explicitly modify "jails_config" (see README for details) * Add support to modifify fail2ban.conf (issue #1) * Add specs and tests * Some cleanup
This commit is contained in:
1 parent
71e189ec6d
commit
0e96b8fa6f
5 files changed
+87
-91
No files matched your search
+30
-4
@@ -2,16 +2,16 @@
|
||||
#
|
||||
# Adds a custom fail2ban jail
|
||||
# Supported arguments:
|
||||
# $jailname - The name you want to give the jail.
|
||||
# $jailname - The name you want to give the jail.
|
||||
# If not set, defaults to == $title
|
||||
# $order - The order in the jail.local file.
|
||||
# $order - The order in the jail.local file.
|
||||
# Default 50. Generally you don't need to change it
|
||||
# $status - enabled / disabled. If disabled, the rule _IS ADDED_ to the jail.local file
|
||||
# but it will not be active. Compare with the next one.
|
||||
# Defaults to enabled
|
||||
# $enable - true / false. If false, the rule _IS NOT ADDED_ to the jail.local file
|
||||
# Defaults to true
|
||||
# $filter - The filter rule to use.
|
||||
# $filter - The filter rule to use.
|
||||
# If empty, defaults to == $jailname.
|
||||
# $port - The port to filter. It can be an array of ports.
|
||||
# $logpath - The log file to monitor
|
||||
@@ -32,8 +32,8 @@ define fail2ban::jail (
|
||||
$bantime = '',
|
||||
$enable = true ) {
|
||||
|
||||
include fail2ban
|
||||
include concat::setup
|
||||
include fail2ban
|
||||
|
||||
$real_jailname = $jailname ? {
|
||||
'' => $title,
|
||||
@@ -90,6 +90,32 @@ define fail2ban::jail (
|
||||
|
||||
$ensure = bool2ensure($enable)
|
||||
|
||||
|
||||
if ! defined(Concat[$fail2ban::jails_file]) {
|
||||
|
||||
concat { $fail2ban::jails_file:
|
||||
mode => $fail2ban::jails_file_mode,
|
||||
warn => true,
|
||||
owner => $fail2ban::jails_file_owner,
|
||||
group => $fail2ban::jails_file_group,
|
||||
notify => Service['fail2ban'],
|
||||
}
|
||||
|
||||
concat::fragment{ 'fail2ban_jails_header':
|
||||
target => $fail2ban::jails_file,
|
||||
content => template($fail2ban::jails_template_header),
|
||||
order => 01,
|
||||
notify => Service['fail2ban'],
|
||||
}
|
||||
|
||||
# The jail.local footer
|
||||
concat::fragment{ 'fail2ban_jails_footer':
|
||||
target => $fail2ban::jails_file,
|
||||
content => template($fail2ban::jails_template_footer),
|
||||
order => 99,
|
||||
notify => Service['fail2ban'],
|
||||
}
|
||||
}
|
||||
concat::fragment{ "fail2ban_jail_$name":
|
||||
ensure => $ensure,
|
||||
target => $fail2ban::jails_file,
|
||||
|
||||
Reference in new issue
Block a user