calmenergy / calmenergy-fail2ban

Puppet module to manage fail2ban
Apache License 2.0
1 stars 6 forks source link

Feature: support for multiple files for the logpath directive into jail definition #2

Open cedef opened 7 years ago

cedef commented 7 years ago

When specifying multiple files into the logpath jail directive in a jail.conf file, correct syntax is to split them with \n (see man 5 jail.conf). I would really prefer using an Array instead of a very long String split with multiple \n.

Moreover, since v0.9.0 there is an optional tail or head directive that can follow a given path.

So I think the fail2ban::jail defined type should take an Array as $log_path parameter:

define fail2ban::jail(
...
-  Optional[Stdlib::Absolutepath] $log_path = undef,
+  Optional[Array[Stdlib::Absolutepath]] $log_path = [],
...)

I'm not 100% sure that Stdlib::Absolutepath would accept a wildcard in pathname, or anything like /var/log/apache2/*.log tail.

What do you think about that ? I can submit a patch if you agree with the need to pass an Array as parameter. The patch would support both String and Array as $log_path parameter.

Regards,

calmenergy commented 7 years ago

I think this is a good idea. How would you feel about making it Variant[Array[...], String] and then handling the string as a one-element array?

Absolutepath does not accept wildcards. It would be nice to accept them, but also check that the path with wildcard is valid.

And also to accept 'tail' as per the jail.conf manpage.

I very much appreciate your contributions to this module.