Do not ban supervisor ip if set (#33781)
* Use asynctest patch instead of mock_coro * Add test for supervisor ip ban * Do not ban supervisor ip if set * Extract supervisor ip helper * Check supervisor ip before banning * Remove added blank line * Clean up get supervisor ip Co-Authored-By: Pascal Vizeli <pvizeli@syshack.ch> Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
parent
8d61893c39
commit
c3decc6531
4 changed files with 82 additions and 16 deletions
|
@ -110,6 +110,12 @@ async def process_wrong_login(request):
|
|||
|
||||
request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr] += 1
|
||||
|
||||
# Supervisor IP should never be banned
|
||||
if "hassio" in hass.config.components and hass.components.hassio.get_supervisor_ip() == str(
|
||||
remote_addr
|
||||
):
|
||||
return
|
||||
|
||||
if (
|
||||
request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr]
|
||||
>= request.app[KEY_LOGIN_THRESHOLD]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue