-
-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
740294a
commit 5f7ced8
Showing
26 changed files
with
35 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ function get_cert() { | |
# ./lib/acme.sh --register-account -m [email protected] | ||
|
||
DOMAIN=$1 | ||
ssl_cert_path=../ssl | ||
ssl_cert_path=/opt/hiddify-manager/ssl | ||
rm -f $ssl_cert_path/$DOMAIN.key | ||
|
||
if [ ${#DOMAIN} -le 64 ]; then | ||
|
@@ -76,7 +76,7 @@ function get_cert() { | |
} | ||
|
||
function has_valid_cert() { | ||
certificate="../ssl/$1.crt" | ||
certificate="/opt/hiddify-manager/ssl/$1.crt" | ||
} | ||
|
||
function get_self_signed_cert() { | ||
|
@@ -86,34 +86,34 @@ function get_self_signed_cert() { | |
echo "Domain length exceeds 64 characters. Truncating to the first 64 characters." | ||
d="${d:0:64}" | ||
fi | ||
mkdir -p ../ssl | ||
local certificate="../ssl/$d.crt" | ||
local private_key="../ssl/$d.crt.key" | ||
mkdir -p /opt/hiddify-manager/ssl | ||
local certificate="/opt/hiddify-manager/ssl/$d.crt" | ||
local private_key="/opt/hiddify-manager/ssl/$d.crt.key" | ||
local current_date=$(date +%s) | ||
local generate_new_cert=0 | ||
# Check if the certificate file exists | ||
if [ ! -f "$certificate" ]; then | ||
echo "Certificate $d file not found. Generating a new certificate." | ||
echo "Certificate $d ($certificate) file not found. Generating a new certificate." | ||
generate_new_cert=1 | ||
else | ||
local expire_date=$(openssl x509 -enddate -noout -in "$certificate" | cut -d= -f2-) | ||
# Convert the expire date to seconds since epoch | ||
local expire_date_seconds=$(date -d "$expire_date" +%s) | ||
|
||
if [ "$current_date" -ge "$expire_date_seconds" ]; then | ||
echo "Certificate $d is expired. Generating a new certificate." | ||
echo "Certificate $d ($certificate) is expired. Generating a new certificate." | ||
generate_new_cert=1 | ||
fi | ||
fi | ||
|
||
# Check if the private key file exists | ||
if [ ! -f "$private_key" ]; then | ||
echo "Private key file $d not found. Generating a new certificate." | ||
echo "Private key file $d ($private_key) not found. Generating a new certificate." | ||
generate_new_cert=1 | ||
else | ||
# Check if the private key is valid | ||
if ! openssl rsa -check -in "$private_key" >/dev/null && ! openssl ec -check -in "$private_key" >/dev/null; then | ||
echo "Private key $d is invalid. Generating a new certificate." | ||
echo "Private key $d ($private_key) is invalid. Generating a new certificate." | ||
generate_new_cert=1 | ||
fi | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule src
updated
from 21d7f2 to d58587
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters