- Updated timeout to 600s
- Fixed dns challenge certificate set default bug
This commit is contained in:
Toby Chui
2025-10-21 21:22:43 +08:00
parent 5c8e4a7df1
commit 72e5d3ce3f
3 changed files with 17 additions and 5 deletions

View File

@@ -508,8 +508,8 @@ func (a *ACMEHandler) HandleRenewCertificate(w http.ResponseWriter, r *http.Requ
dns = true dns = true
} }
// Default propagation timeout is 300 seconds // Default propagation timeout is 600 seconds (10 minutes)
propagationTimeout := 300 propagationTimeout := 600
if dns { if dns {
ppgTimeout, err := utils.PostPara(r, "ppgTimeout") ppgTimeout, err := utils.PostPara(r, "ppgTimeout")
if err == nil { if err == nil {

View File

@@ -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 //Check if the previous default cert exists. If yes, get its hostname from cert contents
defaultPubKey := filepath.Join(m.CertStore, "default.key") defaultPubKey := filepath.Join(m.CertStore, "default.key")
defaultPriKey := filepath.Join(m.CertStore, "default.pem") defaultPriKey := filepath.Join(m.CertStore, "default.pem")
defaultJSON := filepath.Join(m.CertStore, "default.json")
if utils.FileExists(defaultPubKey) && utils.FileExists(defaultPriKey) { if utils.FileExists(defaultPubKey) && utils.FileExists(defaultPriKey) {
//Move the existing default cert to its original name //Move the existing default cert to its original name
certBytes, err := os.ReadFile(defaultPriKey) certBytes, err := os.ReadFile(defaultPriKey)
@@ -94,8 +95,15 @@ func (m *Manager) SetCertAsDefault(w http.ResponseWriter, r *http.Request) {
if block != nil { if block != nil {
cert, err := x509.ParseCertificate(block.Bytes) cert, err := x509.ParseCertificate(block.Bytes)
if err == nil { if err == nil {
os.Rename(defaultPubKey, filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "key"))) originalKeyName := filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "key"))
os.Rename(defaultPriKey, filepath.Join(m.CertStore, domainToFilename(cert.Subject.CommonName, "pem"))) 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 certname = filepath.Base(certname) //prevent path escape
pubKey := filepath.Join(filepath.Join(m.CertStore), certname+".key") pubKey := filepath.Join(filepath.Join(m.CertStore), certname+".key")
priKey := filepath.Join(filepath.Join(m.CertStore), certname+".pem") 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) { if utils.FileExists(pubKey) && utils.FileExists(priKey) {
os.Rename(pubKey, filepath.Join(m.CertStore, "default.key")) os.Rename(pubKey, filepath.Join(m.CertStore, "default.key"))
os.Rename(priKey, filepath.Join(m.CertStore, "default.pem")) 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) utils.SendOK(w)
//Update cert list //Update cert list

View File

@@ -468,7 +468,7 @@
defaultIntValue = 2; defaultIntValue = 2;
defaultMinValue = 1; defaultMinValue = 1;
}else if (key == "PropagationTimeout"){ }else if (key == "PropagationTimeout"){
defaultIntValue = 120; defaultIntValue = 600;
defaultMinValue = 30; defaultMinValue = 30;
} }
optionalFieldsHTML += (`<div class="ui fluid labeled dnsConfigField small input" key="${key}" style="margin-top: 0.2em;"> optionalFieldsHTML += (`<div class="ui fluid labeled dnsConfigField small input" key="${key}" style="margin-top: 0.2em;">