From ccc12e6b6ff3b347d1f0e12dc290afbec153417d Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 4 Mar 2023 10:53:37 +0100 Subject: [PATCH] add exclude ip --- roles/deploy-web/files/blacklist.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/deploy-web/files/blacklist.sh b/roles/deploy-web/files/blacklist.sh index 40e1f6a..4d65ec8 100755 --- a/roles/deploy-web/files/blacklist.sh +++ b/roles/deploy-web/files/blacklist.sh @@ -3,7 +3,7 @@ MAIL=/tmp/mail SERVER_LOG=/var/log/nginx HOST=($(cat /etc/sentinel/virtualhost)) BLACKLIST=/etc/sentinel/blacklist - +EXCLUDE=/etc/sentinel/exclude chain_count=$(/usr/sbin/iptables -L BLACKLIST -n | wc -l) if [ ${chain_count} -eq 0 ]; then @@ -21,7 +21,7 @@ do count=$(cat /tmp/blacklist_404 /tmp/blacklist_400 |grep -f ${BLACKLIST} -v |sort |uniq |wc -l) if [ ${count} -ne 0 ]; then echo "Nouvelle IP blacklisté" > ${MAIL} - list_ip=($(cat /tmp/blacklist_400 /tmp/blacklist_404 |grep -f ${BLACKLIST} -v |sort |uniq)) + list_ip=($(cat /tmp/blacklist_400 /tmp/blacklist_404 |grep -f ${BLACKLIST} -v |grep -f ${EXCLUDE} -v |sort |uniq)) for j in ${list_ip[@]} do echo ${j} >> ${MAIL}