add exclude ip
This commit is contained in:
parent
3c1f18d417
commit
ccc12e6b6f
@ -3,7 +3,7 @@ MAIL=/tmp/mail
|
|||||||
SERVER_LOG=/var/log/nginx
|
SERVER_LOG=/var/log/nginx
|
||||||
HOST=($(cat /etc/sentinel/virtualhost))
|
HOST=($(cat /etc/sentinel/virtualhost))
|
||||||
BLACKLIST=/etc/sentinel/blacklist
|
BLACKLIST=/etc/sentinel/blacklist
|
||||||
|
EXCLUDE=/etc/sentinel/exclude
|
||||||
|
|
||||||
chain_count=$(/usr/sbin/iptables -L BLACKLIST -n | wc -l)
|
chain_count=$(/usr/sbin/iptables -L BLACKLIST -n | wc -l)
|
||||||
if [ ${chain_count} -eq 0 ]; then
|
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)
|
count=$(cat /tmp/blacklist_404 /tmp/blacklist_400 |grep -f ${BLACKLIST} -v |sort |uniq |wc -l)
|
||||||
if [ ${count} -ne 0 ]; then
|
if [ ${count} -ne 0 ]; then
|
||||||
echo "Nouvelle IP blacklisté" > ${MAIL}
|
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[@]}
|
for j in ${list_ip[@]}
|
||||||
do
|
do
|
||||||
echo ${j} >> ${MAIL}
|
echo ${j} >> ${MAIL}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user