Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.http.ban Namespace Reference

Classes

class  IpBan
 
class  IpBanManager
 

Functions

def _HassViewT
 
StreamResponse ban_middleware (Request request, Callable[[Request], Awaitable[StreamResponse]] handler)
 
None process_success_login (Request request)
 
None process_wrong_login (Request request)
 
None setup_bans (HomeAssistant hass, Application app, int login_threshold)
 

Variables

 Final
 
 KEY_BAN_MANAGER = AppKey["IpBanManager"]("ha_banned_ips_manager")
 
 KEY_FAILED_LOGIN_ATTEMPTS
 
 KEY_LOGIN_THRESHOLD = AppKey[int]("ban_manager.ip_bans_lookup")
 

Detailed Description

Ban logic for HTTP component.

Function Documentation

◆ _HassViewT()

def homeassistant.components.http.ban._HassViewT
private

Definition at line 92 of file ban.py.

◆ ban_middleware()

StreamResponse homeassistant.components.http.ban.ban_middleware ( Request  request,
Callable[[Request], Awaitable[StreamResponse]]   handler 
)
IP Ban middleware.

Definition at line 71 of file ban.py.

◆ process_success_login()

None homeassistant.components.http.ban.process_success_login ( Request  request)
Process a success login attempt.

Reset failed login attempts counter for remote IP address.
No release IP address from banned list function, it can only be done by
manual modify ip bans config file.

Definition at line 173 of file ban.py.

◆ process_wrong_login()

None homeassistant.components.http.ban.process_wrong_login ( Request  request)
Process a wrong login attempt.

Increase failed login attempts counter for remote IP address.
Add ip ban entry if failed login attempts exceeds threshold.

Definition at line 109 of file ban.py.

◆ setup_bans()

None homeassistant.components.http.ban.setup_bans ( HomeAssistant  hass,
Application  app,
int  login_threshold 
)
Create IP Ban middleware for the app.

Definition at line 56 of file ban.py.

Variable Documentation

◆ Final

homeassistant.components.http.ban.Final

Definition at line 36 of file ban.py.

◆ KEY_BAN_MANAGER

homeassistant.components.http.ban.KEY_BAN_MANAGER = AppKey["IpBanManager"]("ha_banned_ips_manager")

Definition at line 38 of file ban.py.

◆ KEY_FAILED_LOGIN_ATTEMPTS

homeassistant.components.http.ban.KEY_FAILED_LOGIN_ATTEMPTS
Initial value:
1 = AppKey[defaultdict[IPv4Address | IPv6Address, int]](
2  "ha_failed_login_attempts"
3 )

Definition at line 39 of file ban.py.

◆ KEY_LOGIN_THRESHOLD

homeassistant.components.http.ban.KEY_LOGIN_THRESHOLD = AppKey[int]("ban_manager.ip_bans_lookup")

Definition at line 42 of file ban.py.