Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Fix multi certs issue
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzKafkaYu committed Jun 9, 2023
1 parent 7520286 commit 204edd3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
14 changes: 4 additions & 10 deletions x-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -482,17 +482,14 @@ ssl_cert_issue_standalone() {
certPath=/root/cert
if [ ! -d "$certPath" ]; then
mkdir $certPath
else
rm -rf $certPath
mkdir $certPath
fi
#get the domain here,and we need verify it
local domain=""
read -p "请输入你的域名:" domain
LOGD "你输入的域名为:${domain},正在进行域名合法性校验..."
#here we need to judge whether there exists cert already
local currentCert=$(~/.acme.sh/acme.sh --list | tail -1 | awk '{print $1}')
if [ ${currentCert} == ${domain} ]; then
local currentCert=$(~/.acme.sh/acme.sh --list | grep ${domain} | wc -l)
if [ ${currentCert} -ne 0 ]; then
local certInfo=$(~/.acme.sh/acme.sh --list)
LOGE "域名合法性校验失败,当前环境已有对应域名证书,不可重复申请,当前证书详情:"
LOGI "$certInfo"
Expand Down Expand Up @@ -566,16 +563,13 @@ ssl_cert_issue_by_cloudflare() {
certPath=/root/cert
if [ ! -d "$certPath" ]; then
mkdir $certPath
else
rm -rf $certPath
mkdir $certPath
fi
LOGD "请设置域名:"
read -p "Input your domain here:" CF_Domain
LOGD "你的域名设置为:${CF_Domain},正在进行域名合法性校验..."
#here we need to judge whether there exists cert already
local currentCert=$(~/.acme.sh/acme.sh --list | tail -1 | awk '{print $1}')
if [ ${currentCert} == ${CF_Domain} ]; then
local currentCert=$(~/.acme.sh/acme.sh --list | grep ${CF_Domain} | wc -l)
if [ ${currentCert} -ne 0 ]; then
local certInfo=$(~/.acme.sh/acme.sh --list)
LOGE "域名合法性校验失败,当前环境已有对应域名证书,不可重复申请,当前证书详情:"
LOGI "$certInfo"
Expand Down
22 changes: 8 additions & 14 deletions x-ui_en.sh
Original file line number Diff line number Diff line change
Expand Up @@ -474,17 +474,14 @@ ssl_cert_issue_standalone() {
certPath=/root/cert
if [ ! -d "$certPath" ]; then
mkdir $certPath
else
rm -rf $certPath
mkdir $certPath
fi
#get the domain here,and we need verify it
local domain=""
read -p "please input your domain:" domain
LOGD "your domain is:${domain},check it..."
#here we need to judge whether there exists cert already
local currentCert=$(~/.acme.sh/acme.sh --list | tail -1 | awk '{print $1}')
if [ ${currentCert} == ${domain} ]; then
local currentCert=$(~/.acme.sh/acme.sh --list | grep ${domain} | wc -l)
if [ ${currentCert} -ne 0 ]; then
local certInfo=$(~/.acme.sh/acme.sh --list)
LOGE "system already have certs here,can not issue again,current certs details:"
LOGI "$certInfo"
Expand Down Expand Up @@ -512,8 +509,8 @@ ssl_cert_issue_standalone() {
fi
#install cert
~/.acme.sh/acme.sh --installcert -d ${domain} --ca-file /root/cert/ca.cer \
--cert-file /root/cert/${domain}.cer --key-file /root/cert/${domain}.key \
--fullchain-file /root/cert/fullchain.cer
--cert-file /root/cert/${domain}.cer --key-file /root/cert/${domain}.key \
--fullchain-file /root/cert/fullchain.cer

if [ $? -ne 0 ]; then
LOGE "install certs failed,exit"
Expand Down Expand Up @@ -556,16 +553,13 @@ ssl_cert_issue_by_cloudflare() {
certPath=/root/cert
if [ ! -d "$certPath" ]; then
mkdir $certPath
else
rm -rf $certPath
mkdir $certPath
fi
LOGD "please input your domain:"
read -p "Input your domain here:" CF_Domain
LOGD "your domain is:${CF_Domain},check it..."
#here we need to judge whether there exists cert already
local currentCert=$(~/.acme.sh/acme.sh --list | tail -1 | awk '{print $1}')
if [ ${currentCert} == ${CF_Domain} ]; then
local currentCert=$(~/.acme.sh/acme.sh --list | grep ${CF_Domain} | wc -l)
if [ ${currentCert} -ne 0 ]; then
local certInfo=$(~/.acme.sh/acme.sh --list)
LOGE "system already have certs here,can not issue again,current certs details:"
LOGI "$certInfo"
Expand Down Expand Up @@ -595,8 +589,8 @@ ssl_cert_issue_by_cloudflare() {
LOGI "issue cert succeed,installing..."
fi
~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} --ca-file /root/cert/ca.cer \
--cert-file /root/cert/${CF_Domain}.cer --key-file /root/cert/${CF_Domain}.key \
--fullchain-file /root/cert/fullchain.cer
--cert-file /root/cert/${CF_Domain}.cer --key-file /root/cert/${CF_Domain}.key \
--fullchain-file /root/cert/fullchain.cer
if [ $? -ne 0 ]; then
LOGE "install cert failed,exit"
rm -rf ~/.acme.sh/${CF_Domain}
Expand Down

0 comments on commit 204edd3

Please sign in to comment.