Skip to content

Instantly share code, notes, and snippets.

@nuriel77
Last active January 23, 2018 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuriel77/86a6c63c9d72e931d9c00908c701dcd6 to your computer and use it in GitHub Desktop.
Save nuriel77/86a6c63c9d72e931d9c00908c701dcd6 to your computer and use it in GitHub Desktop.
How to block tor network, set in cron to repeat every 6 hours, set for reboot
# Ubuntu install wget
apt-get install wget -y
# CentOS install wget
yum install -y wget
# Get the script
wget https://raw.githubusercontent.com/nuriel77/iri-playbook/master/roles/iri/files/block_tor.sh -O /usr/local/bin/block_tor.sh && chmod +x /usr/local/bin/block_tor.sh
# Run the script for the first time
/usr/local/bin/block_tor.sh
# Add a cron entry to run every 6 hrs (will update the ip list if any new addresses)
echo -e "@reboot root /usr/local/bin/block_tor.sh >/dev/null 2>&1\n0 */6 * * * root /usr/local/bin/block_tor.sh" >/etc/cron.d/block_tor
# As a bonus, for Ubuntu you can rate limit connections to the API port (change port number if yours is different):
ufw limit 14265/tcp comment "Rate limit IRI API"
# In CentOS: (change the port number here if your port is different)
firewall-cmd --remove-port=14265/tcp --zone=public --permanent && firewall-cmd --zone=public --permanent --add-rich-rule='rule port port="14265" protocol="tcp" limit value=12/m accept' && firewall-cmd --reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment