A Home Assistant custom integration that prevents specific IP addresses and networks from being banned, with a user-friendly UI configuration interface.
- UI-Based Configuration — Manage allowlisted IPs through Home Assistant's Settings interface, no YAML editing required
- Add / Remove IPs Easily — Add or remove individual IPs and CIDR networks at any time via the Configure button
- View Current Allowlist — See all allowlisted entries at a glance in the options dialog
- Prevents Bans at the Source — Intercepts Home Assistant's
process_wrong_loginfunction before the ban, notification, and failed-login counter are created - Automatic Ban Removal — Scans and removes any allowlisted IPs from
ip_bans.yamlon startup - Auto-cleanup — Deletes
ip_bans.yamlautomatically when it becomes empty - IPv4 and IPv6 Support — Single addresses, CIDR networks, and IPv6 addresses/networks are all supported
- Comprehensive Logging — Detailed debug and info logs for all actions
- Home Assistant 2025.12.0 or newer
http.ip_ban_enabled: truein yourconfiguration.yaml
- Open HACS in Home Assistant
- Go to Integrations
- Click the three dots in the top right → Custom repositories
- Add
https://github.com/KrX3D/ban_allowlistwith category Integration - Install IP Ban Allowlist
- Restart Home Assistant
- Copy the
ban_allowlistfolder into yourconfig/custom_components/directory:config/ └── custom_components/ └── ban_allowlist/ ├── __init__.py ├── config_flow.py ├── const.py ├── manifest.json ├── strings.json └── translations/ ├── de.json └── en.json - Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Search for Ban Allowlist and follow the setup dialog
- Go to Settings → Devices & Services
- Click Add Integration and search for Ban Allowlist
- Enter your IP addresses or networks, comma-separated
- Example:
192.168.1.100, 10.0.0.0/24, 2001:db8::1, 2001:db8::/32
- Example:
- Click Submit
- Go to Settings → Devices & Services
- Find IP Ban Allowlist and click Configure
- Choose an action:
- Add new IP address — Enter a single IP or CIDR network
- Remove IP address — Select an entry from the current list to remove
- Done — Save changes and close (changes are only committed when you select Done)
| Format | Example |
|---|---|
| Single IPv4 | 192.168.1.100 |
| IPv4 CIDR network | 192.168.1.0/24 |
| Single IPv6 | 2001:db8::1 |
| IPv6 CIDR network | 2001:db8::/32 |
The integration patches Home Assistant's internal process_wrong_login function in homeassistant/components/http/ban.py. This is the single function responsible for:
- Logging the "Login attempt or request with invalid authentication" warning
- Creating the
http-loginpersistent notification - Incrementing the failed-login counter
- Calling
async_add_ban(and creating theip-bannotification) when the threshold is reached
By wrapping this function, allowlisted IPs are silently skipped before any of those side effects occur — no notification is created, no counter is incremented, and no ban is written.
A second patch on IpBanManager.async_add_ban acts as a belt-and-suspenders guard in case any future HA code path bypasses process_wrong_login.
The integration cannot patch process_wrong_login until HA loads it during startup. If an allowlisted device sends a bad authentication request in the few seconds between the HTTP server starting and the integration loading, that single event will go through unpatched. This is a fundamental limitation of the approach and is not harmful in practice — no ban will be written until the login threshold is reached, and the integration will be fully active within seconds.
All patches are applied in memory at runtime and fully restored when the integration is unloaded or restarted. No HA core files are modified on disk.
Enable debug logging to see detailed output:
logger:
logs:
custom_components.ban_allowlist: debugExample log output when working correctly:
DEBUG Setting up Ban Allowlist for entry: Ban Allowlist
INFO Ban Allowlist initialized with 2 networks: ['192.168.1.0/24', '10.0.0.50/32']
DEBUG Patched ban_module.process_wrong_login
INFO Scanning existing bans for allowlisted IPs...
DEBUG Skipping process_wrong_login for allowlisted IP 192.168.1.55
DEBUG Skipping process_wrong_login for allowlisted IP 192.168.1.55
Logs are visible at Settings → System → Logs — search for ban_allowlist.
- Ensure all files are in the correct
custom_components/ban_allowlist/directory - Restart Home Assistant completely
- Check the logs for errors during startup
- Verify
http.ip_ban_enabled: trueis set — the integration requires the ban system to be active - Confirm the IP is in your allowlist (Settings → Devices & Services → IP Ban Allowlist → Configure)
- Check the logs for
Patched ban_module.process_wrong_login— if this line is missing, the patch did not apply - A single ban notification at startup is normal (see Startup Window above)
If you see:
ban_allowlist has ip_addresses in configuration.yaml AND is configured via the UI
Remove the ban_allowlist: section from configuration.yaml. The UI config entry manages everything — the YAML section is ignored when a UI entry exists.
If you previously used the YAML-based configuration:
- Note your current allowlisted IPs from
configuration.yaml - Add the integration via Settings → Devices & Services → Add Integration
- Enter your IPs in the setup dialog
- Remove the
ban_allowlist:section fromconfiguration.yaml - Restart Home Assistant
⚠️ Hack Warning: This integration modifies Home Assistant's internal HTTP ban middleware at runtime. It has been tested against HA 2025.12.0+ but may break if HA significantly refactorshomeassistant/components/http/ban.py. Use at your own risk.
⚠️ Security: Only allowlist IPs you trust. Allowlisted IPs can make unlimited failed authentication attempts without being banned or notified.
⚠️ Requirement:http.ip_ban_enabled: truemust be set inconfiguration.yaml.
For issues, questions, or contributions: https://github.com/KrX3D/ban_allowlist
GNU Affero General Public License v3 — see LICENSE for details.