bunkerweb/scripts/exit-nodes.sh
2020-10-24 20:48:04 +02:00

14 lines
414 B
Bash

#!/bin/sh
echo "" > /etc/nginx/block-tor-exit-node.conf
curl -s "https://iplists.firehol.org/files/tor_exits.ipset" | grep -v "^\#.*" |
while read entry ; do
check=$(echo $entry | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/?[0-9]*$")
if [ "$check" != "" ] ; then
echo "deny ${entry};" >> /etc/nginx/block-tor-exit-node.conf
fi
done
if [ -f /tmp/nginx.pid ] ; then
/usr/sbin/nginx -s reload
fi