Vegeta_Ssj

Run Own Obfs4Proxy Tor Bridge

Sep 8th, 2020 (edited)
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. if [ "$#" -eq 3 ]; then
  4.     IP=$1
  5.     LISTENING_PORT=$2
  6.     OR_PORT=$3
  7.  
  8. apt update
  9. apt upgrade
  10. apt install -y tor obfs4proxy ufw
  11. service tor stop
  12.  
  13. echo "RunAsDaemon 0" >> /etc/tor/torrc
  14. echo "ORPort $OR_PORT" >> /etc/tor/torrc
  15. echo "ExtORPort auto" >> /etc/tor/torrc
  16. echo "ExitPolicy reject *:*" >> /etc/tor/torrc
  17. echo "BridgeRelay 1" >> /etc/tor/torrc
  18. echo "PublishServerDescriptor 0" >> /etc/tor/torrc
  19. echo "ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy" >> /etc/tor/torrc
  20. echo "ServerTransportListenAddr obfs4 0.0.0.0:$LISTENING_PORT" >> /etc/tor/torrc
  21.  
  22. ufw allow $LISTENING_PORT
  23. ufw allow $OR_PORT
  24.  
  25. service tor start
  26.  
  27. OBFS4TEMPLATE=`tail -1 /var/lib/tor/pt_state/obfs4_bridgeline.txt`
  28. FINGERPRINT0=`cat /var/lib/tor/fingerprint`
  29. FINGERPRINT0=$(echo $FINGERPRINT0 | cut -d ' ' -f 2-)
  30. FINGERPRINT=${FINGERPRINT0#"Saiyajin "}
  31. OBFS4ADDRESS="${OBFS4TEMPLATE/<IP ADDRESS>/$IP}"
  32. OBFS4ADDRESS="${OBFS4ADDRESS/<PORT>/$LISTENING_PORT}"
  33. OBFS4ADDRESS="${OBFS4ADDRESS/<FINGERPRINT>/$FINGERPRINT}"
  34.  
  35. echo $OBFS4ADDRESS > ~/obfs4.address
  36.  
RAW Paste Data