{"id":333,"date":"2016-01-04T20:25:52","date_gmt":"2016-01-04T20:25:52","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=333"},"modified":"2016-01-04T21:24:37","modified_gmt":"2016-01-04T21:24:37","slug":"fail2ban-on-centos-7-not-working-and-solution","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/01\/04\/fail2ban-on-centos-7-not-working-and-solution\/","title":{"rendered":"Fail2ban on CentOS 7 not working [and solution]"},"content":{"rendered":"<p>because configuration settings in fail2ban 0.9.0 having been completely re-factored, CentOS7 fail2ban hardening automation now is not safe by merely running an yum install fail2ban.<\/p>\n<p>It will also apparently no longer work if you uncomment the sshd enabled jail in local.conf or jail.conf.<\/p>\n<p>The newer re-factored configuration suggests to use a dedicated file for this to prevent being overwritten as I have now set in my \/etc\/fail2ban\/jail.d\/sshd.local<\/p>\n[sshd]\nenabled = true<br \/>\nport = ssh<br \/>\n#action = firewallcmd-ipset<br \/>\nlogpath = %(sshd_log)s<br \/>\nmaxretry = 5<br \/>\nbantime = 86400<\/p>\n<p>Do note firewallcmd-ipset needs to be commented out or fail2ban will not start.<\/p>\n<p>Once it has been configured like this, it is happy again. And worked straight away banning my home IP! Whilst before it was quite literally failing to ban :- )<\/p>\n<p>Of course you might need to install it first:<\/p>\n<pre>\r\nyum install -y epel-release\r\nyum install -y fail2ban fail2ban-systemd\r\n<\/pre>\n<p>You might also want to start fail2ban, and also set it to run on startup:<\/p>\n<pre>\r\nsystemctl enable fail2ban\r\nsystemctl start fail2ban\r\n<\/pre>\n<p>If you run selinux, then you&#8217;ll need (running this command may have security implications)<\/p>\n<pre>\r\nyum update selinux-policy*\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>because configuration settings in fail2ban 0.9.0 having been completely re-factored, CentOS7 fail2ban hardening automation now is not safe by merely running an yum install fail2ban. It will also apparently no longer work if you uncomment the sshd enabled jail in &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/01\/04\/fail2ban-on-centos-7-not-working-and-solution\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,7,3,20],"tags":[],"class_list":["post-333","post","type-post","status-publish","format-standard","hentry","category-linux","category-management-tools","category-security","category-webhosting"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=333"}],"version-history":[{"count":5,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/333\/revisions\/338"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}