]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/fail2ban/providers/filter.rb
Adjust tile expiry thresholds
[chef.git] / cookbooks / fail2ban / providers / filter.rb
index 840dc48251596d029987b5ebdb05848e841b00df..8c1c20e44e1b79b2f66ec4d2ffc5a0c589a2e3e7 100644 (file)
@@ -24,11 +24,23 @@ end
 use_inline_resources
 
 action :create do
-  remote_file "/etc/fail2ban/filter.d/#{new_resource.name}.conf" do
-    source new_resource.source
-    owner "root"
-    group "root"
-    mode 0644
+  if new_resource.source
+    remote_file "/etc/fail2ban/filter.d/#{new_resource.name}.conf" do
+      source new_resource.source
+      owner "root"
+      group "root"
+      mode 0o644
+    end
+  else
+    template "/etc/fail2ban/filter.d/#{new_resource.name}.conf" do
+      cookbook "fail2ban"
+      source "filter.erb"
+      owner "root"
+      group "root"
+      mode 0o644
+      variables :failregex => new_resource.failregex,
+                :ignoreregex => new_resource.ignoreregex
+    end
   end
 end