fix(ssl): prompt before setting IP cert path for panel
Some checks are pending
CI / go-test (push) Waiting to run
CI / govulncheck (push) Waiting to run
CI / frontend (push) Waiting to run
CodeQL Advanced / Analyze (go) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run

The IP certificate flow auto-set the panel cert path silently, unlike the
domain and Cloudflare flows which ask first. Add the same
"Would you like to set this certificate for the panel? (y/n)" prompt so
the IP flow is consistent and only configures the panel on confirmation.
This commit is contained in:
MHSanaei 2026-05-29 02:52:57 +02:00
parent 7ea88e3e37
commit 90a64a1b22
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A

14
x-ui.sh
View file

@ -1371,24 +1371,30 @@ ssl_cert_issue_for_ip() {
chmod 600 $certPath/privkey.pem 2> /dev/null chmod 600 $certPath/privkey.pem 2> /dev/null
chmod 644 $certPath/fullchain.pem 2> /dev/null chmod 644 $certPath/fullchain.pem 2> /dev/null
# Set certificate paths for the panel # Prompt user to set panel paths after successful certificate installation
local webCertFile="${certPath}/fullchain.pem" local webCertFile="${certPath}/fullchain.pem"
local webKeyFile="${certPath}/privkey.pem" local webKeyFile="${certPath}/privkey.pem"
read -rp "Would you like to set this certificate for the panel? (y/n): " setPanel
if [[ "$setPanel" == "y" || "$setPanel" == "Y" ]]; then
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile" ${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
LOGI "Certificate configured for panel" LOGI "Panel paths set for IP: $server_ip"
LOGI " - Certificate File: $webCertFile" LOGI " - Certificate File: $webCertFile"
LOGI " - Private Key File: $webKeyFile" LOGI " - Private Key File: $webKeyFile"
LOGI " - Validity: ~6 days (auto-renews via acme.sh cron)" LOGI " - Validity: ~6 days (auto-renews via acme.sh cron)"
echo -e "${green}Access URL: https://${server_ip}:${existing_port}${existing_webBasePath}${plain}" echo -e "${green}Access URL: https://${server_ip}:${existing_port}${existing_webBasePath}${plain}"
LOGI "Panel will restart to apply SSL certificate..." LOGI "Panel will restart to apply SSL certificate..."
restart restart
return 0
else else
LOGE "Certificate files not found after installation" LOGE "Error: Certificate or private key file not found for IP: $server_ip."
return 1 return 1
fi fi
else
LOGI "Skipping panel path setting."
fi
return 0
} }
ssl_cert_issue() { ssl_cert_issue() {