{"id":60,"date":"2013-09-18T23:32:03","date_gmt":"2013-09-18T21:32:03","guid":{"rendered":"http:\/\/yves.laedis.ch\/cms\/?p=60"},"modified":"2016-01-03T21:15:14","modified_gmt":"2016-01-03T20:15:14","slug":"proxmox-3-install-and-setup-fail2ban","status":"publish","type":"post","link":"https:\/\/yves.laedis.ch\/cms\/proxmox-3-install-and-setup-fail2ban\/","title":{"rendered":"Proxmox 3 + 4 &#8211; install and setup fail2ban"},"content":{"rendered":"<p>to Prevent Brute-forcing of logins<\/p>\n<p><!--more--><\/p>\n<h2>install fail2ban<\/h2>\n<pre>apt-get install fail2ban<\/pre>\n<h2>\u00a0create the proxmox.local regex file<\/h2>\n<pre class=\"lang:default decode:true\">nano \/etc\/fail2ban\/filter.d\/proxmox.local<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\" title=\"\/etc\/fail2ban\/filter.d\/proxmox.local\"># Fail2Ban configuration file\r\n#\r\n# Author: eXtremeSHOK.com\r\n#\r\n# $Revision: 201 $\r\n#\r\n\r\n[Definition]\r\n\r\n# Option: failregex\r\n# Notes.: regex to match the password failure messages in the logfile. The\r\n# host must be matched by a group named \"host\". The tag \"\" can\r\n# be used for standard IP\/hostname matching and is only an alias for\r\n# (?:::f{4,6}:)?(?P\\S+)\r\n# Values: TEXT\r\n#\r\n\r\nfailregex = pvedaemon\\[.*authentication failure; rhost=&lt;HOST&gt; user=.*msg=.*\r\n\r\n# Option: ignoreregex\r\n# Notes.: regex to ignore. If this regex matches, the line is ignored.\r\n# Values: TEXT\r\n#\r\n\r\nignoreregex =<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u00a0Create fail2ban config for proxmox<\/h2>\n<p>We are also adding SSH and SSH DDOS protections<br \/>\nadd the following to the bottom of the\u00a0<em>\/etc\/fail2ban\/jail.local<\/em>\u00a0file<\/p>\n<pre class=\"lang:sh decode:true\" title=\"\/etc\/fail2ban\/jail.local\">##### PROXMOX START######\r\n[proxmox]\r\nenabled = true \r\nport = 8006\r\nfilter = proxmox\r\nlogpath = \/var\/log\/syslog\r\nmaxretry = 5\r\nbantime = 86400 #24hours\r\n##### PROXMOX3: END#####\r\n\r\n###### SSH: START######\r\n[ssh]\r\nenables = true\r\nport = ssh\r\nfilter = sshd\r\nlogpath = \/var\/log\/auth.log\r\nmaxretry = 5\r\nbantime = 86400 #24hours\r\n##### SSH: END######\r\n\r\n##### SSH ANTI-DDOS: START######\r\n[ssh-ddos]\r\nenabled = true\r\nport = ssh\r\nfilter = sshd-ddos\r\nlogpath = \/var\/log\/auth.log\r\nmaxretry = 5\r\n##### SSH ANTI-DDOS: END######<\/pre>\n<h2><strong><em>Optional:<\/em>\u00a0Test fail2ban<\/strong><\/h2>\n<div id=\"crayon-5239466d8833d467220112\" data-settings=\" minimize scroll-always\">\n<div data-settings=\" show\">\n<div title=\"Toggle Line Numbers\">\n<pre class=\"lang:default decode:true \">\u00a0fail2ban-regex \/var\/log\/syslog \/etc\/fail2ban\/filter.d\/proxmox.local<\/pre>\n<p><strong style=\"font-size: 1.5em;\">Restart fail2ban to apply the setting<\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"crayon-5239466d88342272444882\" data-settings=\" minimize scroll-always\">\n<div data-settings=\" show\">\n<div title=\"Toggle Line Numbers\">\n<pre class=\"lang:default decode:true \">\u00a0service fail2ban restart<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<h2><strong>Removing a banned ip<\/strong><\/h2>\n<div id=\"crayon-5239466d88348378839020\" data-settings=\" minimize scroll-always\">\n<div data-settings=\" show\">\n<div title=\"Toggle Line Numbers\">\n<pre>iptables -L fail2ban-proxmox -n -v --line-numbers<\/pre>\n<pre class=\"lang:default decode:true \">iptables -D fail2ban-proxmox 1<\/pre>\n<h2><strong>Viewing banned ip\u2019s and the status of the filter<\/strong><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"crayon-5239466d8834e346512642\" data-settings=\" minimize scroll-always\">\n<div data-settings=\" show\">\n<div title=\"Toggle Line Numbers\">\n<pre class=\"lang:default decode:true\">\u00a0fail2ban-client status proxmox<\/pre>\n<p>&nbsp;<\/p>\n<p>Quellen:<\/p>\n<p><a href=\"http:\/\/forum.proxmox.com\/threads\/3583-How-To-implement-Fail2Ban-on-Host\">http:\/\/forum.proxmox.com\/threads\/3583-How-To-implement-Fail2Ban-on-Host<\/a><\/p>\n<p><a href=\"https:\/\/extremeshok.com\/2012\/07\/23\/proxmox-2-proxmox-3-server-security-post-installation-fail2ban-sysctl-hosts-ip-spoofing-iptables-for-openvz-containers\/\">https:\/\/extremeshok.com\/2012\/07\/23\/proxmox-2-proxmox-3-server-security-post-installation-fail2ban-sysctl-hosts-ip-spoofing-iptables-for-openvz-containers\/<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>to Prevent Brute-forcing of logins<\/p><p><a class=\"more-link btn\" href=\"https:\/\/yves.laedis.ch\/cms\/proxmox-3-install-and-setup-fail2ban\/\">Weiterlesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[13,10],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-computers","tag-fail2ban","tag-proxmox","item-wrap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4ixHP-Y","_links":{"self":[{"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":17,"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/posts\/60\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yves.laedis.ch\/cms\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}