Skip to content

Commit f33a59b

Browse files
committed
fix(脚本): 修复xhttp无法通过CDN的问题、修复sing-box特定协议无法删除用户问题、修复singbox无法删除anytls用户的问题
1 parent ebb1da4 commit f33a59b

1 file changed

Lines changed: 35 additions & 29 deletions

File tree

install.sh

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ allowPort() {
731731
local updateFirewalldStatus=
732732
if ! iptables -L | grep -q "$1/${type}(mack-a)"; then
733733
updateFirewalldStatus=true
734-
iptables -I INPUT -p ${type} --dport "$1" -m comment --comment "allow $1/${type}(mack-a)" -j ACCEPT
734+
iptables -I INPUT -p "${type}" --dport "$1" -m comment --comment "allow $1/${type}(mack-a)" -j ACCEPT
735735
fi
736736

737737
if echo "${updateFirewalldStatus}" | grep -q "true"; then
@@ -1878,13 +1878,13 @@ acmeInstallSSL() {
18781878

18791879
if [[ "${dnsAPIType}" == "cloudflare" ]]; then
18801880
echoContent green " ---> DNS API 生成证书中"
1881-
sudo CF_Token="${cfAPIToken}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" -d "${dnsTLSDomain}" --dns dns_cf -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
1881+
sudo CF_Token="${cfAPIToken}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" -d "${dnsTLSDomain}" --dns dns_cf -k ec-256 --server "${sslType}" "${sslIPv6}" 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
18821882
elif [[ "${dnsAPIType}" == "aliyun" ]]; then
18831883
echoContent green " ---> DNS API 生成证书中"
1884-
sudo Ali_Key="${aliKey}" Ali_Secret="${aliSecret}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" -d "${dnsTLSDomain}" --dns dns_ali -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
1884+
sudo Ali_Key="${aliKey}" Ali_Secret="${aliSecret}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" -d "${dnsTLSDomain}" --dns dns_ali -k ec-256 --server "${sslType}" "${sslIPv6}" 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
18851885
else
18861886
echoContent green " ---> 生成证书中"
1887-
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
1887+
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" "${sslIPv6}" 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
18881888
fi
18891889
}
18901890
# 自定义端口
@@ -4866,15 +4866,15 @@ EOF
48664866
elif [[ "${type}" == "vlessXHTTP" ]]; then
48674867

48684868
echoContent yellow " ---> 通用格式(VLESS+reality+XHTTP)"
4869-
echoContent green " vless://${id}@$(getPublicIP):${port}?encryption=none&security=reality&type=xhttp&sni=${xrayVLESSRealityXHTTPServerName}&host=${xrayVLESSRealityXHTTPServerName}&fp=chrome&path=${path}&pbk=${currentRealityXHTTPPublicKey}&sid=6ba85179e30d4fc2#${email}\n"
4869+
echoContent green " vless://${id}@${add}:${port}?encryption=none&security=reality&type=xhttp&sni=${xrayVLESSRealityXHTTPServerName}&host=${xrayVLESSRealityXHTTPServerName}&fp=chrome&path=${path}&pbk=${currentRealityXHTTPPublicKey}&sid=6ba85179e30d4fc2#${email}\n"
48704870

48714871
echoContent yellow " ---> 格式化明文(VLESS+reality+XHTTP)"
4872-
echoContent green "协议类型:VLESS reality,地址:$(getPublicIP),publicKey:${currentRealityXHTTPPublicKey},shortId: 6ba85179e30d4fc2,serverNames:${xrayVLESSRealityXHTTPServerName},端口:${port},路径:${path},SNI:${xrayVLESSRealityXHTTPServerName},伪装域名:${xrayVLESSRealityXHTTPServerName},用户ID:${id},传输方式:xhttp,账户名:${email}\n"
4872+
echoContent green "协议类型:VLESS reality,地址:${add},publicKey:${currentRealityXHTTPPublicKey},shortId: 6ba85179e30d4fc2,serverNames:${xrayVLESSRealityXHTTPServerName},端口:${port},路径:${path},SNI:${xrayVLESSRealityXHTTPServerName},伪装域名:${xrayVLESSRealityXHTTPServerName},用户ID:${id},传输方式:xhttp,账户名:${email}\n"
48734873
cat <<EOF >>"/etc/v2ray-agent/subscribe_local/default/${user}"
4874-
vless://${id}@$(getPublicIP):${port}?encryption=none&security=reality&type=xhttp&sni=${xrayVLESSRealityXHTTPServerName}&fp=chrome&path=${path}&pbk=${currentRealityXHTTPPublicKey}&sid=6ba85179e30d4fc2#${email}
4874+
vless://${id}@${add}:${port}?encryption=none&security=reality&type=xhttp&sni=${xrayVLESSRealityXHTTPServerName}&fp=chrome&path=${path}&pbk=${currentRealityXHTTPPublicKey}&sid=6ba85179e30d4fc2#${email}
48754875
EOF
48764876
echoContent yellow " ---> 二维码 VLESS(VLESS+reality+XHTTP)"
4877-
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${port}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dxhttp%26sni%3D${xrayVLESSRealityXHTTPServerName}%26fp%3Dchrome%26path%3D${path}%26host%3D${xrayVLESSRealityXHTTPServerName}%26pbk%3D${currentRealityXHTTPPublicKey}%26sid%3D6ba85179e30d4fc2%23${email}\n"
4877+
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40${add}%3A${port}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dxhttp%26sni%3D${xrayVLESSRealityXHTTPServerName}%26fp%3Dchrome%26path%3D${path}%26host%3D${xrayVLESSRealityXHTTPServerName}%26pbk%3D${currentRealityXHTTPPublicKey}%26sid%3D6ba85179e30d4fc2%23${email}\n"
48784878

48794879
elif
48804880
[[ "${type}" == "vlessgrpc" ]]
@@ -6134,72 +6134,78 @@ removeUser() {
61346134

61356135
if echo ${currentInstallProtocolType} | grep -q ",0,"; then
61366136
local vlessVision
6137-
vlessVision=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}02_VLESS_TCP_inbounds.json)
6137+
vlessVision=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}02_VLESS_TCP_inbounds.json)
61386138
echo "${vlessVision}" | jq . >${configPath}02_VLESS_TCP_inbounds.json
61396139
fi
61406140
if echo ${currentInstallProtocolType} | grep -q ",1,"; then
61416141
local vlessWSResult
6142-
vlessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])//.inbounds[0].users['${delUserIndex}'])' ${configPath}03_VLESS_WS_inbounds.json)
6142+
vlessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}03_VLESS_WS_inbounds.json)
61436143
echo "${vlessWSResult}" | jq . >${configPath}03_VLESS_WS_inbounds.json
61446144
fi
61456145

