This commit is contained in:
Yuk1n0 2021-07-12 21:26:22 +08:00
parent f9a775cbeb
commit 6d8163c6d4
No known key found for this signature in database
GPG key ID: 19A0D6377E84BEE6

View file

@ -10,7 +10,7 @@ export PATH
# System Required: CentOS 6+, Debian7+, Ubuntu12+ # System Required: CentOS 6+, Debian7+, Ubuntu12+
# #
# Reference URL: # Reference URL:
# https://github.com/shadowsocks/ # https://github.com/shadowsocks
# https://github.com/shadowsocks/shadowsocks-libev # https://github.com/shadowsocks/shadowsocks-libev
# https://github.com/shadowsocksrr/shadowsocksr # https://github.com/shadowsocksrr/shadowsocksr
# #
@ -84,7 +84,7 @@ r_ciphers=(
) )
# Reference URL: # Reference URL:
# https://github.com/shadowsocksr-rm/shadowsocks-rss/blob/master/ssr.md # https://github.com/shadowsocksrr/shadowsocks-rss/blob/master/ssr.md
# https://github.com/shadowsocksrr/shadowsocksr/commit/a3cf0254508992b7126ab1151df0c2f10bf82680 # https://github.com/shadowsocksrr/shadowsocksr/commit/a3cf0254508992b7126ab1151df0c2f10bf82680
protocols=( protocols=(
origin origin
@ -296,18 +296,18 @@ install_dependencies() {
echo -e "[${green}Info${plain}] Checking the EPEL repository complete..." echo -e "[${green}Info${plain}] Checking the EPEL repository complete..."
yum_depends=( yum_depends=(
unzip gzip openssl openssl-devel gcc python python-devel python-setuptools pcre pcre-devel libtool libevent autoconf automake cpio curl curl-devel gcc git gzip libevent libev-devel libtool make openssl
autoconf automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel openssl-devel pcre pcre-devel perl perl-devel python python-devel python-setuptools
libev-devel c-ares-devel git qrencode qrencode unzip c-ares-devel expat-devel gettext-devel zlib-devel
) )
for depend in ${yum_depends[@]}; do for depend in ${yum_depends[@]}; do
error_detect_depends "yum -y install ${depend}" error_detect_depends "yum -y install ${depend}"
done done
elif check_sys packageManager apt; then elif check_sys packageManager apt; then
apt_depends=( apt_depends=(
gettext build-essential unzip gzip python python-dev python-setuptools curl openssl libssl-dev autoconf automake build-essential cpio curl gcc gettext git gzip libpcre3 libpcre3-dev
autoconf automake libtool gcc make perl cpio libpcre3 libpcre3-dev zlib1g-dev libev-dev libtool make openssl perl python python-dev python-setuptools qrencode unzip
libc-ares-dev git qrencode libc-ares-dev libev-dev libssl-dev zlib1g-dev
) )
apt -y update >/dev/null 2>&1 apt -y update >/dev/null 2>&1
@ -486,9 +486,9 @@ config_shadowsocks() {
"server":${server_value}, "server":${server_value},
"server_port":${shadowsocksport}, "server_port":${shadowsocksport},
"password":"${shadowsockspwd}", "password":"${shadowsockspwd}",
"method":"${shadowsockscipher}",
"timeout":300, "timeout":300,
"user":"nobody", "user":"nobody",
"method":"${shadowsockscipher}",
"fast_open":false "fast_open":false
} }
EOF EOF
@ -505,12 +505,12 @@ EOF
"local_address":"127.0.0.1", "local_address":"127.0.0.1",
"local_port":1080, "local_port":1080,
"password":"${shadowsockspwd}", "password":"${shadowsockspwd}",
"timeout":120,
"method":"${shadowsockscipher}", "method":"${shadowsockscipher}",
"protocol":"${shadowsockprotocol}", "protocol":"${shadowsockprotocol}",
"protocol_param":"", "protocol_param":"",
"obfs":"${shadowsockobfs}", "obfs":"${shadowsockobfs}",
"obfs_param":"", "obfs_param":"",
"timeout":120,
"redirect":"", "redirect":"",
"dns_ipv6":false, "dns_ipv6":false,
"fast_open":false "fast_open":false
@ -519,35 +519,6 @@ EOF
fi fi
} }
config_firewall() {
if centosversion 6; then
/etc/init.d/iptables status >/dev/null 2>&1
if [ $? -eq 0 ]; then
iptables -L -n | grep -i ${shadowsocksport} >/dev/null 2>&1
if [ $? -ne 0 ]; then
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${shadowsocksport} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${shadowsocksport} -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart
else
echo -e "[${green}Info${plain}] port ${green}${shadowsocksport}${plain} already be enabled."
fi
else
echo -e "[${yellow}Warning${plain}] iptables looks like not running or not installed, please enable port ${shadowsocksport} manually if necessary."
fi
elif centosversion 7; then
systemctl status firewalld >/dev/null 2>&1
if [ $? -eq 0 ]; then
default_zone=$(firewall-cmd --get-default-zone)
firewall-cmd --permanent --zone=${default_zone} --add-port=${shadowsocksport}/tcp
firewall-cmd --permanent --zone=${default_zone} --add-port=${shadowsocksport}/udp
firewall-cmd --reload
else
echo -e "[${yellow}Warning${plain}] firewalld looks like not running or not installed, please enable port ${shadowsocksport} manually if necessary."
fi
fi
}
download() { download() {
local filename=$(basename $1) local filename=$(basename $1)
if [ -f ${1} ]; then if [ -f ${1} ]; then
@ -586,6 +557,36 @@ download_files() {
fi fi
} }
config_firewall() {
if centosversion 6; then
/etc/init.d/iptables status >/dev/null 2>&1
if [ $? -eq 0 ]; then
iptables -L -n | grep -i ${shadowsocksport} >/dev/null 2>&1
if [ $? -ne 0 ]; then
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${shadowsocksport} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${shadowsocksport} -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart
else
echo
echo -e "[${green}Info${plain}] port ${green}${shadowsocksport}${plain} already be enabled."
fi
else
echo -e "[${yellow}Warning${plain}] iptables looks like not running or not installed, please enable port ${shadowsocksport} manually if necessary."
fi
elif centosversion 7; then
systemctl status firewalld >/dev/null 2>&1
if [ $? -eq 0 ]; then
default_zone=$(firewall-cmd --get-default-zone)
firewall-cmd --permanent --zone=${default_zone} --add-port=${shadowsocksport}/tcp
firewall-cmd --permanent --zone=${default_zone} --add-port=${shadowsocksport}/udp
firewall-cmd --reload
else
echo -e "[${yellow}Warning${plain}] firewalld looks like not running or not installed, please enable port ${shadowsocksport} manually if necessary."
fi
fi
}
install_libsodium() { install_libsodium() {
if [ -f /usr/lib/libsodium.a ] || [ -f /usr/lib64/libsodium.a ]; then if [ -f /usr/lib/libsodium.a ] || [ -f /usr/lib64/libsodium.a ]; then
echo echo
@ -981,7 +982,6 @@ upgrade_shadowsocks() {
shadowsockspwd=$(cat /etc/shadowsocks-libev/config.json | grep password | cut -d\" -f4) shadowsockspwd=$(cat /etc/shadowsocks-libev/config.json | grep password | cut -d\" -f4)
shadowsocksport=$(cat /etc/shadowsocks-libev/config.json | grep server_port | cut -d ',' -f1 | cut -d ':' -f2) shadowsocksport=$(cat /etc/shadowsocks-libev/config.json | grep server_port | cut -d ',' -f1 | cut -d ':' -f2)
shadowsockscipher=$(cat /etc/shadowsocks-libev/config.json | grep method | cut -d\" -f4) shadowsockscipher=$(cat /etc/shadowsocks-libev/config.json | grep method | cut -d\" -f4)
install_dependencies
config_shadowsocks config_shadowsocks
download_files download_files
install_shadowsocks_libev install_shadowsocks_libev