Update to regular cert issue (#2790)

This commit is contained in:
somebodywashere 2025-03-18 15:47:58 +03:00 committed by GitHub
parent f7198c4c2f
commit fa5fb927c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

38
x-ui.sh
View file

@ -1136,10 +1136,36 @@ ssl_cert_issue() {
LOGE "Issuing certificate succeeded, installing certificates..." LOGE "Issuing certificate succeeded, installing certificates..."
fi fi
reloadCmd="x-ui restart"
LOGI "Default --reloadcmd for ACME is: ${yellow}x-ui restart"
LOGI "This command will run on every certificate issue and renew."
read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd
if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then
echo -e "\n${green}\t1.${plain} Preset: systemctl reload nginx ; x-ui restart"
echo -e "${green}\t2.${plain} Input your own command"
echo -e "${green}\t0.${plain} Keep default reloadcmd"
read -p "Choose an option: " choice
case "$choice" in
1)
LOGI "Reloadcmd is: systemctl reload nginx ; x-ui restart"
reloadCmd="systemctl reload nginx ; x-ui restart"
;;
2)
LOGD "It's recommended to put x-ui restart at the end, so it won't raise an error if other services fails"
read -p "Please enter your reloadcmd (example: systemctl reload nginx ; x-ui restart): " reloadCmd
LOGI "Your reloadcmd is: ${reloadCmd}"
;;
*)
LOGI "Keep default reloadcmd"
;;
esac
fi
# install the certificate # install the certificate
~/.acme.sh/acme.sh --installcert -d ${domain} \ ~/.acme.sh/acme.sh --installcert -d ${domain} \
--key-file /root/cert/${domain}/privkey.pem \ --key-file /root/cert/${domain}/privkey.pem \
--fullchain-file /root/cert/${domain}/fullchain.pem --fullchain-file /root/cert/${domain}/fullchain.pem --reloadcmd "${reloadCmd}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
LOGE "Installing certificate failed, exiting." LOGE "Installing certificate failed, exiting."
@ -1261,17 +1287,18 @@ ssl_cert_issue_CF() {
LOGI "This command will run on every certificate issue and renew." LOGI "This command will run on every certificate issue and renew."
read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd
if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then
echo -e "\n${green}\t1.${plain} Preset: x-ui restart ; systemctl reload nginx" echo -e "\n${green}\t1.${plain} Preset: systemctl reload nginx ; x-ui restart"
echo -e "${green}\t2.${plain} Input your own command" echo -e "${green}\t2.${plain} Input your own command"
echo -e "${green}\t0.${plain} Keep default reloadcmd" echo -e "${green}\t0.${plain} Keep default reloadcmd"
read -p "Choose an option: " choice read -p "Choose an option: " choice
case "$choice" in case "$choice" in
1) 1)
LOGI "Reloadcmd is: x-ui restart ; systemctl reload nginx" LOGI "Reloadcmd is: systemctl reload nginx ; x-ui restart"
reloadCmd="x-ui restart ; systemctl reload nginx" reloadCmd="systemctl reload nginx ; x-ui restart"
;; ;;
2) 2)
read -p "Please enter your reloadcmd (example: x-ui restart ; systemctl reload nginx): " reloadCmd LOGD "It's recommended to put x-ui restart at the end, so it won't raise an error if other services fails"
read -p "Please enter your reloadcmd (example: systemctl reload nginx ; x-ui restart): " reloadCmd
LOGI "Your reloadcmd is: ${reloadCmd}" LOGI "Your reloadcmd is: ${reloadCmd}"
;; ;;
*) *)
@ -1282,6 +1309,7 @@ ssl_cert_issue_CF() {
~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} \ ~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} \
--key-file ${certPath}/privkey.pem \ --key-file ${certPath}/privkey.pem \
--fullchain-file ${certPath}/fullchain.pem --reloadcmd "${reloadCmd}" --fullchain-file ${certPath}/fullchain.pem --reloadcmd "${reloadCmd}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
LOGE "Certificate installation failed, script exiting..." LOGE "Certificate installation failed, script exiting..."
exit 1 exit 1