This issue is so frustrating, when I happens to me I can fix it, a but when it happens to any other family members or an not attended device is a whole other thing.
I have seen some of the comments of the declined PRs and to be honest I do not understand the logic. It says it is declined because “it is a huge security issue”. But disabling IP bans is also a security issue…
I like that, as the UI would need to use a REST API and then a “whitelist automation” could be written to periodically remove the bans from specific IPs
Especially with that, it would put the onus on the user to make sure the security is kept, and not on the developers. Which should give a win/win scenario.
We are forced to disable the ip_ban option, potentially creating a huge security issue, because it’s possible to get one’s local IP banned.
I don’t think the administrators have fully realized the huge gap in the system. They leave the user either without protection or with an unusable system.
4 years, 3 rejected PRs, and soon 200 votes… It’s time for this topic to change hands.
or maybe one option, simple option. “not ban local networks ips”
The problem as allways the same “baned a ip of the local network, like the router itsefl”.
A simple option to not ban this ip solve the hight percentage of the problems
I was hoping for an answer when hitting this post but it seems this has been an issue for a long time. For us it only seems to happen on my wife’s phone. We both have Pixel 9s and I have cleared her cache, storage and reinstalled without any luck. On my phone my app has 2 servers it can talk to as I manage my mother in laws house as well and I have 2 widgets on my phones home screen. I would love for this to be taken care of as the wife is growing tired of this and I can’t blame her.
In /etc/periodic/hourlyI have a script called remove_bans.sh:
The contents are:
#!/bin/bash
FILE="/config/ip_bans.yaml"
TMP_FILE="$(mktemp)"
# Backup the original for comparison
cp "$FILE" "$TMP_FILE"
# Remove specific IP blocks
sed -i '/^127\.0\.0\.1:$/,+1d' "$FILE"
sed -i '/^123\.123\.234\.234:$/,+1d' "$FILE" # Personal IP - Changed for public visibility
# Remove 192.168.x.x blocks
sed -i '/^192\.168\.[0-9]\{1,3\}\.[0-9]\{1,3\}:$/,+1d' "$FILE"
# Compare original and modified file
if ! cmp -s "$FILE" "$TMP_FILE"; then
echo "Changes detected in $FILE. Restarting Home Assistant Core..."
ha core restart
else
echo "No changes made to $FILE. Skipping restart."
fi
# Clean up
rm "$TMP_FILE"
Add your own regex for your requirements, and it’s “ok”.
It’s not a whitelist by any form, but it deletes any entries on an hourly basis.
We really do need a whitelist function, however. The system shouldn’t be banning itself on a regular basis.
This automation and script is working fine for months but now docker restart homeassistant neither ha core restart working. The ip_bans.yaml is changing so the script runs, only the restart part is not working. Simply no restarting so the complete script is useless. What I am missing or what is changed in HAOS?
#! /bin/bash
ipbans="/config/ip_bans.yaml"
if [ -f $ipbans ]; then
if grep -q "192\.168\.1\." $ipbans; then
sed -i "/192\.168\.1\./,+1d" $ipbans
docker restart homeassistant
# ha core restart
fi
fi
Update: I get {'stdout': '', 'stderr': '/config/check_ipbans.sh: line 7: docker: command not found', 'returncode': 0}
and {'stdout': '', 'stderr': '/config/check_ipbans.sh: line 8: ha: command not found', 'returncode': 0}
but why?
Update: Ok its working with another logic but I still dont know why the previously working docker and ha command is not working now…
#! /bin/bash
ipbans="/config/ip_bans.yaml"
if [ -f $ipbans ]; then
if grep -q "192\.168\.1\." $ipbans; then
sed -i "/192\.168\.1\./,+1d" $ipbans
exit 100
fi
fi
exit 0
TL;DR
Can anyone explain in short how this happens?
Background: been running HA since 2021.10 w/ official Android companion app… never had such blockage until lately 2025.06. Home network changed to Unifi network a few months back.