Skip to content

Instantly share code, notes, and snippets.

@Ramblurr
Created November 14, 2012 14:58
Show Gist options
  • Save Ramblurr/4072585 to your computer and use it in GitHub Desktop.
Save Ramblurr/4072585 to your computer and use it in GitHub Desktop.
Setup tor relay on debian squeeze
#!/bin/bash
####
# Simple tor relay (non-exit) setup for Debian squeeze
####
# begin user config
EXTERNAL_IP= # your external ip
MAX_MONTHLY_BW= # maximum GB per month you can spare for a tor relay
NICKNAME=atorrelay # custom nickname (will show in tor directory)
RELAY_PORT=443 # port to accept incoming connections on (open in your firewall!)
# end of user config
###########################
daily_bw=$(($MAX_MONTHLY_BW/30))
relay_bw_rate=$(($daily_bw*20))
gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo apt-get install deb.torproject.org-keyring tor
sudo mv /etc/tor/torrc /etc/tor/torrc.orig
cat > /tmp/torrc << EOF
ORPort $RELAY_PORT
Nickname $NICKNAME
ExitPolicy reject *:* # no exits allowed
AccountingStart day 12:00
AccountingMax $daily_bw GB
RelayBandwidthRate $relay_bw_rate KB
RelayBandwidthBurst $relay_bw_rate KB
Address $EXTERNAL_IP
OutboundBindAddress $EXTERNAL_IP
EOF
sudo mv /tmp/torrc /etc/tor/torrc
sudo service tor restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment