{"id":7,"date":"2015-02-13T15:53:08","date_gmt":"2015-02-13T15:53:08","guid":{"rendered":"http:\/\/www.mbcs.ca\/?p=7"},"modified":"2015-02-13T15:53:08","modified_gmt":"2015-02-13T15:53:08","slug":"fail2ban-and-wordpress","status":"publish","type":"post","link":"https:\/\/www.mbcs.ca\/?p=7","title":{"rendered":"Fail2Ban and WordPress"},"content":{"rendered":"<p>I noticed some unusual activity on my webserver recently, and tracked it down to brute force attempts on <a href=\"https:\/\/wordpress.org\/\">wordpress<\/a> installs.\u00a0 I did a little searching and found <a href=\"https:\/\/wordpress.org\/plugins\/wp-fail2ban\/faq\/\">wp-fail2ban<\/a>.\u00a0 Without too much tweaking of rsyslog, I got the auth messages to my firewall, where I set about getting fail2ban to monitor for login attempts.\u00a0 I was using the supplied wordpress.conf file that came with the plugin, but it was failing to match the regex due to the 32 character limitation of the syslog tag.\u00a0 Essentially a tag that should be of the form<\/p>\n<p>wordpress(www.example.com)[12345]<\/p>\n<p>would sometimes be truncated to<\/p>\n<p>wordpress(www.longdomainname.com<\/p>\n<p>This would cause a failure of the regex.\u00a0 So if you have long domain names, you may need to modify the wordpress.conf.\u00a0 In my case, I just removed<\/p>\n<p>^%(__prefix_line)<\/p>\n<p>from the beginning of the regex<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I noticed some unusual activity on my webserver recently, and tracked it down to brute force attempts on wordpress installs.\u00a0 I did a little searching and found wp-fail2ban.\u00a0 Without too much tweaking of rsyslog, I got the auth messages to my firewall, where I set about getting fail2ban to monitor for login attempts.\u00a0 I was &hellip; <a href=\"https:\/\/www.mbcs.ca\/?p=7\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Fail2Ban and WordPress<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-firewallingsecurity"],"_links":{"self":[{"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"}],"version-history":[{"count":1,"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":8,"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions\/8"}],"wp:attachment":[{"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mbcs.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}