yanglei

by ylzuimeng
20 deployments · 10 still active · last rev. 4 months ago

Compatible with: Ubuntu 16.04 LTS
						#!/bin/bash


# <UDF name="SERVER_PORT" Label="Shadowsocks Server Port" default="8388" />
# <UDF name="LOCAL_ADDRESS" Label="Local Address" default="127.0.0.1" />
# <UDF name="LOCAL_PORT" Label="Local Port" default="1080" />
# <UDF name="PASSWORD" Label="Password" />
# <UDF name="METHOD" Label="Method" default="rc4-md5" />

# <UDF name="VPN_IPSEC_PSK" Label="IPsec Pre-Shared Key" />
# <UDF name="VPN_USER" Label="VPN Username" />
# <UDF name="VPN_PASSWORD" Label="VPN Password" />

cat >>/etc/gai.conf<<EOF
precedence ::ffff:0:0/96  100
EOF

sudo apt-get update

sudo apt-get install -y python-pip
pip install --upgrade pip

sudo pip install shadowsocks
sudo apt-get install -y python-m2crypto

cat >>/etc/shadowsocks.json<<EOF
{
  "server":"0.0.0.0",
  "server_port":$SERVER_PORT,
  "password":"$PASSWORD",
  "local_address":"$LOCAL_ADDRESS",
  "local_port":$LOCAL_PORT,
  "method":"$METHOD",
  "timeout":300
}
EOF

sudo chmod 755 /etc/shadowsocks.json

cat >>/etc/rc.local<<EOF
/usr/local/bin/ssserver –c /etc/shadowsocks.json
EOF

sudo ssserver -c /etc/shadowsocks.json -d start

if [ -f /etc/apt/sources.list ]; then
  url=vpnsetup
  apt-get -y update
  apt-get -y install wget
elif [ -f /etc/yum.conf ]; then
  url=vpnsetup-centos
  yum -y install wget
else
  echo "Your distribution is not supported by this StackScript"
  exit 1
fi

wget "https://git.io/$url" -O /tmp/vpn.sh && sh /tmp/vpn.sh && rm -f /tmp/vpn.sh