61466146
if echo ${currentInstallProtocolType} | grep -q ",2,"; then
61476147
local trojangRPCUsers
6148-
trojangRPCUsers=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])//.inbounds[0].users['${delUserIndex}'])' ${configPath}04_trojan_gRPC_inbounds.json)
6148+
trojangRPCUsers=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"')' ${configPath}04_trojan_gRPC_inbounds.json)
61496149
echo "${trojangRPCUsers}" | jq . >${configPath}04_trojan_gRPC_inbounds.json
61506150
fi
61516151

61526152
if echo ${currentInstallProtocolType} | grep -q ",3,"; then
61536153
local vmessWSResult
6154-
vmessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}05_VMess_WS_inbounds.json)
6154+
vmessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}05_VMess_WS_inbounds.json)
61556155
echo "${vmessWSResult}" | jq . >${configPath}05_VMess_WS_inbounds.json
61566156
fi
61576157

61586158
if echo ${currentInstallProtocolType} | grep -q ",5,"; then
61596159
local vlessGRPCResult
6160-
vlessGRPCResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}06_VLESS_gRPC_inbounds.json)
6160+
vlessGRPCResult=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}06_VLESS_gRPC_inbounds.json)
61616161
echo "${vlessGRPCResult}" | jq . >${configPath}06_VLESS_gRPC_inbounds.json
61626162
fi
61636163

61646164
if echo ${currentInstallProtocolType} | grep -q ",4,"; then
61656165
local trojanTCPResult
6166-
trojanTCPResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}04_trojan_TCP_inbounds.json)
6166+
trojanTCPResult=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}04_trojan_TCP_inbounds.json)
61676167
echo "${trojanTCPResult}" | jq . >${configPath}04_trojan_TCP_inbounds.json
61686168
fi
61696169

6170+
if echo ${currentInstallProtocolType} | grep -q ",6,"; then
6171+
local hysteriaResult
6172+
hysteriaResult=$(jq -r 'del(.inbounds[0].users['"${delUserIndex}"'])' "${singBoxConfigPath}06_hysteria2_inbounds.json")
6173+
echo "${hysteriaResult}" | jq . >"${singBoxConfigPath}06_hysteria2_inbounds.json"
6174+
fi
61706175
if echo ${currentInstallProtocolType} | grep -q ",7,"; then
61716176
local vlessRealityResult
6172-
vlessRealityResult=$(jq -r 'del(.inbounds[1].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}07_VLESS_vision_reality_inbounds.json)
6177+
vlessRealityResult=$(jq -r 'del(.inbounds[1].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}07_VLESS_vision_reality_inbounds.json)
61736178
echo "${vlessRealityResult}" | jq . >${configPath}07_VLESS_vision_reality_inbounds.json
61746179
fi
61756180
if echo ${currentInstallProtocolType} | grep -q ",8,"; then
61766181
local vlessRealityGRPCResult
6177-
vlessRealityGRPCResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}08_VLESS_vision_gRPC_inbounds.json)
6182+
vlessRealityGRPCResult=$(jq -r 'del(.inbounds[0].settings.clients['"${delUserIndex}"']//.inbounds[0].users['"${delUserIndex}"'])' ${configPath}08_VLESS_vision_gRPC_inbounds.json)
61786183
echo "${vlessRealityGRPCResult}" | jq . >${configPath}08_VLESS_vision_gRPC_inbounds.json
61796184
fi
61806185

