work on tor blocking detection
parent
a24086da62
commit
2ddeab8788
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Block Tor Exit nodes
|
||||||
|
# Adapted from: https://securityonline.info/block-tor-client-iptablesiptables-tor-transparent-proxy/
|
||||||
|
IPTABLES_TARGET="DROP"
|
||||||
|
IPTABLES_CHAINNAME="Tor"
|
||||||
|
if ! iptables -L Tor -n >/dev/null 2>&1 ; then
|
||||||
|
iptables -N Tor >/dev/null 2>&1
|
||||||
|
iptables -A OUTPUT -p tcp -j Tor 2>&1
|
||||||
|
fi
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
cd "$DIR/../"
|
||||||
|
iptables -F Tor
|
||||||
|
CMD=$(cat static-data/tor-node-list.dat | uniq | sort)
|
||||||
|
for IP in $CMD; do
|
||||||
|
if [[ $IP =~ .*:.* ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
let COUNT=COUNT+1
|
||||||
|
iptables -A Tor -d "$IP" -j DROP
|
||||||
|
done
|
||||||
|
iptables -A Tor -j RETURN
|
|
@ -22,6 +22,7 @@ import logger
|
||||||
|
|
||||||
def add_bridges(torrc: str) -> str:
|
def add_bridges(torrc: str) -> str:
|
||||||
"""Configure tor to use a bridge using Onionr config keys."""
|
"""Configure tor to use a bridge using Onionr config keys."""
|
||||||
|
config.reload()
|
||||||
if config.get('tor.use_bridge', False) is True:
|
if config.get('tor.use_bridge', False) is True:
|
||||||
bridge = config.get('tor.bridge_ip', None)
|
bridge = config.get('tor.bridge_ip', None)
|
||||||
if bridge is not None:
|
if bridge is not None:
|
||||||
|
@ -29,6 +30,7 @@ def add_bridges(torrc: str) -> str:
|
||||||
fingerprint = config.get('tor.bridge_fingerprint', '')
|
fingerprint = config.get('tor.bridge_fingerprint', '')
|
||||||
torrc += '\nUseBridges 1\nBridge %s %s\n' % (bridge, fingerprint)
|
torrc += '\nUseBridges 1\nBridge %s %s\n' % (bridge, fingerprint)
|
||||||
else:
|
else:
|
||||||
logger.warn('bridge was enabled but not specified in config')
|
logger.error('Bridge was enabled but not specified in config, ' +
|
||||||
|
'this probably won\'t work', terminal=True)
|
||||||
|
|
||||||
return torrc
|
return torrc
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue