#!/bin/sh

###Warning:Not Modified

###Author:lichdiamond

###Date:2016-06-27

VARS=$#

if [ $VARS -lt 2 ];

then

    echo "please input your \"public_ip port\" as the para"

    exit 0;

fi

P_IP=$1

P_PORT=$2

yum -y install gcc gcc-c++ automake make pam-devel openldap-devel cyrus-sasl-devel openssl openssl-devel

wget http://sourceforge.net/projects/ss5/files/ss5/3.8.9-5/ss5-3.8.9-5.tar.gz/download

tar -zxf download&&rm -rf download

cd ss5-3.8.9

./configure && make && make install

cd ../

rm -rf ss5-3.8.9

chmod +x /etc/init.d/ss5

chkconfig --add ss5

chkconfig --level 345 ss5 on

sed -i '1,$ s/\#auth/auth/g' /etc/opt/ss5/ss5.conf

sed -i '1,$ s/\#permit/permit/g' /etc/opt/ss5/ss5.conf

echo "noadmin nooneknowpass" > /etc/opt/ss5/ss5.passwd

#curl http://118.184.176.13/dyndns/getip

echo "SS5_OPTS=\"-b $P_IP:$P_PORT\"" >> /etc/sysconfig/ss5

service ss5 start

netstat -apn | grep $P_PORT