6181-
if echo ${currentInstallProtocolType} | grep -q ",6,"; then
6182-
local hysteriaResult
6183-
hysteriaResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}06_hysteria2_inbounds.json")
6184-
echo "${hysteriaResult}" | jq . >"${singBoxConfigPath}06_hysteria2_inbounds.json"
6185-
fi
61866186
if echo ${currentInstallProtocolType} | grep -q ",9,"; then
61876187
local tuicResult
6188-
tuicResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}09_tuic_inbounds.json")
6188+
tuicResult=$(jq -r 'del(.inbounds[0].users['"${delUserIndex}"'])' "${singBoxConfigPath}09_tuic_inbounds.json")
61896189
echo "${tuicResult}" | jq . >"${singBoxConfigPath}09_tuic_inbounds.json"
61906190
fi
61916191
if echo ${currentInstallProtocolType} | grep -q ",10,"; then
61926192
local naiveResult
6193-
naiveResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}10_naive_inbounds.json")
6193+
naiveResult=$(jq -r 'del(.inbounds[0].users['"${delUserIndex}"'])' "${singBoxConfigPath}10_naive_inbounds.json")
61946194
echo "${naiveResult}" | jq . >"${singBoxConfigPath}10_naive_inbounds.json"
61956195
fi
61966196
# VMess HTTPUpgrade
61976197
if echo ${currentInstallProtocolType} | grep -q ",11,"; then
61986198
local vmessHTTPUpgradeResult
6199-
vmessHTTPUpgradeResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}11_VMess_HTTPUpgrade_inbounds.json")
6199+
vmessHTTPUpgradeResult=$(jq -r 'del(.inbounds[0].users['"${delUserIndex}"'])' "${singBoxConfigPath}11_VMess_HTTPUpgrade_inbounds.json")
62006200
echo "${vmessHTTPUpgradeResult}" | jq . >"${singBoxConfigPath}11_VMess_HTTPUpgrade_inbounds.json"
62016201
echo "${vmessHTTPUpgradeResult}" | jq . >${configPath}11_VMess_HTTPUpgrade_inbounds.json
62026202
fi
6203+
# AnyTLS
6204+
if echo ${currentInstallProtocolType} | grep -q ",13,"; then
6205+
local anyTLSResult
6206+
anyTLSResult=$(jq -r 'del(.inbounds[0].users['"${delUserIndex}"'])' "${singBoxConfigPath}13_anytls_inbounds.json")
6207+
echo "${anyTLSResult}" | jq . >"${singBoxConfigPath}13_anytls_inbounds.json"
6208+
fi
62036209
reloadCore
62046210
readNginxSubscribe
62056211
if [[ -n "${subscribePort}" ]]; then
@@ -6332,10 +6338,10 @@ EOF
63326338
checkLog 1
63336339
;;
63346340
2)
6335-
tail -f ${configPathLog}access.log
6341+
tail -f "${configPathLog}access.log"
63366342
;;
63376343
3)
6338-
tail -f ${configPathLog}error.log
6344+
tail -f "${configPathLog}error.log"
63396345
;;
63406346
4)
63416347
if [[ ! -f "/etc/v2ray-agent/crontab_tls.log" ]]; then
@@ -6347,8 +6353,8 @@ EOF
63476353
tail -n 100 /etc/v2ray-agent/tls/acme.log
63486354
;;
63496355
6)
6350-
echo >${configPathLog}access.log
6351-
echo >${configPathLog}error.log
6356+
echo >"${configPathLog}access.log"
6357+
echo >"${configPathLog}error.log"
63526358
;;
63536359
esac
63546360
}
@@ -9538,7 +9544,7 @@ menu() {
95389544
cd "$HOME" || exit
95399545
echoContent red "\n=============================================================="
95409546
echoContent green "作者:mack-a"
9541-
echoContent green "当前版本:v3.5.5"
9547+
echoContent green "当前版本:v3.5.6"
95429548
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
95439549
echoContent green "描述:八合一共存脚本\c"
95449550
showInstallStatus

0 commit comments

Comments
 (0)