forked from junhonglu/shadowsocksR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshadowsocksR-install.sh
84 lines (83 loc) · 2.04 KB
/
shadowsocksR-install.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
#!/bin/bash
OS=`cat /etc/issue |awk 'NR==1{print $1}'`
dir=/usr/local
ss=/shadowsocks
serverip=`ifconfig |grep venet0:0 -A1|awk -F ":" 'NR==2{print $2}'|sed 's/ .*//g'`
if [[ $UID -ne 0 ]]; then
echo "#####you must to user root,try to sudo#####"
exit 0
fi
echo "#########################################"
echo "Welcome to Shadowsocks-R install script##"
echo "Made by piaok.org ##"
echo "#########################################"
sleep 3
####this is to install base packe and git the Shadowsocks-R###
function ubunbase(){
apt-get install -y m2crypto git
cd /usr/local/
git clone -b manyuser https://github.com/breakwa11/shadowsocks.git
}
function centbase(){
yum install -y m2crypto git libsodium
cd /usr/local/
git clone -b manyuser https://github.com/breakwa11/shadowsocks.git
}
if [ $OS == Ubuntu ]; then
echo "this is ubuntu"
sleep 2
ubunbase
elif [ $OS == CentOS ]; then
echo "this is CentOS"
sleep 2
centbase
else
echo "###do not support you os###"
exit 1
fi
cd $dir$ss$ss
function config_shaodowsocks(){
cat > /etc/shadowsocks.json << EOF
{
"server": "$serverip",
"server_ipv6": "::",
"server_port": $local_port,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "$password",
"timeout": 120,
"method": "aes-256-cfb",
"protocol": "auth_sha1_compatible",
"protocol_param": "",
"obfs": "tls1.0_session_auth_compatible",
"obfs_param": "",
"redirect": "",
"dns_ipv6": false,
"fast_open": false,
"workers": 1
}
EOF
}
while :
do
read -p "input your serverport,between 1-65535:" local_port
if [ $local_port -ge 1 ] && [ $local_port -le 65535 ] ;then
break
else
echo "your port error,please input again "
fi
done
while :
do
read -p "input you passwd:" password
if [ ! -z $password ]; then
break
else
echo "you must input a passwd"
fi
done
config_shaodowsocks
python server.py -c /etc/shadowsocks.json -d start
if [[ $? -eq 0 ]]; then
echo "####you server sussful###"
fi