diff --git a/scripts/_common.sh b/scripts/_common.sh index 8a9a903..fbec92f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,6 +11,9 @@ app_version=2023.4.1 py_required_version=3.10.11 pip_required="pip (<23.1,>=21.0)" +# Fail2ban +failregex="^%(__prefix_line)s.*\[homeassistant.components.http.ban\] Login attempt or request with invalid authentication from.* \(\).* Requested URL: ./auth/.*" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index a9b4c47..b0810b1 100644 --- a/scripts/install +++ b/scripts/install @@ -65,7 +65,7 @@ yunohost service add $app --description="Home Assistant server" --log="$log_file ynh_use_logrotate --logfile="$log_file" # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="$log_file" --failregex="[homeassistant.components.http.ban] Login attempt or request with invalid authentication from .* Requested URL: ./auth/" +ynh_add_fail2ban_config --logpath="$log_file" --failregex="$failregex" # Grant sudo permissions to the user to manage his own systemd service myynh_create_dir "/etc/sudoers.d" diff --git a/scripts/upgrade b/scripts/upgrade index 4ba196a..d0527c2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,7 @@ yunohost service add $app --description="Home Assistant server" --log="$log_file ynh_use_logrotate --logfile="$log_file" --non-append -ynh_add_fail2ban_config --logpath="$log_file" --failregex="[homeassistant.components.http.ban] Login attempt or request with invalid authentication from .* Requested URL: ./auth/" +ynh_add_fail2ban_config --logpath="$log_file" --failregex="$failregex" #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS, ...)