brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Home Assistant can ban an address after repeated failed logins

Home Assistant
~/tips/tip-ha-ip-ban

Unlimited login attempts: off

Slows down password guessing, and shows how to unban yourself.

If your instance is reachable from outside, someone will eventually try passwords on it. A ban after a few wrong ones is cheap insurance.

Switch it on in the web server settings:

Settings > System > Network > HTTP server
Enable IP banning: on
Unlimited login attempts: off
Login attempts before ban: 5

The number field only appears once unlimited attempts is off, and it accepts anything from 1 to 1000. Five is my pick: enough for a clumsy thumb, too few for guessing.

After the first ban, a file called ip_bans.yaml appears in the configuration folder, listing each banned address with the time it was added. Bans don’t expire by themselves. If you manage to lock yourself out, remove your entry from the file, or delete the file, and restart Home Assistant. That means you need a way in that doesn’t go through the web page, such as file access or SSH, so check you have one before enabling this.

Behind a reverse proxy, set up the trusted proxy settings first. If Home Assistant sees every visitor as the proxy’s address, one stranger’s failed attempts can ban the proxy, and with it everyone.

This is not a replacement for good credentials. Use a long unique password and turn on multi factor authentication in your profile too, since a patient attacker with many addresses is barely slowed by a per address limit.

Further reading: Home Assistant HTTP integration

Going deeper: Guide: Home Assistant backups in Docker, with a failure alert on your phone and a copy off the box

More Home Assistant tips Trust X-Forwarded-For: on automation: sequence: template: enabled: false All Home Assistant tips (11) All topics

Link