mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
Update to regular cert issue
This commit is contained in:
parent
21e7d45b54
commit
414042a45b
1 changed files with 34 additions and 6 deletions
38
x-ui.sh
38
x-ui.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue