mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-01-13 01:02:46 +00:00
fix
This commit is contained in:
parent
0cc21538d6
commit
9af1c2a078
3 changed files with 16 additions and 16 deletions
14
install.sh
14
install.sh
|
|
@ -161,7 +161,7 @@ setup_ssl_certificate() {
|
||||||
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
||||||
|
|
||||||
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
||||||
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile" >/dev/null 2>&1
|
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile" >/dev/null 2>&1
|
||||||
echo -e "${green}SSL certificate installed and configured successfully!${plain}"
|
echo -e "${green}SSL certificate installed and configured successfully!${plain}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|
@ -218,15 +218,15 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 755 ${certDir}/* 2>/dev/null
|
chmod 755 ${certDir}/* 2>/dev/null
|
||||||
/usr/local/x-ui/x-ui cert -webCert "${certDir}/fullchain.pem" -webCertKey "${certDir}/privkey.pem" >/dev/null 2>&1
|
${xui_folder}/x-ui cert -webCert "${certDir}/fullchain.pem" -webCertKey "${certDir}/privkey.pem" >/dev/null 2>&1
|
||||||
echo -e "${yellow}Self-signed certificate configured. Browsers will show a warning.${plain}"
|
echo -e "${yellow}Self-signed certificate configured. Browsers will show a warning.${plain}"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Comprehensive manual SSL certificate issuance via acme.sh
|
# Comprehensive manual SSL certificate issuance via acme.sh
|
||||||
ssl_cert_issue() {
|
ssl_cert_issue() {
|
||||||
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep 'webBasePath:' | awk -F': ' '{print $2}' | tr -d '[:space:]' | sed 's#^/##')
|
local existing_webBasePath=$(${xui_folder}/x-ui setting -show true | grep 'webBasePath:' | awk -F': ' '{print $2}' | tr -d '[:space:]' | sed 's#^/##')
|
||||||
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep 'port:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
local existing_port=$(${xui_folder}/x-ui setting -show true | grep 'port:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
||||||
|
|
||||||
# check for acme.sh first
|
# check for acme.sh first
|
||||||
if ! command -v ~/.acme.sh/acme.sh &>/dev/null; then
|
if ! command -v ~/.acme.sh/acme.sh &>/dev/null; then
|
||||||
|
|
@ -369,7 +369,7 @@ ssl_cert_issue() {
|
||||||
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
||||||
|
|
||||||
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
||||||
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
|
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
|
||||||
echo -e "${green}Certificate paths set for the panel${plain}"
|
echo -e "${green}Certificate paths set for the panel${plain}"
|
||||||
echo -e "${green}Certificate File: $webCertFile${plain}"
|
echo -e "${green}Certificate File: $webCertFile${plain}"
|
||||||
echo -e "${green}Private Key File: $webKeyFile${plain}"
|
echo -e "${green}Private Key File: $webKeyFile${plain}"
|
||||||
|
|
@ -455,7 +455,7 @@ prompt_and_setup_ssl() {
|
||||||
|
|
||||||
config_after_install() {
|
config_after_install() {
|
||||||
local existing_hasDefaultCredential=$(${xui_folder}/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}')
|
local existing_hasDefaultCredential=$(${xui_folder}/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}')
|
||||||
local existing_webBasePath=$(${xui_folder}/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
local existing_webBasePath=$(${xui_folder}/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}' | sed 's#^/##')
|
||||||
local existing_port=$(${xui_folder}/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
local existing_port=$(${xui_folder}/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
||||||
# Properly detect empty cert by checking if cert: line exists and has content after it
|
# Properly detect empty cert by checking if cert: line exists and has content after it
|
||||||
local existing_cert=$(${xui_folder}/x-ui setting -getCert true | grep 'cert:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
local existing_cert=$(${xui_folder}/x-ui setting -getCert true | grep 'cert:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
||||||
|
|
@ -554,7 +554,7 @@ config_after_install() {
|
||||||
|
|
||||||
# Existing install: if no cert configured, prompt user to set domain or self-signed
|
# Existing install: if no cert configured, prompt user to set domain or self-signed
|
||||||
# Properly detect empty cert by checking if cert: line exists and has content after it
|
# Properly detect empty cert by checking if cert: line exists and has content after it
|
||||||
existing_cert=$(/usr/local/x-ui/x-ui setting -getCert true | grep 'cert:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
existing_cert=$(${xui_folder}/x-ui setting -getCert true | grep 'cert:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
||||||
if [[ -z "$existing_cert" ]]; then
|
if [[ -z "$existing_cert" ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${green}═══════════════════════════════════════════${plain}"
|
echo -e "${green}═══════════════════════════════════════════${plain}"
|
||||||
|
|
|
||||||
10
update.sh
10
update.sh
|
|
@ -193,7 +193,7 @@ setup_ssl_certificate() {
|
||||||
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
||||||
|
|
||||||
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
||||||
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile" >/dev/null 2>&1
|
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile" >/dev/null 2>&1
|
||||||
echo -e "${green}SSL certificate installed and configured successfully!${plain}"
|
echo -e "${green}SSL certificate installed and configured successfully!${plain}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|
@ -249,14 +249,14 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 755 ${certDir}/* 2>/dev/null
|
chmod 755 ${certDir}/* 2>/dev/null
|
||||||
/usr/local/x-ui/x-ui cert -webCert "${certDir}/fullchain.pem" -webCertKey "${certDir}/privkey.pem" >/dev/null 2>&1
|
${xui_folder}/x-ui cert -webCert "${certDir}/fullchain.pem" -webCertKey "${certDir}/privkey.pem" >/dev/null 2>&1
|
||||||
echo -e "${yellow}Self-signed certificate configured. Browsers will show a warning.${plain}"
|
echo -e "${yellow}Self-signed certificate configured. Browsers will show a warning.${plain}"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# Comprehensive manual SSL certificate issuance via acme.sh
|
# Comprehensive manual SSL certificate issuance via acme.sh
|
||||||
ssl_cert_issue() {
|
ssl_cert_issue() {
|
||||||
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep 'webBasePath:' | awk -F': ' '{print $2}' | tr -d '[:space:]' | sed 's#^/##')
|
local existing_webBasePath=$(${xui_folder}/x-ui setting -show true | grep 'webBasePath:' | awk -F': ' '{print $2}' | tr -d '[:space:]' | sed 's#^/##')
|
||||||
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep 'port:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
local existing_port=$(${xui_folder}/x-ui setting -show true | grep 'port:' | awk -F': ' '{print $2}' | tr -d '[:space:]')
|
||||||
|
|
||||||
# check for acme.sh first
|
# check for acme.sh first
|
||||||
if ! command -v ~/.acme.sh/acme.sh &>/dev/null; then
|
if ! command -v ~/.acme.sh/acme.sh &>/dev/null; then
|
||||||
|
|
@ -399,7 +399,7 @@ ssl_cert_issue() {
|
||||||
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
local webKeyFile="/root/cert/${domain}/privkey.pem"
|
||||||
|
|
||||||
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
||||||
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
|
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
|
||||||
echo -e "${green}Certificate paths set for the panel${plain}"
|
echo -e "${green}Certificate paths set for the panel${plain}"
|
||||||
echo -e "${green}Certificate File: $webCertFile${plain}"
|
echo -e "${green}Certificate File: $webCertFile${plain}"
|
||||||
echo -e "${green}Private Key File: $webKeyFile${plain}"
|
echo -e "${green}Private Key File: $webKeyFile${plain}"
|
||||||
|
|
|
||||||
8
x-ui.sh
8
x-ui.sh
|
|
@ -276,7 +276,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 755 ${certDir}/* >/dev/null 2>&1
|
chmod 755 ${certDir}/* >/dev/null 2>&1
|
||||||
/usr/local/x-ui/x-ui cert -webCert "${certDir}/fullchain.pem" -webCertKey "${certDir}/privkey.pem" >/dev/null 2>&1
|
${xui_folder}/x-ui cert -webCert "${certDir}/fullchain.pem" -webCertKey "${certDir}/privkey.pem" >/dev/null 2>&1
|
||||||
LOGI "Self-signed certificate configured. Browsers will show a warning."
|
LOGI "Self-signed certificate configured. Browsers will show a warning."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -1156,8 +1156,8 @@ ssl_cert_issue_main() {
|
||||||
ssl_cert_issue_for_ip() {
|
ssl_cert_issue_for_ip() {
|
||||||
LOGI "Starting automatic SSL certificate generation for server IP..."
|
LOGI "Starting automatic SSL certificate generation for server IP..."
|
||||||
|
|
||||||
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
local existing_webBasePath=$(${xui_folder}/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
||||||
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
local existing_port=$(${xui_folder}/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
||||||
|
|
||||||
# Get server IP
|
# Get server IP
|
||||||
local server_ip=$(curl -s --max-time 3 https://api.ipify.org)
|
local server_ip=$(curl -s --max-time 3 https://api.ipify.org)
|
||||||
|
|
@ -1267,7 +1267,7 @@ ssl_cert_issue_for_ip() {
|
||||||
local webKeyFile="/root/cert/${server_ip}/privkey.pem"
|
local webKeyFile="/root/cert/${server_ip}/privkey.pem"
|
||||||
|
|
||||||
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
|
||||||
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
|
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
|
||||||
LOGI "Certificate configured for panel"
|
LOGI "Certificate configured for panel"
|
||||||
LOGI " - Certificate File: $webCertFile"
|
LOGI " - Certificate File: $webCertFile"
|
||||||
LOGI " - Private Key File: $webKeyFile"
|
LOGI " - Private Key File: $webKeyFile"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue