Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom_jails parameter #100

Merged
merged 2 commits into from
Dec 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# == Class: fail2ban::config
#
class fail2ban::config {
# Load custom jails definition
$config_custom_jails = hiera_hash('fail2ban::custom_jails', undef)

file { 'fail2ban.dir':
ensure => $::fail2ban::config_dir_ensure,
Expand Down Expand Up @@ -30,9 +28,7 @@
}

# Custom jails definition
if $config_custom_jails {
create_resources('fail2ban::jail', $config_custom_jails)
}
create_resources('fail2ban::jail', $::fail2ban::custom_jails)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't the leading :: on a variable considered bad practice?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad practice is overstating it IMHO. They are needed in Puppet 3 to match Puppet 4+ behavior without them. With it's always absolute. Given the rest of the module is still using the absolute version I'd prefer consistency over the modern way.


# Operating system specific configuration
case $facts['os']['family'] {
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
Array[String[1]] $jails = ['ssh', 'ssh-ddos'],
Integer[0] $maxretry = 3,
Array $whitelist = ['127.0.0.1/8', '192.168.56.0/24'],
$custom_jails = undef,
Hash[String, Hash] $custom_jails = {},
String[1] $banaction = 'iptables-multiport',
) inherits ::fail2ban::params {
$config_file_content = default_content($config_file_string, $config_file_template)
Expand Down