mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 修改使用aapanel异常报错问题、修改iptables无法允许UDP通行的问题
parent
3d89ed0305
commit
186f307d1a
86
install.sh
86
install.sh
|
@ -406,30 +406,35 @@ checkBTPanel() {
|
|||
if [[ -n $(pgrep -f "BT-Panel") ]]; then
|
||||
# 读取域名
|
||||
if [[ -d '/www/server/panel/vhost/cert/' && -n $(find /www/server/panel/vhost/cert/*/fullchain.pem) ]]; then
|
||||
if [[ -z "${currentHost}" ]]; then
|
||||
echoContent skyBlue "\n读取宝塔配置\n"
|
||||
|
||||
echoContent skyBlue "\n读取宝塔配置\n"
|
||||
find /www/server/panel/vhost/cert/*/fullchain.pem | awk -F "[/]" '{print $7}' | awk '{print NR""":"$0}'
|
||||
|
||||
find /www/server/panel/vhost/cert/*/fullchain.pem | awk -F "[/]" '{print $7}' | awk '{print NR""":"$0}'
|
||||
read -r -p "请输入编号选择:" selectBTDomain
|
||||
else
|
||||
selectBTDomain=$(find /www/server/panel/vhost/cert/*/fullchain.pem | awk -F "[/]" '{print $7}' | awk '{print NR""":"$0}' | grep "${currentHost}" | cut -d ":" -f 1)
|
||||
fi
|
||||
|
||||
read -r -p "请输入编号选择:" selectBTDomain
|
||||
if [[ -n "${selectBTDomain}" ]]; then
|
||||
btDomain=$(find /www/server/panel/vhost/cert/*/fullchain.pem | awk -F "[/]" '{print $7}' | awk '{print NR""":"$0}' | grep "${selectBTDomain}:" | cut -d ":" -f 2)
|
||||
|
||||
if [[ -z "${btDomain}" ]]; then
|
||||
echoContent red " ---> 选择错误,请重新选择"
|
||||
checkBTPanel
|
||||
else
|
||||
domain=${btDomain}
|
||||
ln -s "/www/server/panel/vhost/cert/${btDomain}/fullchain.pem" "/etc/v2ray-agent/tls/${btDomain}.crt"
|
||||
ln -s "/www/server/panel/vhost/cert/${btDomain}/privkey.pem" "/etc/v2ray-agent/tls/${btDomain}.key"
|
||||
if [[ ! -f "/etc/v2ray-agent/tls/${btDomain}.crt" && ! -f "/etc/v2ray-agent/tls/${btDomain}.key" ]]; then
|
||||
ln -s "/www/server/panel/vhost/cert/${btDomain}/fullchain.pem" "/etc/v2ray-agent/tls/${btDomain}.crt"
|
||||
ln -s "/www/server/panel/vhost/cert/${btDomain}/privkey.pem" "/etc/v2ray-agent/tls/${btDomain}.key"
|
||||
fi
|
||||
|
||||
nginxStaticPath="/www/wwwroot/${btDomain}/"
|
||||
if [[ -f "/www/wwwroot/${btDomain}/.user.ini" ]]; then
|
||||
chattr -i "/www/wwwroot/${btDomain}/.user.ini"
|
||||
fi
|
||||
|
||||
nginxConfigPath="/www/server/panel/vhost/nginx/"
|
||||
fi
|
||||
|
||||
else
|
||||
echoContent red " ---> 选择错误,请重新选择"
|
||||
checkBTPanel
|
||||
|
@ -457,9 +462,9 @@ allowPort() {
|
|||
# 如果防火墙启动状态则添加相应的开放端口
|
||||
if systemctl status netfilter-persistent 2>/dev/null | grep -q "active (exited)"; then
|
||||
local updateFirewalldStatus=
|
||||
if ! iptables -L | grep -q "$1(mack-a)"; then
|
||||
if ! iptables -L | grep -q "$1/${type}(mack-a)"; then
|
||||
updateFirewalldStatus=true
|
||||
iptables -I INPUT -p ${type} --dport "$1" -m comment --comment "allow $1(mack-a)" -j ACCEPT
|
||||
iptables -I INPUT -p ${type} --dport "$1" -m comment --comment "allow $1/${type}(mack-a)" -j ACCEPT
|
||||
fi
|
||||
|
||||
if echo "${updateFirewalldStatus}" | grep -q "true"; then
|
||||
|
@ -539,7 +544,7 @@ readHysteriaConfig() {
|
|||
# 读取Tuic配置
|
||||
readTuicConfig() {
|
||||
if [[ -n "${tuicConfigPath}" ]]; then
|
||||
tuicPort=$(jq -r .server <"${tuicConfigPath}config.json" | awk -F "[\]][:]" '{print $2}')
|
||||
tuicPort=$(jq -r .server <"${tuicConfigPath}config.json" | cut -d ':' -f 4)
|
||||
tuicAlgorithm=$(jq -r .congestion_control <"${tuicConfigPath}config.json")
|
||||
fi
|
||||
}
|
||||
|
@ -567,34 +572,6 @@ readConfigHostPathUUID() {
|
|||
currentHost=
|
||||
currentPort=
|
||||
currentAdd=
|
||||
# 读取path
|
||||
if [[ -n "${configPath}" && -n "${frontingType}" ]]; then
|
||||
local fallback
|
||||
fallback=$(jq -r -c '.inbounds[0].settings.fallbacks[]|select(.path)' ${configPath}${frontingType}.json | head -1)
|
||||
|
||||
local path
|
||||
path=$(echo "${fallback}" | jq -r .path | awk -F "[/]" '{print $2}')
|
||||
|
||||
if [[ $(echo "${fallback}" | jq -r .dest) == 31297 ]]; then
|
||||
currentPath=$(echo "${path}" | awk -F "[w][s]" '{print $1}')
|
||||
elif [[ $(echo "${fallback}" | jq -r .dest) == 31299 ]]; then
|
||||
currentPath=$(echo "${path}" | awk -F "[v][w][s]" '{print $1}')
|
||||
fi
|
||||
|
||||
# 尝试读取alpn h2 Path
|
||||
if [[ -z "${currentPath}" ]]; then
|
||||
dest=$(jq -r -c '.inbounds[0].settings.fallbacks[]|select(.alpn)|.dest' ${configPath}${frontingType}.json | head -1)
|
||||
if [[ "${dest}" == "31302" || "${dest}" == "31304" ]]; then
|
||||
|
||||
if grep -q "trojangrpc {" <${nginxConfigPath}alone.conf; then
|
||||
currentPath=$(grep "trojangrpc {" <${nginxConfigPath}alone.conf | awk -F "[/]" '{print $2}' | awk -F "[t][r][o][j][a][n]" '{print $1}')
|
||||
elif grep -q "grpc {" <${nginxConfigPath}alone.conf; then
|
||||
currentPath=$(grep "grpc {" <${nginxConfigPath}alone.conf | head -1 | awk -F "[/]" '{print $2}' | awk -F "[g][r][p][c]" '{print $1}')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [[ "${coreInstallType}" == "1" ]]; then
|
||||
|
||||
|
@ -636,6 +613,35 @@ readConfigHostPathUUID() {
|
|||
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json)
|
||||
currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
|
||||
fi
|
||||
|
||||
# 读取path
|
||||
if [[ -n "${configPath}" && -n "${frontingType}" ]]; then
|
||||
local fallback
|
||||
fallback=$(jq -r -c '.inbounds[0].settings.fallbacks[]|select(.path)' ${configPath}${frontingType}.json | head -1)
|
||||
|
||||
local path
|
||||
path=$(echo "${fallback}" | jq -r .path | awk -F "[/]" '{print $2}')
|
||||
|
||||
if [[ $(echo "${fallback}" | jq -r .dest) == 31297 ]]; then
|
||||
currentPath=$(echo "${path}" | awk -F "[w][s]" '{print $1}')
|
||||
elif [[ $(echo "${fallback}" | jq -r .dest) == 31299 ]]; then
|
||||
currentPath=$(echo "${path}" | awk -F "[v][w][s]" '{print $1}')
|
||||
fi
|
||||
|
||||
# 尝试读取alpn h2 Path
|
||||
if [[ -z "${currentPath}" ]]; then
|
||||
dest=$(jq -r -c '.inbounds[0].settings.fallbacks[]|select(.alpn)|.dest' ${configPath}${frontingType}.json | head -1)
|
||||
if [[ "${dest}" == "31302" || "${dest}" == "31304" ]]; then
|
||||
checkBTPanel
|
||||
if grep -q "trojangrpc {" <${nginxConfigPath}alone.conf; then
|
||||
currentPath=$(grep "trojangrpc {" <${nginxConfigPath}alone.conf | awk -F "[/]" '{print $2}' | awk -F "[t][r][o][j][a][n]" '{print $1}')
|
||||
elif grep -q "grpc {" <${nginxConfigPath}alone.conf; then
|
||||
currentPath=$(grep "grpc {" <${nginxConfigPath}alone.conf | head -1 | awk -F "[/]" '{print $2}' | awk -F "[g][r][p][c]" '{print $1}')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
# 状态展示
|
||||
|
@ -7870,7 +7876,7 @@ menu() {
|
|||
cd "$HOME" || exit
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.10.3"
|
||||
echoContent green "当前版本:v2.10.4"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:八合一共存脚本\c"
|
||||
showInstallStatus
|
||||
|
@ -7879,7 +7885,7 @@ menu() {
|
|||
echoContent red " "
|
||||
echoContent green "推广请联系TG:@mackaff\n"
|
||||
echoContent green "VPS选购攻略:https://www.v2ray-agent.com/archives/1679975663984"
|
||||
echoContent green "RN低价套餐,年付最低10美元:https://www.v2ray-agent.com/archives/racknerdtao-can-zheng-li-nian-fu-10mei-yuan"
|
||||
echoContent green "年付10美金低价VPS AS4837:https://www.v2ray-agent.com/archives/racknerdtao-can-zheng-li-nian-fu-10mei-yuan"
|
||||
echoContent red "=============================================================="
|
||||
if [[ -n "${coreInstallType}" ]]; then
|
||||
echoContent yellow "1.重新安装"
|
||||
|
|
Loading…
Reference in New Issue