mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-10-23 11:04:07 +02:00
Fixed #855
- Updated timeout to 600s - Fixed dns challenge certificate set default bug
This commit is contained in:
@@ -508,8 +508,8 @@ func (a *ACMEHandler) HandleRenewCertificate(w http.ResponseWriter, r *http.Requ
|
||||
dns = true
|
||||
}
|
||||
|
||||
// Default propagation timeout is 300 seconds
|
||||
propagationTimeout := 300
|
||||
// Default propagation timeout is 600 seconds (10 minutes)
|
||||
propagationTimeout := 600
|
||||
if dns {
|
||||
ppgTimeout, err := utils.PostPara(r, "ppgTimeout")
|
||||
if err == nil {
|
||||
|
@@ -86,6 +86,7 @@ func (m *Manager) SetCertAsDefault(w http.ResponseWriter, r *http.Request) {
|
||||
//Check if the previous default cert exists. If yes, get its hostname from cert contents
|
||||
defaultPubKey := filepath.Join(m.CertStore, "default.key")
|
||||
defaultPriKey := filepath.Join(m.CertStore, "default.pem")
|
||||
defaultJSON := filepath.Join(m.CertStore, "default.json")
|
||||
if utils.FileExists(defaultPubKey) && utils.FileExists(defaultPriKey) {
|
||||
//Move the existing default cert to its original name
|
||||
certBytes, err := os.ReadFile(defaultPriKey)
|
||||
@@ -94,8 +95,15 @@ func (m *Manager) SetCertAsDefault(w http.ResponseWriter, r *http.Request) {
|
||||
if block != nil {
|
||||
cert, err := x509.ParseCertificate(block.Bytes)
|
||||
if err == nil {
|
||||
os.Rename(defaultPubKey, filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "key")))
|
||||
os.Rename(defaultPriKey, filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "pem")))
|
||||
originalKeyName := filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "key"))
|
||||
originalPemName := filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "pem"))
|
||||
originalJSONName := filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "json"))
|
||||
|
||||
os.Rename(defaultPubKey, originalKeyName)
|
||||
os.Rename(defaultPriKey, originalPemName)
|
||||
if utils.FileExists(defaultJSON) {
|
||||
os.Rename(defaultJSON, originalJSONName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,9 +113,13 @@ func (m *Manager) SetCertAsDefault(w http.ResponseWriter, r *http.Request) {
|
||||
certname = filepath.Base(certname) //prevent path escape
|
||||
pubKey := filepath.Join(filepath.Join(m.CertStore), certname+".key")
|
||||
priKey := filepath.Join(filepath.Join(m.CertStore), certname+".pem")
|
||||
certJSON := filepath.Join(filepath.Join(m.CertStore), certname+".json")
|
||||
if utils.FileExists(pubKey) && utils.FileExists(priKey) {
|
||||
os.Rename(pubKey, filepath.Join(m.CertStore, "default.key"))
|
||||
os.Rename(priKey, filepath.Join(m.CertStore, "default.pem"))
|
||||
if utils.FileExists(certJSON) {
|
||||
os.Rename(certJSON, filepath.Join(m.CertStore, "default.json"))
|
||||
}
|
||||
utils.SendOK(w)
|
||||
|
||||
//Update cert list
|
||||
|
@@ -468,7 +468,7 @@
|
||||
defaultIntValue = 2;
|
||||
defaultMinValue = 1;
|
||||
}else if (key == "PropagationTimeout"){
|
||||
defaultIntValue = 120;
|
||||
defaultIntValue = 600;
|
||||
defaultMinValue = 30;
|
||||
}
|
||||
optionalFieldsHTML += (`<div class="ui fluid labeled dnsConfigField small input" key="${key}" style="margin-top: 0.2em;">
|
||||
|
Reference in New Issue
Block a user