mirror of
https://github.com/mack-a/v2ray-agent.git
synced 2026-09-02 13:56:37 +00:00
feat(脚本): 移除centos默认升级、移除semanage、修改centos关闭selinux文章、移除xray grpc相关协议
This commit is contained in:
+79
-84
@@ -34,10 +34,10 @@ echoContent() {
|
|||||||
}
|
}
|
||||||
# 检查SELinux状态
|
# 检查SELinux状态
|
||||||
checkCentosSELinux() {
|
checkCentosSELinux() {
|
||||||
if [[ -f "/etc/selinux/config" ]] && ! grep -q "SELINUX=disabled" <"/etc/selinux/config"; then
|
if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" == "Enforcing" ]; then
|
||||||
echoContent yellow "# 注意事项"
|
echoContent yellow "# 注意事项"
|
||||||
echoContent yellow "检测到SELinux已开启,请手动关闭,教程如下"
|
echoContent yellow "检测到SELinux已开启,请手动关闭,教程如下"
|
||||||
echoContent yellow "https://www.v2ray-agent.com/archives/1684115970026#centos7-%E5%85%B3%E9%97%ADselinux"
|
echoContent yellow "https://www.v2ray-agent.com/archives/1684115970026#centos-%E5%85%B3%E9%97%ADselinux"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ checkSystem() {
|
|||||||
release="centos"
|
release="centos"
|
||||||
installType='yum -y install'
|
installType='yum -y install'
|
||||||
removeType='yum -y remove'
|
removeType='yum -y remove'
|
||||||
upgrade="yum update -y --skip-broken"
|
# upgrade="yum update -y --skip-broken"
|
||||||
checkCentosSELinux
|
checkCentosSELinux
|
||||||
elif { [[ -f "/etc/issue" ]] && grep -qi "Alpine" /etc/issue; } || { [[ -f "/proc/version" ]] && grep -qi "Alpine" /proc/version; }; then
|
elif { [[ -f "/etc/issue" ]] && grep -qi "Alpine" /etc/issue; } || { [[ -f "/proc/version" ]] && grep -qi "Alpine" /proc/version; }; then
|
||||||
release="alpine"
|
release="alpine"
|
||||||
@@ -698,7 +698,7 @@ allowPort() {
|
|||||||
type=tcp
|
type=tcp
|
||||||
fi
|
fi
|
||||||
# 如果防火墙启动状态则添加相应的开放端口
|
# 如果防火墙启动状态则添加相应的开放端口
|
||||||
if dpkg -l | grep -q "^[[:space:]]*ii[[:space:]]\+ufw"; then
|
if command -v dpkg >/dev/null 2>&1 && dpkg -l | grep -q "^[[:space:]]*ii[[:space:]]\+ufw"; then
|
||||||
if ufw status | grep -q "Status: active"; then
|
if ufw status | grep -q "Status: active"; then
|
||||||
if ! ufw status | grep -q "$1/${type}"; then
|
if ! ufw status | grep -q "$1/${type}"; then
|
||||||
sudo ufw allow "$1/${type}"
|
sudo ufw allow "$1/${type}"
|
||||||
@@ -1091,7 +1091,10 @@ installTools() {
|
|||||||
|
|
||||||
echoContent green " ---> 检查、安装更新【新机器会很慢,如长时间无反应,请手动停止后重新执行】"
|
echoContent green " ---> 检查、安装更新【新机器会很慢,如长时间无反应,请手动停止后重新执行】"
|
||||||
|
|
||||||
|
if [[ "${release}" != "centos" ]]; then
|
||||||
${upgrade} >/etc/v2ray-agent/install.log 2>&1
|
${upgrade} >/etc/v2ray-agent/install.log 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
if grep <"/etc/v2ray-agent/install.log" -q "changed"; then
|
if grep <"/etc/v2ray-agent/install.log" -q "changed"; then
|
||||||
${updateReleaseInfoChange} >/dev/null 2>&1
|
${updateReleaseInfoChange} >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
@@ -1223,28 +1226,24 @@ installTools() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v semanage >/dev/null 2>&1; then
|
# if ! command -v semanage >/dev/null 2>&1 && [[ "${release}" == "centos" ]]; then
|
||||||
echoContent green " ---> 安装semanage"
|
# if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" == "Enforcing" ]; then
|
||||||
${installType} bash-completion >/dev/null 2>&1
|
# if [[ "${centosVersion}" == "7" ]]; then
|
||||||
|
# policyCoreUtils="policycoreutils-python"
|
||||||
if [[ "${centosVersion}" == "7" ]]; then
|
# elif [[ "${centosVersion}" == "8" || "${centosVersion}" == "9" || "${centosVersion}" == "10" ]]; then
|
||||||
policyCoreUtils="policycoreutils-python"
|
# policyCoreUtils="policycoreutils-python-utils"
|
||||||
elif [[ "${centosVersion}" == "8" || "${release}" == "ubuntu" || "${release}" == "debian" ]]; then
|
# fi
|
||||||
policyCoreUtils="policycoreutils-python-utils"
|
# echoContent green " ---> 安装semanage"
|
||||||
fi
|
#
|
||||||
|
# if [[ -n "${policyCoreUtils}" ]]; then
|
||||||
if [[ -n "${policyCoreUtils}" ]]; then
|
# ${installType} bash-completion >/dev/null 2>&1
|
||||||
${installType} ${policyCoreUtils} >/dev/null 2>&1
|
# ${installType} ${policyCoreUtils} >/dev/null 2>&1
|
||||||
fi
|
# fi
|
||||||
if [[ -n $(which semanage) ]]; then
|
# if [[ -n $(which semanage) ]]; then
|
||||||
if command -v getenforce >/dev/null 2>&1; then
|
# semanage port -a -t http_port_t -p tcp 31300
|
||||||
selinux_status=$(getenforce)
|
# fi
|
||||||
if [ "$selinux_status" != "Disabled" ]; then
|
# fi
|
||||||
semanage port -a -t http_port_t -p tcp 31300
|
# fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${selectCustomInstallType}" == "7" ]]; then
|
if [[ "${selectCustomInstallType}" == "7" ]]; then
|
||||||
echoContent green " ---> 检测到无需依赖证书的服务,跳过安装"
|
echoContent green " ---> 检测到无需依赖证书的服务,跳过安装"
|
||||||
@@ -4062,32 +4061,32 @@ EOF
|
|||||||
rm /etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json >/dev/null 2>&1
|
rm /etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
# VLESS_gRPC
|
# VLESS_gRPC
|
||||||
if echo "${selectCustomInstallType}" | grep -q ",5," || [[ "$1" == "all" ]]; then
|
# if echo "${selectCustomInstallType}" | grep -q ",5," || [[ "$1" == "all" ]]; then
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
|
# cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
|
||||||
{
|
#{
|
||||||
"inbounds":[
|
# "inbounds":[
|
||||||
{
|
# {
|
||||||
"port": 31301,
|
# "port": 31301,
|
||||||
"listen": "127.0.0.1",
|
# "listen": "127.0.0.1",
|
||||||
"protocol": "vless",
|
# "protocol": "vless",
|
||||||
"tag":"VLESSGRPC",
|
# "tag":"VLESSGRPC",
|
||||||
"settings": {
|
# "settings": {
|
||||||
"clients": $(initXrayClients 5),
|
# "clients": $(initXrayClients 5),
|
||||||
"decryption": "none"
|
# "decryption": "none"
|
||||||
},
|
# },
|
||||||
"streamSettings": {
|
# "streamSettings": {
|
||||||
"network": "grpc",
|
# "network": "grpc",
|
||||||
"grpcSettings": {
|
# "grpcSettings": {
|
||||||
"serviceName": "${customPath}grpc"
|
# "serviceName": "${customPath}grpc"
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
]
|
# ]
|
||||||
}
|
#}
|
||||||
EOF
|
#EOF
|
||||||
elif [[ -z "$3" ]]; then
|
# elif [[ -z "$3" ]]; then
|
||||||
rm /etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json >/dev/null 2>&1
|
# rm /etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json >/dev/null 2>&1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# VLESS Vision
|
# VLESS Vision
|
||||||
if echo "${selectCustomInstallType}" | grep -q ",0," || [[ "$1" == "all" ]]; then
|
if echo "${selectCustomInstallType}" | grep -q ",0," || [[ "$1" == "all" ]]; then
|
||||||
@@ -4166,10 +4165,6 @@ EOF
|
|||||||
"clients": $(initXrayClients 7),
|
"clients": $(initXrayClients 7),
|
||||||
"decryption": "none",
|
"decryption": "none",
|
||||||
"fallbacks":[
|
"fallbacks":[
|
||||||
{
|
|
||||||
"dest": "31305",
|
|
||||||
"xver": 1
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
@@ -4225,32 +4220,32 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json
|
# cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json
|
||||||
{
|
#{
|
||||||
"inbounds": [
|
# "inbounds": [
|
||||||
{
|
# {
|
||||||
"port": 31305,
|
# "port": 31305,
|
||||||
"listen": "127.0.0.1",
|
# "listen": "127.0.0.1",
|
||||||
"protocol": "vless",
|
# "protocol": "vless",
|
||||||
"tag": "VLESSRealityGRPC",
|
# "tag": "VLESSRealityGRPC",
|
||||||
"settings": {
|
# "settings": {
|
||||||
"clients": $(initXrayClients 8),
|
# "clients": $(initXrayClients 8),
|
||||||
"decryption": "none"
|
# "decryption": "none"
|
||||||
},
|
# },
|
||||||
"streamSettings": {
|
# "streamSettings": {
|
||||||
"network": "grpc",
|
# "network": "grpc",
|
||||||
"grpcSettings": {
|
# "grpcSettings": {
|
||||||
"serviceName": "grpc",
|
# "serviceName": "grpc",
|
||||||
"multiMode": true
|
# "multiMode": true
|
||||||
},
|
# },
|
||||||
"sockopt": {
|
# "sockopt": {
|
||||||
"acceptProxyProtocol": true
|
# "acceptProxyProtocol": true
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
]
|
# ]
|
||||||
}
|
#}
|
||||||
EOF
|
#EOF
|
||||||
|
|
||||||
elif [[ -z "$3" ]]; then
|
elif [[ -z "$3" ]]; then
|
||||||
rm /etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json >/dev/null 2>&1
|
rm /etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json >/dev/null 2>&1
|
||||||
@@ -8044,7 +8039,7 @@ customXrayInstall() {
|
|||||||
# echoContent yellow "2.Trojan+TLS+gRPC[仅CDN推荐]"
|
# echoContent yellow "2.Trojan+TLS+gRPC[仅CDN推荐]"
|
||||||
echoContent yellow "3.VMess+TLS+WS[仅CDN推荐]"
|
echoContent yellow "3.VMess+TLS+WS[仅CDN推荐]"
|
||||||
echoContent yellow "4.Trojan+TLS[不推荐]"
|
echoContent yellow "4.Trojan+TLS[不推荐]"
|
||||||
echoContent yellow "5.VLESS+TLS+gRPC[仅CDN推荐]"
|
# echoContent yellow "5.VLESS+TLS+gRPC[仅CDN推荐]"
|
||||||
echoContent yellow "7.VLESS+Reality+uTLS+Vision[推荐]"
|
echoContent yellow "7.VLESS+Reality+uTLS+Vision[推荐]"
|
||||||
# echoContent yellow "8.VLESS+Reality+gRPC"
|
# echoContent yellow "8.VLESS+Reality+gRPC"
|
||||||
echoContent yellow "12.VLESS+Reality+XHTTP+TLS[CDN可用]"
|
echoContent yellow "12.VLESS+Reality+XHTTP+TLS[CDN可用]"
|
||||||
@@ -9536,7 +9531,7 @@ menu() {
|
|||||||
cd "$HOME" || exit
|
cd "$HOME" || exit
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent green "作者:mack-a"
|
echoContent green "作者:mack-a"
|
||||||
echoContent green "当前版本:v3.5.2"
|
echoContent green "当前版本:v3.5.3"
|
||||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echoContent green "描述:八合一共存脚本\c"
|
echoContent green "描述:八合一共存脚本\c"
|
||||||
showInstallStatus
|
showInstallStatus
|
||||||
|
|||||||
Reference in New Issue
Block a user