Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RELEASE='buster'
- IS_EXIT=false
- INSTALL_NYX=true
- CHECK_IPV6=true
- ENABLE_AUTO_UPDATE=true
- echo -e "\e[36m" #cyan
- cat << "EOF"
- _____ ___ _
- |_ _|__ _ _ ___| _ \___| |__ _ _ _ __ ___
- | |/ _ \ '_|___| / -_) / _` | || |_/ _/ _ \
- |_|\___/_| |_|_\___|_\__,_|\_, (_)__\___/
- |__/
- EOF
- echo -e "\e[39m" #default
- echo " [Relay Setup]"
- echo "This script will ask for your sudo password."
- echo "----------------------------------------------------------------------"
- echo "Updating package list..."
- sudo apt-get -y update > /dev/null
- echo "Installing necessary packages..."
- sudo apt-get -y install apt-transport-https psmisc dirmngr ntpdate curl > /dev/null
- echo "Updating NTP..."
- sudo ntpdate pool.ntp.org > /dev/null
- echo "Adding Torproject apt repository..."
- sudo touch /etc/apt/sources.list.d/tor1.list
- echo "deb https://deb.torproject.org/torproject.org $RELEASE main" | sudo tee /etc/apt/sources.list.d/tor1.list > /dev/null
- echo "deb-src https://deb.torproject.org/torproject.org $RELEASE main" | sudo tee --append /etc/apt/sources.list.d/tor1.list > /dev/null
- echo "Adding Torproject GPG key..."
- curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import > /dev/null
- gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add - > /dev/null
- echo "Updating package list..."
- sudo apt-get -y update > /dev/null
- if $INSTALL_NYX
- then
- echo "Installing NYX..."
- sudo apt-get -y install nyx > /dev/null
- fi
- echo "Installing Tor..."
- sudo apt-get -y install tor deb.torproject.org-keyring > /dev/null
- sudo chown -R debian-tor1:debian-tor1 /var/log/tor1
- echo "Setting Tor config..."
- cat << 'EOF' | sudo tee /etc/tor1/torrc > /dev/null
- SocksPort 0
- RunAsDaemon 1
- ORPort 9002
- ORPort [INSERT_IPV6_ADDRESS]:9002
- Nickname PIXEL02
- ContactInfo || PIXEL02 powered by createPixel.de || abuse@createpixel.de ||
- Log notice file /var/log/tor1/notices.log
- DirPort 9032
- ExitPolicy reject6 *:*, reject *:*
- DisableDebuggerAttachment 0
- ControlPort 9052
- CookieAuthentication 1
- EOF
- if $IS_EXIT
- then
- echo "Downloading Exit Notice to /etc/tor1/tor-exit-notice.html..."
- echo -e "\e[1mPlease edit this file and replace FIXME_YOUR_EMAIL_ADDRESS with your e-mail address!"
- echo -e "\e[1mAlso note that this is the US version. If you are not in the US please edit the file and remove the US-Only sections!\e[0m"
- sudo wget -q -O /etc/tor1/tor-exit-notice.html "https://raw.githubusercontent.com/flxn/tor-relay-configurator/master/misc/tor-exit-notice.html"
- fi
- if $CHECK_IPV6
- then
- IPV6_ADDRESS=$(ip -6 addr | grep inet6 | grep "scope global" | awk '{print $2}' | cut -d'/' -f1)
- if [ -z "$IPV6_ADDRESS" ]
- then
- sudo /etc/init.d/tor1 stop
- echo -e "\e[31mCould not automatically find your IPv6 address"
- sudo sed -i -e '/INSERT_IPV6_ADDRESS/d' /etc/tor1/torrc
- sudo sed -i -e 's/IPv6Exit 1/IPv6Exit 0/' /etc/tor1/torrc
- echo -e "\e[31mIPv6 support has been disabled\e[39m"
- echo "If you want to enable it manually find out your IPv6 address and add this line to your /etc/tor/torrc"
- echo "ORPort [YOUR_IPV6_ADDRESS]:YOUR_ORPORT (example: \"ORPort [2001:123:4567:89ab::1]:9001\")"
- echo "Then run \"sudo /etc/init.d/tor1 restart\" to rstart Tor"
- else
- sudo sed -i "s/INSERT_IPV6_ADDRESS/$IPV6_ADDRESS/" /etc/tor1/torrc
- echo -e "\e[32mIPv6 Support enabled ($IPV6_ADDRESS)\e[39m"
- fi
- fi
- if $ENABLE_AUTO_UPDATE
- then
- echo "Enabling unattended upgrades..."
- sudo apt-get install -y unattended-upgrades apt-listchanges
- DISTRO=$(lsb_release -is)
- sudo wget -q -O /etc/apt/apt.conf.d/50unattended-upgrades "https://raw.githubusercontent.com/flxn/tor-relay-configurator/master/misc/50unattended-upgrades.$DISTRO"
- fi
- sleep 10
- echo "Reloading Tor config..."
- sudo /etc/init.d/tor1 restart
- echo -e "\e[32mSetup finished\e[39m"
- echo "----------------------------------------------------------------------"
- echo "Tor will now check if your ports are reachable. This may take up to 20 minutes."
- echo "Check /var/log/tor/notices.log for an entry like:"
- echo "\"Self-testing indicates your ORPort is reachable from the outside. Excellent.\""
- echo "----------------------------------------------------------------------"
- #sleep 5
- #tail -f /var/log/tor/log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement