From 76780787a9a072f7238f8e79a1d50a8e6e258c2f Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:42:08 +1100 Subject: [PATCH] Filter out my IP from being added to reject list --- ufwReject.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ufwReject.sh b/ufwReject.sh index 8dd9e49..40e809a 100755 --- a/ufwReject.sh +++ b/ufwReject.sh @@ -17,8 +17,9 @@ new_ips=0 # Populate the UFW reject rule with the IP addresses collected from the kernel log while IFS= read -r ip do + ip_prefix="${ip%.*}" # Check if the IP is already in the UFW rules - if ! ufw status | grep -q "$ip" + if ! ufw status | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ] then ufw reject from $ip # Increment the counter