-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathss-init-centos.sh
37 lines (30 loc) · 979 Bytes
/
ss-init-centos.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
#!/bin/bash
read -p 'Enter the IP for current server: ' SVR_IP
read -p 'Specify the port to expose: ' SVR_PORT
read -p 'Set the connection password as: ' SVR_PWD
echo "{
\"server\": \"$SVR_IP\",
\"server_port\": $SVR_PORT,
\"local_address\": \"127.0.0.1\",
\"local_port\": 1080,
\"password\": \"$SVR_PWD\",
\"timeout\": 300,
\"method\": \"aes-256-cfb\",
\"fast_open\": false
}" > ./ssserver.json
# To install shadowsocks
yum -y install python-setuptools
easy_install pip && pip install shadowsocks
# REF: https://github.com/shadowsocks/shadowsocks/wiki/Optimizing-Shadowsocks
cp ./local.conf /etc/sysctl.d/local.conf
sysctl --system
# Check firewall
is_port_exposed=`firewall-cmd --query-port=$SVR_PORT/tcp`
if [[ $is_port_exposed != "yes" ]]; then
firewall-cmd --zone=public --add-port=$SVR_PORT/tcp --permanent
firewall-cmd --reload
fi
# Run ssserver
nohup ssserver -c ./ssserver.json -d start &
# To stop, run:
# ssserver -c ./ssserver.json -d stop