This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
traktor_arch.sh
126 lines (111 loc) · 4.29 KB
/
traktor_arch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
clear
echo -e "Traktor v1.7\nTor will be automatically installed and configured…\n\n"
function acceptance_agreement()
{
echo "This script is going to install these applications:"
echo "-------------------------------------------"
# Applications list
echo -e " * Tor\n * Obfs4proxy\n * dnscrypt-proxy\n * torbrowser-launcher\n * apt-transport-tor"
echo "-------------------------------------------"
echo "Do you agree ?(y/n)"
read answer
answer=${answer:-'y'} # set default value as yes
case $answer in
y|Y)
clear
echo "Start installation..."
;;
n|N)
echo "Cancel installation and exit..."
exit 2
;;
*)
echo "Wrong answer!"
echo "Exiting..."
exit
;;
esac
}
acceptance_agreement
# Install Packages
sudo pacman -Sy 1>/dev/null 2>&1
yaourt -S tor-browser-en-ir
sudo pacman -S tor obfsproxy privoxy dnscrypt-proxy torsocks
#configuring dnscrypt-proxy
sudo wget https://AmirrezaFiroozi.github.io/traktor/dnscrypt-proxy.service -O /usr/lib/systemd/system/dnscrypt-proxy.service > /dev/null
sudo systemctl daemon-reload
echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf >/dev/null
#sudo chattr +i /etc/resolv.conf
sudo systemctl enable dnscrypt-proxy.service
sudo systemctl start dnscrypt-proxy
if [ -f "/etc/tor/torrc" ]; then
echo "Backing up the old torrc to '/etc/tor/torrc.traktor-backup'..."
sudo cp /etc/tor/torrc /etc/tor/torrc.traktor-backup
fi
# Write Bridge
sudo wget https://ubuntu-ir.github.io/traktor/torrcV3 -O /etc/tor/torrc > /dev/null
# Make tor log directory
sudo systemctl start tor 1>/dev/null 2>&1
sudo systemctl stop tor 1>/dev/null 2>&1
sudo mkdir /var/log/tor/
sudo chown tor:tor /var/log/tor/
sudo chmod g+w /var/log/tor/
# Fix Apparmor problem
#sudo sed -i '27s/PUx/ix/' /etc/apparmor.d/abstractions/tor
#sudo apparmor_parser -r -v /etc/apparmor.d/system_tor
# Write Privoxy config
sudo perl -i -pe 's/^listen-address/#$&/' /etc/privoxy/config
echo 'logdir /var/log/privoxy
listen-address 0.0.0.0:8118
forward-socks5 / 127.0.0.1:9050 .
forward 192.168.*.*/ .
forward 10.*.*.*/ .
forward 127.*.*.*/ .
forward localhost/ .' | sudo tee -a /etc/privoxy/config > /dev/null
sudo systemctl enable privoxy
sudo systemctl restart privoxy.service
echo "Do you want to use tor on whole network? [y/N]"
echo "If press No you have to manually set proxy to SOCKS5 127.0.0.1:9050 or HTTP 127.0.0.1:8118"
read -n 1 SELECT
if [ "$SELECT" = "Y" -o "$SELECT" = "y" ]
then
# Set IP and Port on HTTP and SOCKS
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http host 127.0.0.1
gsettings set org.gnome.system.proxy.http port 8118
gsettings set org.gnome.system.proxy.socks host 127.0.0.1
gsettings set org.gnome.system.proxy.socks port 9050
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '::1', '192.168.0.0/16', '10.0.0.0/8', '172.16.0.0/12']"
fi
# Install Finish
echo -e "\nInstall Finished successfully…"
sudo systemctl start tor 1>/dev/null 2>&1
sudo systemctl enable tor 1>/dev/null 2>&1
# Wait for tor to establish connection
echo "Tor is trying to establish a connection. This may take long for some minutes. Please wait" | sudo tee /var/log/tor/log
bootstraped='n'
sudo systemctl restart tor
while [ $bootstraped == 'n' ]; do
if sudo cat /var/log/tor/log | grep "Bootstrapped 100%: Done"; then
bootstraped='y'
else
sleep 1
fi
done
#The following lines are commented because they were supposed to run in debian base distros
# Add tor repos
#echo "deb tor+http://deb.torproject.org/torproject.org stable main" | sudo tee /etc/apt/sources.list.d/tor.list > /dev/null
# Fetching Tor signing key and adding it to the keyring
#gpg --keyserver keys.gnupg.net --recv 886DDD89
#gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
# update tor from main repo
#sudo apt-get update > /dev/null
#sudo apt install -y \
# tor \
# obfs4proxy
# Fix Apparmor problem
#sudo sed -i '27s/PUx/ix/' /etc/apparmor.d/abstractions/tor
#sudo apparmor_parser -r -v /etc/apparmor.d/system_tor
# update finished
echo "Congratulations!!! Your computer is using Tor. may run tor-browser-en-ir now."