Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Simple iptables rules to block tor connections on your server
- # Created by Bruno P. Gonçalves
- # Configure
- _pub_if="eth0"
- IPTABLES=/sbin/iptables
- # Get exit ipts
- wget -q -O - "https://check.torproject.org/exit-addresses" > /tmp/full.tor
- grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /tmp/full.tor > /tmp/ips.tor
- # Create chain and add ips
- $IPTABLES -N torlist
- $IPTABLES -I INPUT -s 0.0.0.0/0 -j torlist
- while read ipaddr
- do
- $IPTABLES -I torlist -s $ipaddr -j DROP
- done </tmp/ips.tor | sort | uniq
- $IPTABLES -A torlist -j RETURN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement