diff --git a/atom.xml b/atom.xml index 0a7ef85121..6d440bc45d 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/announcements/atom.xml b/blog/categories/announcements/atom.xml index 59f19d9e65..673456c188 100644 --- a/blog/categories/announcements/atom.xml +++ b/blog/categories/announcements/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Announcements | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index dde7107d51..c195d546a6 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Community | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 07305c7f10..39c00c8d01 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index d5411424d5..9afa8c2687 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index ea78599b64..ad43515b9f 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index 1c0c5e4cc5..23c943903b 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index a32c39413e..aa146943e1 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index 003d5c8e75..c6bf471512 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/merchandise/atom.xml b/blog/categories/merchandise/atom.xml index eb65cc5950..2410081663 100644 --- a/blog/categories/merchandise/atom.xml +++ b/blog/categories/merchandise/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Merchandise | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index cd6bc2f31c..2ce9a8d22f 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index d753b2716e..37fa00f6d0 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index 3d5e912d0a..48f904c0a9 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index ae470c256f..735a4f36c3 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index 2c3e604839..ff6cbdf352 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index 97c82236c2..6881fe4dda 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index f729d06c2c..2b0e09d513 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index 5b21b49802..7b4b030945 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index beb00067de..e45c7fe93b 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index 5f4e5a40ed..8cb4a0f26d 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index 29b21e12dc..fc3f69a093 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index a1169f8c95..235666ebc6 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index 1c80ecb942..35266d435c 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2017-05-25T08:05:38+00:00 + 2017-05-25T08:19:09+00:00 https://home-assistant.io/ diff --git a/cookbook/fail2ban/index.html b/cookbook/fail2ban/index.html new file mode 100644 index 0000000000..1911e27f7b --- /dev/null +++ b/cookbook/fail2ban/index.html @@ -0,0 +1,194 @@ + + + + + + + + + fail2ban for HASS - Home Assistant + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+

+ Fail2ban for HASS +

+
+
+

This is a quick guide on how to setup fail2ban for Home Assistant. This was originally in the forum but I created this here for people.

+

First install fail2ban. On Debian/Ubuntu this would be apt-get install fail2ban. On other distros you can google it.

+

Next we will be creating these three files :

+
    +
  • /etc/fail2ban/fail2ban.local
  • +
  • /etc/fail2ban/filter.d/hass.local
  • +
  • /etc/fail2ban/jail.local
  • +
+

Contents of /etc/fail2ban/fail2ban.local:

+
[Definition]
+logtarget = SYSLOG
+
+
+

Contents of /etc/fail2ban/filter.d/hass.local:

+
[INCLUDES]
+before = common.conf
+
+[Definition]
+failregex = ^%(__prefix_line)s.*Login attempt or request with an invalid password from <HOST>.*$
+
+ignoreregex =
+
+[Init]
+datepattern = ^%%y-%%m-%%d %%H:%%M:%%S
+
+
+

Contents of /etc/fail2ban/jail.local (Note that you’ll need to change the logpath to match your logfile which will be different from the path listed.):

+
[hass-iptables]
+enabled = true
+filter = hass
+action = iptables-allports[name=HASS]
+logpath = /opt/hass-prod-cfg/home-assistant.log
+maxretry = 5
+
+
+

Finally restart fail2ban : sudo systemctl restart fail2ban

+

Check your log to make sure it read in your settings : tail -100 /var/log/syslog|grep fail

+

If all is well you should see this from your syslog:

+
May 24 20:58:01 homeauto fail2ban.server[14997]: INFO Stopping all jails
+May 24 20:58:02 homeauto fail2ban.jail[14997]: INFO Jail 'sshd' stopped
+May 24 20:58:02 homeauto fail2ban-client[15206]: Shutdown successful
+May 24 20:58:02 homeauto fail2ban.server[14997]: INFO Exiting Fail2ban
+May 24 20:58:02 homeauto fail2ban-client[15213]: 2017-05-24 20:58:02,342 fail2ban.server         [15215]: INFO    Starting Fail2ban v0.9.6
+May 24 20:58:02 homeauto fail2ban-client[15213]: 2017-05-24 20:58:02,343 fail2ban.server         [15215]: INFO    Starting in daemon mode
+May 24 20:58:02 homeauto fail2ban.server[15217]: INFO Changed logging target to SYSLOG (/dev/log) for Fail2ban v0.9.6
+May 24 20:58:02 homeauto fail2ban.database[15217]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Creating new jail 'sshd'
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Jail 'sshd' uses pyinotify {}
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Initiated 'pyinotify' backend
+May 24 20:58:02 homeauto fail2ban.actions[15217]: INFO Set banTime = 600
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set findtime = 600
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set maxRetry = 5
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Added logfile = /var/log/auth.log
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set jail log file encoding to UTF-8
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set maxlines = 10
+May 24 20:58:02 homeauto fail2ban.server[15217]: INFO Jail sshd is not a JournalFilter instance
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Creating new jail 'hass-iptables'
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Jail 'hass-iptables' uses pyinotify {}
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Initiated 'pyinotify' backend
+May 24 20:58:02 homeauto fail2ban.actions[15217]: INFO Set banTime = 600
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set findtime = 600
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set maxRetry = 5
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Added logfile = /opt/hass-prod-cfg/home-assistant.log
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Set jail log file encoding to UTF-8
+May 24 20:58:02 homeauto fail2ban.filter[15217]: INFO Date pattern set to `'^%y-%m-%d %H:%M:%S'`: `^Year2-Month-Day 24hour:Minute:Second`
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Jail 'sshd' started
+May 24 20:58:02 homeauto fail2ban.jail[15217]: INFO Jail 'hass-iptables' started
+
+
+

That’s it!

+

If you want to read more about fail2ban, some links are below: +http://www.fail2ban.org/wiki/index.php/FEATURE_Split_config +https://www.digitalocean.com/community/tutorials/how-to-protect-ssh-with-fail2ban-on-ubuntu-14-04

+
+
+ +
+
+ + + + diff --git a/cookbook/index.html b/cookbook/index.html index dae6725488..29e4dc629c 100644 --- a/cookbook/index.html +++ b/cookbook/index.html @@ -207,7 +207,12 @@ A great place to find popular configurations is on this Infrastructure

User Interface

    diff --git a/cookbook/owntracks_two_mqtt_broker/index.html b/cookbook/owntracks_two_mqtt_broker/index.html index f5ae5c227a..2220f0e59b 100644 --- a/cookbook/owntracks_two_mqtt_broker/index.html +++ b/cookbook/owntracks_two_mqtt_broker/index.html @@ -157,6 +157,9 @@ Fill out
  • OwnTracks with two MQTT brokers
  • +
  • + fail2ban for HASS +
diff --git a/sitemap.xml b/sitemap.xml index df75251dc2..e176e05152 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -3075,6 +3075,9 @@ https://home-assistant.io/cookbook/automation_kodi_dynamic_input_select/ +https://home-assistant.io/cookbook/fail2ban/ + + https://home-assistant.io/docs/installation/python/ @@ -3463,62 +3466,62 @@ https://home-assistant.io/demo/frontend.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/index.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-event.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-info.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-service.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-state.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-template.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-history.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-iframe.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-logbook.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/demo/panels/ha-panel-map.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/googlef4f3693c209fe788.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00 https://home-assistant.io/static/mdi-demo.html -2017-05-25T08:04:50+00:00 +2017-05-25T08:18:17+00:00