Enable wp-fail2ban after installing it
authorTom Hughes <tom@compton.nu>
Thu, 21 Nov 2013 21:35:46 +0000 (21:35 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 21 Nov 2013 21:36:40 +0000 (21:36 +0000)
cookbooks/wordpress/definitions/wordpress_site.rb

index d2aea619d06524e1d244e95498e517296165f0c8..8cd887e4acac3dcf4deb53fdac684c218ca5fc3f 100644 (file)
@@ -139,4 +139,20 @@ define :wordpress_site, :action => [ :create, :enable ] do
   wordpress_plugin "wp-fail2ban" do
     site name
   end
+
+  script "#{directory}/wp-content/plugins/wp-fail2ban" do
+    action :nothing
+    interpreter "php"
+    cwd directory
+    user "wordpress"
+    code <<-EOS
+    <?php
+    @include "wp-config.php";
+    @include_once "wp-includes/functions.php";
+    @include_once "wp-admin/includes/plugin.php";
+    activate_plugin("wp-fail2ban/wp-fail2ban.php", '', false, false);
+    ?>
+    EOS
+    subscribes :run, "subversion[#{directory}/wp-content/plugins/wp-fail2ban]"
+  end
 end