Skip to content

Commit

Permalink
fix(脚本): 修改防火墙检测问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mack-a committed Apr 29, 2022
1 parent 4030b86 commit 6543332
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ checkCPUVendor() {
'amd64' | 'x86_64')
xrayCoreCPUVendor="Xray-linux-64"
v2rayCoreCPUVendor="v2ray-linux-64"
hysteriaCoreCPUVendor="hysteria-linux-amd64"
# hysteriaCoreCPUVendor="hysteria-linux-amd64"
;;
'armv8' | 'aarch64')
xrayCoreCPUVendor="Xray-linux-arm64-v8a"
v2rayCoreCPUVendor="v2ray-linux-arm64-v8a"
hysteriaCoreCPUVendor="hysteria-linux-arm64"
# hysteriaCoreCPUVendor="hysteria-linux-arm64"
;;
*)
echo " 不支持此CPU架构--->"
Expand All @@ -113,7 +113,7 @@ initVar() {
# 核心支持的cpu版本
xrayCoreCPUVendor=""
v2rayCoreCPUVendor=""
hysteriaCoreCPUVendor=""
# hysteriaCoreCPUVendor=""

# 域名
domain=
Expand Down Expand Up @@ -287,37 +287,27 @@ allowPort() {
iptables -I INPUT -p tcp --dport "$1" -m comment --comment "allow $1(mack-a)" -j ACCEPT
fi

# if ! iptables -L | grep -q "$1(mack-a)"; then
# updateFirewalldStatus=true
# iptables -I INPUT -p tcp --dport $1 -m comment --comment "allow $1(mack-a)" -j ACCEPT
# fi

if echo "${updateFirewalldStatus}" | grep -q "true"; then
netfilter-persistent save
fi
elif systemctl status ufw 2>/dev/null | grep -q "active (exited)"; then
if ! ufw status | grep -q "$1"; then
sudo ufw allow "$1"
checkUFWAllowPort "$1"
fi
# if ! ufw status | grep -q $1; then
# sudo ufw allow $1
# checkUFWAllowPort $1
# fi
elif systemctl status firewalld 2>/dev/null | grep -q "active (running)"; then
if ufw status | grep -q "Status: active"; then
if ! ufw status | grep -q "$1"; then
sudo ufw allow "$1"
checkUFWAllowPort "$1"
fi
fi

elif
systemctl status firewalld 2>/dev/null | grep -q "active (running)"
then
local updateFirewalldStatus=
if ! firewall-cmd --list-ports --permanent | grep -qw "$1/tcp"; then
updateFirewalldStatus=true
firewall-cmd --zone=public --add-port="$1/tcp" --permanent
checkFirewalldAllowPort "$1"
fi

# if ! firewall-cmd --list-ports --permanent | grep -qw "$1/tcp"; then
# updateFirewalldStatus=true
# firewall-cmd --zone=public --add-port=$1/tcp --permanent
# checkFirewalldAllowPort $1
# fi

if echo "${updateFirewalldStatus}" | grep -q "true"; then
firewall-cmd --reload
fi
Expand Down Expand Up @@ -4566,7 +4556,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者:mack-a"
echoContent green "当前版本:v2.5.63"
echoContent green "当前版本:v2.5.64"
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus
Expand Down

0 comments on commit 6543332

Please sign in to comment.