change default encryption method

added select stream cipher option

Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
Teddysun 2017-07-22 10:57:40 +09:00
parent d8af1ff67c
commit f235222053
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D
4 changed files with 211 additions and 111 deletions

View File

@ -168,7 +168,7 @@ pre_install(){
echo -e "Please input port for shadowsocks-go [1-65535]:" echo -e "Please input port for shadowsocks-go [1-65535]:"
read -p "(Default port: 8989):" shadowsocksport read -p "(Default port: 8989):" shadowsocksport
[ -z "${shadowsocksport}" ] && shadowsocksport="8989" [ -z "${shadowsocksport}" ] && shadowsocksport="8989"
expr ${shadowsocksport} + 0 &>/dev/null expr ${shadowsocksport} + 1 &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then
echo echo
@ -195,7 +195,7 @@ pre_install(){
done done
read -p "Which cipher you'd select(Default: ${ciphers[0]}):" pick read -p "Which cipher you'd select(Default: ${ciphers[0]}):" pick
[ -z "$pick" ] && pick=1 [ -z "$pick" ] && pick=1
expr ${pick} + 0 &>/dev/null expr ${pick} + 1 &>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "[${red}Error${plain}] Input error, please input a number" echo -e "[${red}Error${plain}] Input error, please input a number"
continue continue

View File

@ -16,15 +16,35 @@ libsodium_file="libsodium-1.0.13"
libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.13/libsodium-1.0.13.tar.gz" libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.13/libsodium-1.0.13.tar.gz"
mbedtls_file="mbedtls-2.5.1" mbedtls_file="mbedtls-2.5.1"
mbedtls_url="https://tls.mbed.org/download/mbedtls-2.5.1-gpl.tgz" mbedtls_url="http://dl.teddysun.com/files/mbedtls-2.5.1-gpl.tgz"
# Stream Ciphers
ciphers=(
aes-256-gcm
aes-192-gcm
aes-128-gcm
aes-256-ctr
aes-192-ctr
aes-128-ctr
aes-256-cfb
aes-192-cfb
aes-128-cfb
camellia-128-cfb
camellia-192-cfb
camellia-256-cfb
chacha20-ietf-poly1305
chacha20-ietf
chacha20
rc4-md5
)
# Color
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
# Make sure only root can run our script # Make sure only root can run our script
rootness(){ [[ $EUID -ne 0 ]] && echo -e "[${red}Error${plain}] This script must be run as root!" && exit 1
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root!" 1>&2
exit 1
fi
}
# Disable selinux # Disable selinux
disable_selinux(){ disable_selinux(){
@ -174,7 +194,7 @@ debianversion(){
pre_install(){ pre_install(){
# Check OS system # Check OS system
if ! check_sys packageManager apt; then if ! check_sys packageManager apt; then
echo "Error: Your OS is not supported to run it! Please change OS to Debian/Ubuntu and try again." echo -e "[${red}Error${plain}] Your OS is not supported to run it, please change OS to Debian/Ubuntu and try again."
exit 1 exit 1
fi fi
@ -182,13 +202,12 @@ pre_install(){
check_version check_version
status=$? status=$?
if [ ${status} -eq 0 ]; then if [ ${status} -eq 0 ]; then
echo "Latest version ${shadowsocks_libev_ver} has been installed, nothing to do..." echo -e "[${green}Info${plain}] Latest version ${green}${shadowsocks_libev_ver}${plain} has already been installed, nothing to do..."
echo
exit 0 exit 0
elif [ ${status} -eq 1 ]; then elif [ ${status} -eq 1 ]; then
echo "Installed version: ${installed_ver}" echo -e "Installed version: ${red}${installed_ver}${plain}"
echo "Latest version: ${latest_ver}" echo -e "Latest version: ${red}${latest_ver}${plain}"
echo "Upgrade shadowsocks libev to latest version..." echo -e "[${green}Info${plain}] Upgrade shadowsocks libev to latest version..."
ps -ef | grep -v grep | grep -i "ss-server" > /dev/null 2>&1 ps -ef | grep -v grep | grep -i "ss-server" > /dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
/etc/init.d/shadowsocks stop /etc/init.d/shadowsocks stop
@ -196,11 +215,11 @@ pre_install(){
elif [ ${status} -eq 2 ]; then elif [ ${status} -eq 2 ]; then
print_info print_info
get_latest_version get_latest_version
echo "Latest version: ${shadowsocks_libev_ver}" echo -e "[${green}Info${plain}] Latest version: ${green}${shadowsocks_libev_ver}${plain}"
echo echo
fi fi
#Set shadowsocks-libev config password # Set shadowsocks-libev config password
echo "Please input password for shadowsocks-libev:" echo "Please input password for shadowsocks-libev:"
read -p "(Default password: teddysun.com):" shadowsockspwd read -p "(Default password: teddysun.com):" shadowsockspwd
[ -z "${shadowsockspwd}" ] && shadowsockspwd="teddysun.com" [ -z "${shadowsockspwd}" ] && shadowsockspwd="teddysun.com"
@ -210,13 +229,13 @@ pre_install(){
echo "---------------------------" echo "---------------------------"
echo echo
#Set shadowsocks-libev config port # Set shadowsocks-libev config port
while true while true
do do
echo -e "Please input port for shadowsocks-libev [1-65535]:" echo -e "Please input port for shadowsocks-libev [1-65535]:"
read -p "(Default port: 8989):" shadowsocksport read -p "(Default port: 8989):" shadowsocksport
[ -z "$shadowsocksport" ] && shadowsocksport="8989" [ -z "$shadowsocksport" ] && shadowsocksport="8989"
expr ${shadowsocksport} + 0 &>/dev/null expr ${shadowsocksport} + 1 &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then
echo echo
@ -226,13 +245,41 @@ pre_install(){
echo echo
break break
else else
echo "Input error, please input correct number" echo -e "[${red}Error${plain}] Input error, please input a number between 1 and 65535"
fi fi
else else
echo "Input error, please input correct numbers" echo -e "[${red}Error${plain}] Input error, please input a number between 1 and 65535"
fi fi
done done
# Set shadowsocks config stream ciphers
while true
do
echo -e "Please select stream cipher for shadowsocks-libev:"
for ((i=1;i<=${#ciphers[@]};i++ )); do
hint="${ciphers[$i-1]}"
echo -e "${green}${i}${plain}) ${hint}"
done
read -p "Which cipher you'd select(Default: ${ciphers[0]}):" pick
[ -z "$pick" ] && pick=1
expr ${pick} + 1 &>/dev/null
if [ $? -ne 0 ]; then
echo -e "[${red}Error${plain}] Input error, please input a number"
continue
fi
if [[ "$pick" -lt 1 || "$pick" -gt ${#ciphers[@]} ]]; then
echo -e "[${red}Error${plain}] Input error, please input a number between 1 and ${#ciphers[@]}"
continue
fi
shadowsockscipher=${ciphers[$pick-1]}
echo
echo "---------------------------"
echo "cipher = ${shadowsockscipher}"
echo "---------------------------"
echo
break
done
echo echo
echo "Press any key to start...or press Ctrl+C to cancel" echo "Press any key to start...or press Ctrl+C to cancel"
char=`get_char` char=`get_char`
@ -251,14 +298,17 @@ pre_install(){
} }
download() { download() {
local filename=$(basename $1) local filename=${1}
if [ -f ${1} ]; then local cur_dir=`pwd`
echo "${filename} [found]" if [ -s ${filename} ]; then
echo -e "[${green}Info${plain}] ${filename} [found]"
else else
echo "${filename} not found, download now..." echo -e "[${green}Info${plain}] ${filename} not found, download now..."
wget --no-check-certificate -c -t3 -T60 -O ${1} ${2} wget --no-check-certificate -cq -t3 -T3 -O ${1} ${2}
if [ $? -ne 0 ]; then if [ $? -eq 0 ]; then
echo "Error: Download ${filename} failed." echo -e "[${green}Info${plain}] ${filename} download completed..."
else
echo -e "[${red}Error${plain}] Failed to download ${filename}, please download it to ${cur_dir} directory manually and try again."
exit 1 exit 1
fi fi
fi fi
@ -281,11 +331,11 @@ install_libsodium() {
cd ${libsodium_file} cd ${libsodium_file}
./configure --prefix=/usr && make && make install ./configure --prefix=/usr && make && make install
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: ${libsodium_file} install failed." echo -e "[${red}Error${plain}] ${libsodium_file} install failed."
exit 1 exit 1
fi fi
else else
echo "Info: ${libsodium_file} already installed." echo -e "[${green}Info${plain}] ${libsodium_file} already installed."
fi fi
} }
@ -296,8 +346,12 @@ install_mbedtls() {
cd ${mbedtls_file} cd ${mbedtls_file}
make SHARED=1 CFLAGS=-fPIC make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install make DESTDIR=/usr install
if [ $? -ne 0 ]; then
echo -e "[${red}Error${plain}] ${mbedtls_file} install failed."
exit 1
fi
else else
echo "Info: ${mbedtls_file} already installed." echo -e "[${green}Info${plain}] ${mbedtls_file} already installed."
fi fi
} }
@ -319,7 +373,7 @@ config_shadowsocks(){
"local_port":1080, "local_port":1080,
"password":"${shadowsockspwd}", "password":"${shadowsockspwd}",
"timeout":600, "timeout":600,
"method":"aes-256-cfb" "method":"${shadowsockscipher}"
} }
EOF EOF
} }
@ -330,7 +384,6 @@ install_shadowsocks(){
install_mbedtls install_mbedtls
ldconfig ldconfig
cd ${cur_dir} cd ${cur_dir}
tar zxf ${shadowsocks_libev_ver}.tar.gz tar zxf ${shadowsocks_libev_ver}.tar.gz
cd ${shadowsocks_libev_ver} cd ${shadowsocks_libev_ver}
@ -339,17 +392,16 @@ install_shadowsocks(){
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
chmod +x /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks
update-rc.d -f shadowsocks defaults update-rc.d -f shadowsocks defaults
ldconfig # Start shadowsocks
# Run shadowsocks in the background
/etc/init.d/shadowsocks start /etc/init.d/shadowsocks start
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Shadowsocks-libev start success!" echo -e "[${green}Info${plain}] Shadowsocks-libev start success!"
else else
echo "Shadowsocks-libev start failure!" echo -e "[${yellow}Warning${plain}] Shadowsocks-libev start failure!"
fi fi
else else
echo echo
echo "Shadowsocks-libev install failed! Please visit https://teddysun.com/358.html and contact." echo -e "[${red}Error${plain}] Shadowsocks-libev install failed. please visit https://teddysun.com/358.html and contact."
exit 1 exit 1
fi fi
@ -360,13 +412,11 @@ install_shadowsocks(){
clear clear
echo echo
echo "Congratulations, Shadowsocks-libev install completed!" echo -e "Congratulations, Shadowsocks-libev server install completed!"
echo -e "Your Server IP: \033[41;37m $(get_ip) \033[0m" echo -e "Your Server IP : \033[41;37m $(get_ip) \033[0m"
echo -e "Your Server Port: \033[41;37m ${shadowsocksport} \033[0m" echo -e "Your Server Port : \033[41;37m ${shadowsocksport} \033[0m"
echo -e "Your Password: \033[41;37m ${shadowsockspwd} \033[0m" echo -e "Your Password : \033[41;37m ${shadowsockspwd} \033[0m"
echo -e "Your Local IP: \033[41;37m 127.0.0.1 \033[0m" echo -e "Your Encryption Method: \033[41;37m ${shadowsockscipher} \033[0m"
echo -e "Your Local Port: \033[41;37m 1080 \033[0m"
echo -e "Your Encryption Method: \033[41;37m aes-256-cfb \033[0m"
echo echo
echo "Welcome to visit:https://teddysun.com/358.html" echo "Welcome to visit:https://teddysun.com/358.html"
echo "Enjoy it!" echo "Enjoy it!"
@ -375,7 +425,6 @@ install_shadowsocks(){
# Install Shadowsocks-libev # Install Shadowsocks-libev
install_shadowsocks_libev(){ install_shadowsocks_libev(){
rootness
disable_selinux disable_selinux
pre_install pre_install
download_files download_files

View File

@ -16,15 +16,35 @@ libsodium_file="libsodium-1.0.13"
libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.13/libsodium-1.0.13.tar.gz" libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.13/libsodium-1.0.13.tar.gz"
mbedtls_file="mbedtls-2.5.1" mbedtls_file="mbedtls-2.5.1"
mbedtls_url="https://tls.mbed.org/download/mbedtls-2.5.1-gpl.tgz" mbedtls_url="http://dl.teddysun.com/files/mbedtls-2.5.1-gpl.tgz"
# Stream Ciphers
ciphers=(
aes-256-gcm
aes-192-gcm
aes-128-gcm
aes-256-ctr
aes-192-ctr
aes-128-ctr
aes-256-cfb
aes-192-cfb
aes-128-cfb
camellia-128-cfb
camellia-192-cfb
camellia-256-cfb
chacha20-ietf-poly1305
chacha20-ietf
chacha20
rc4-md5
)
# Color
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
# Make sure only root can run our script # Make sure only root can run our script
rootness(){ [[ $EUID -ne 0 ]] && echo -e "[${red}Error${plain}] This script must be run as root!" && exit 1
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root!" 1>&2
exit 1
fi
}
# Disable selinux # Disable selinux
disable_selinux(){ disable_selinux(){
@ -180,11 +200,11 @@ pre_install(){
if check_sys sysRelease centos; then if check_sys sysRelease centos; then
# Not support CentOS 5 # Not support CentOS 5
if centosversion 5; then if centosversion 5; then
echo "Not support CentOS 5, please change to CentOS 6 or 7 and try again." echo -e "[${red}Error${plain}] Not support CentOS 5, please change to CentOS 6 or 7 and try again."
exit 1 exit 1
fi fi
else else
echo "Error: Your OS is not supported to run it, please change OS to CentOS and try again." echo -e "[${red}Error${plain}] Your OS is not supported to run it, please change OS to CentOS and try again."
exit 1 exit 1
fi fi
@ -192,13 +212,12 @@ pre_install(){
check_version check_version
status=$? status=$?
if [ ${status} -eq 0 ]; then if [ ${status} -eq 0 ]; then
echo "Latest version ${shadowsocks_libev_ver} has been installed, nothing to do..." echo -e "[${green}Info${plain}] Latest version ${green}${shadowsocks_libev_ver}${plain} has already been installed, nothing to do..."
echo
exit 0 exit 0
elif [ ${status} -eq 1 ]; then elif [ ${status} -eq 1 ]; then
echo "Installed version: ${installed_ver}" echo -e "Installed version: ${red}${installed_ver}${plain}"
echo "Latest version: ${latest_ver}" echo -e "Latest version: ${red}${latest_ver}${plain}"
echo "Upgrade shadowsocks libev to latest version..." echo -e "[${green}Info${plain}] Upgrade shadowsocks libev to latest version..."
ps -ef | grep -v grep | grep -i "ss-server" > /dev/null 2>&1 ps -ef | grep -v grep | grep -i "ss-server" > /dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
/etc/init.d/shadowsocks stop /etc/init.d/shadowsocks stop
@ -206,12 +225,12 @@ pre_install(){
elif [ ${status} -eq 2 ]; then elif [ ${status} -eq 2 ]; then
print_info print_info
get_latest_version get_latest_version
echo "Latest version: ${shadowsocks_libev_ver}" echo -e "[${green}Info${plain}] Latest version: ${green}${shadowsocks_libev_ver}${plain}"
echo echo
fi fi
# Set shadowsocks-libev config password # Set shadowsocks-libev config password
echo "Please input password for shadowsocks-libev" echo "Please input password for shadowsocks-libev:"
read -p "(Default password: teddysun.com):" shadowsockspwd read -p "(Default password: teddysun.com):" shadowsockspwd
[ -z "${shadowsockspwd}" ] && shadowsockspwd="teddysun.com" [ -z "${shadowsockspwd}" ] && shadowsockspwd="teddysun.com"
echo echo
@ -223,10 +242,10 @@ pre_install(){
# Set shadowsocks-libev config port # Set shadowsocks-libev config port
while true while true
do do
echo -e "Please input port for shadowsocks-libev [1-65535]" echo -e "Please input port for shadowsocks-libev [1-65535]:"
read -p "(Default port: 8989):" shadowsocksport read -p "(Default port: 8989):" shadowsocksport
[ -z "$shadowsocksport" ] && shadowsocksport="8989" [ -z "$shadowsocksport" ] && shadowsocksport="8989"
expr ${shadowsocksport} + 0 &>/dev/null expr ${shadowsocksport} + 1 &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then
echo echo
@ -236,31 +255,61 @@ pre_install(){
echo echo
break break
else else
echo "Input error, please input correct number" echo -e "[${red}Error${plain}] Input error, please input a number between 1 and 65535"
fi fi
else else
echo "Input error, please input correct number" echo -e "[${red}Error${plain}] Input error, please input a number between 1 and 65535"
fi fi
done done
# Set shadowsocks config stream ciphers
while true
do
echo -e "Please select stream cipher for shadowsocks-libev:"
for ((i=1;i<=${#ciphers[@]};i++ )); do
hint="${ciphers[$i-1]}"
echo -e "${green}${i}${plain}) ${hint}"
done
read -p "Which cipher you'd select(Default: ${ciphers[0]}):" pick
[ -z "$pick" ] && pick=1
expr ${pick} + 1 &>/dev/null
if [ $? -ne 0 ]; then
echo -e "[${red}Error${plain}] Input error, please input a number"
continue
fi
if [[ "$pick" -lt 1 || "$pick" -gt ${#ciphers[@]} ]]; then
echo -e "[${red}Error${plain}] Input error, please input a number between 1 and ${#ciphers[@]}"
continue
fi
shadowsockscipher=${ciphers[$pick-1]}
echo
echo "---------------------------"
echo "cipher = ${shadowsockscipher}"
echo "---------------------------"
echo
break
done
echo echo
echo "Press any key to start...or press Ctrl+C to cancel" echo "Press any key to start...or press Ctrl+C to cancel"
char=`get_char` char=`get_char`
#Install necessary dependencies #Install necessary dependencies
yum install -y epel-release yum install -y epel-release && yum makecache
yum install -y gcc gettext-devel unzip autoconf automake make zlib-devel libtool udns-devel libev-devel yum install -y unzip openssl openssl-devel gettext gcc autoconf libtool automake make asciidoc xmlto udns-devel libev-devel
yum install -y pcre pcre-devel perl perl-devel cpio expat-devel openssl-devel
} }
download() { download() {
local filename=$(basename $1) local filename=${1}
if [ -f ${1} ]; then local cur_dir=`pwd`
echo "${filename} [found]" if [ -s ${filename} ]; then
echo -e "[${green}Info${plain}] ${filename} [found]"
else else
echo "${filename} not found, download now..." echo -e "[${green}Info${plain}] ${filename} not found, download now..."
wget --no-check-certificate -c -t3 -T60 -O ${1} ${2} wget --no-check-certificate -cq -t3 -T3 -O ${1} ${2}
if [ $? -ne 0 ]; then if [ $? -eq 0 ]; then
echo "Error: Download ${filename} failed." echo -e "[${green}Info${plain}] ${filename} download completed..."
else
echo -e "[${red}Error${plain}] Failed to download ${filename}, please download it to ${cur_dir} directory manually and try again."
exit 1 exit 1
fi fi
fi fi
@ -283,11 +332,11 @@ install_libsodium() {
cd ${libsodium_file} cd ${libsodium_file}
./configure --prefix=/usr && make && make install ./configure --prefix=/usr && make && make install
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: ${libsodium_file} install failed." echo -e "[${red}Error${plain}] ${libsodium_file} install failed."
exit 1 exit 1
fi fi
else else
echo "Info: ${libsodium_file} already installed." echo -e "[${green}Info${plain}] ${libsodium_file} already installed."
fi fi
} }
@ -298,8 +347,12 @@ install_mbedtls() {
cd ${mbedtls_file} cd ${mbedtls_file}
make SHARED=1 CFLAGS=-fPIC make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install make DESTDIR=/usr install
if [ $? -ne 0 ]; then
echo -e "[${red}Error${plain}] ${mbedtls_file} install failed."
exit 1
fi
else else
echo "Info: ${mbedtls_file} already installed." echo -e "[${green}Info${plain}] ${mbedtls_file} already installed."
fi fi
} }
@ -321,14 +374,14 @@ config_shadowsocks(){
"local_port":1080, "local_port":1080,
"password":"${shadowsockspwd}", "password":"${shadowsockspwd}",
"timeout":600, "timeout":600,
"method":"aes-256-cfb" "method":"${shadowsockscipher}"
} }
EOF EOF
} }
# Firewall set # Firewall set
firewall_set(){ firewall_set(){
echo "firewall set start..." echo -e "[${green}Info${plain}] firewall set start..."
if centosversion 6; then if centosversion 6; then
/etc/init.d/iptables status > /dev/null 2>&1 /etc/init.d/iptables status > /dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@ -339,10 +392,10 @@ firewall_set(){
/etc/init.d/iptables save /etc/init.d/iptables save
/etc/init.d/iptables restart /etc/init.d/iptables restart
else else
echo "port ${shadowsocksport} has been set up." echo -e "[${green}Info${plain}] port ${shadowsocksport} has been set up."
fi fi
else else
echo "WARNING: iptables looks like shutdown or not installed, please manually set it if necessary." echo -e "[${yellow}Warning${plain}] iptables looks like shutdown or not installed, please manually set it if necessary."
fi fi
elif centosversion 7; then elif centosversion 7; then
systemctl status firewalld > /dev/null 2>&1 systemctl status firewalld > /dev/null 2>&1
@ -351,18 +404,18 @@ firewall_set(){
firewall-cmd --permanent --zone=public --add-port=${shadowsocksport}/udp firewall-cmd --permanent --zone=public --add-port=${shadowsocksport}/udp
firewall-cmd --reload firewall-cmd --reload
else else
echo "Firewalld looks like not running, try to start..." echo -e "[${green}Info${plain}] Firewalld looks like not running, try to start..."
systemctl start firewalld systemctl start firewalld
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
firewall-cmd --permanent --zone=public --add-port=${shadowsocksport}/tcp firewall-cmd --permanent --zone=public --add-port=${shadowsocksport}/tcp
firewall-cmd --permanent --zone=public --add-port=${shadowsocksport}/udp firewall-cmd --permanent --zone=public --add-port=${shadowsocksport}/udp
firewall-cmd --reload firewall-cmd --reload
else else
echo "WARNING: Try to start firewalld failed. please enable port ${shadowsocksport} manually if necessary." echo -e "[${yellow}Warning${plain}] Try to start firewalld failed. please enable port ${shadowsocksport} manually if necessary."
fi fi
fi fi
fi fi
echo "firewall set completed..." echo -e "[${green}Info${plain}] firewall set completed..."
} }
# Install Shadowsocks-libev # Install Shadowsocks-libev
@ -378,45 +431,54 @@ install_shadowsocks(){
make && make install make && make install
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
chmod +x /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks
# Add run on system start up
chkconfig --add shadowsocks chkconfig --add shadowsocks
chkconfig shadowsocks on chkconfig shadowsocks on
# Start shadowsocks # Start shadowsocks
/etc/init.d/shadowsocks start /etc/init.d/shadowsocks start
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Shadowsocks-libev start success!" echo -e "[${green}Info${plain}] Shadowsocks-libev start success!"
else else
echo "Shadowsocks-libev start failure!" echo -e "[${yellow}Warning${plain}] Shadowsocks-libev start failure!"
fi fi
else else
echo echo
echo "Shadowsocks-libev install failed! Please visit https://teddysun.com/357.html and contact." echo -e "[${red}Error${plain}] Shadowsocks-libev install failed. please visit https://teddysun.com/357.html and contact."
exit 1 exit 1
fi fi
cd ${cur_dir} cd ${cur_dir}
rm -rf ${shadowsocks_libev_ver} ${shadowsocks_libev_ver}.tar.gz rm -rf ${shadowsocks_libev_ver} ${shadowsocks_libev_ver}.tar.gz
rm -rf ${libsodium_file} ${libsodium_file}.tar.gz rm -rf ${libsodium_file} ${libsodium_file}.tar.gz
rm -rf ${mbedtls_file} ${mbedtls_file}-gpl.tgz
clear clear
echo echo
echo "Congratulations, Shadowsocks-libev install completed!" echo -e "Congratulations, Shadowsocks-libev server install completed!"
echo -e "Your Server IP: \033[41;37m $(get_ip) \033[0m" echo -e "Your Server IP : \033[41;37m $(get_ip) \033[0m"
echo -e "Your Server Port: \033[41;37m ${shadowsocksport} \033[0m" echo -e "Your Server Port : \033[41;37m ${shadowsocksport} \033[0m"
echo -e "Your Password: \033[41;37m ${shadowsockspwd} \033[0m" echo -e "Your Password : \033[41;37m ${shadowsockspwd} \033[0m"
echo -e "Your Local IP: \033[41;37m 127.0.0.1 \033[0m" echo -e "Your Encryption Method: \033[41;37m ${shadowsockscipher} \033[0m"
echo -e "Your Local Port: \033[41;37m 1080 \033[0m"
echo -e "Your Encryption Method: \033[41;37m aes-256-cfb \033[0m"
echo echo
echo "Welcome to visit:https://teddysun.com/357.html" echo "Welcome to visit:https://teddysun.com/357.html"
echo "Enjoy it!" echo "Enjoy it!"
echo echo
} }
# Install Shadowsocks-libev
install_shadowsocks_libev(){
disable_selinux
pre_install
download_files
config_shadowsocks
firewall_set
install_shadowsocks
}
# Uninstall Shadowsocks-libev # Uninstall Shadowsocks-libev
uninstall_shadowsocks_libev(){ uninstall_shadowsocks_libev(){
clear
print_info print_info
printf "Are you sure uninstall shadowsocks-libev? (y/n)" printf "Are you sure uninstall Shadowsocks-libev? (y/n)"
printf "\n" printf "\n"
read -p "(Default: n):" answer read -p "(Default: n):" answer
[ -z ${answer} ] && answer="n" [ -z ${answer} ] && answer="n"
@ -455,17 +517,6 @@ uninstall_shadowsocks_libev(){
fi fi
} }
# Install Shadowsocks-libev
install_shadowsocks_libev(){
rootness
disable_selinux
pre_install
download_files
config_shadowsocks
firewall_set
install_shadowsocks
}
# Initialization step # Initialization step
action=$1 action=$1
[ -z $1 ] && action=install [ -z $1 ] && action=install

View File

@ -173,7 +173,7 @@ pre_install(){
echo "Please input port for shadowsocks-python [1-65535]" echo "Please input port for shadowsocks-python [1-65535]"
read -p "(Default port: 8989):" shadowsocksport read -p "(Default port: 8989):" shadowsocksport
[ -z "$shadowsocksport" ] && shadowsocksport="8989" [ -z "$shadowsocksport" ] && shadowsocksport="8989"
expr ${shadowsocksport} + 0 &>/dev/null expr ${shadowsocksport} + 1 &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then
echo echo
@ -200,7 +200,7 @@ pre_install(){
done done
read -p "Which cipher you'd select(Default: ${ciphers[0]}):" pick read -p "Which cipher you'd select(Default: ${ciphers[0]}):" pick
[ -z "$pick" ] && pick=1 [ -z "$pick" ] && pick=1
expr ${pick} + 0 &>/dev/null expr ${pick} + 1 &>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "[${red}Error${plain}] Input error, please input a number" echo -e "[${red}Error${plain}] Input error, please input a number"
continue continue