diff --git a/src/mod/acme/acme.go b/src/mod/acme/acme.go index 54baacb..e7873dc 100644 --- a/src/mod/acme/acme.go +++ b/src/mod/acme/acme.go @@ -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 { diff --git a/src/mod/tlscert/handler.go b/src/mod/tlscert/handler.go index 099c6a3..6ed04aa 100644 --- a/src/mod/tlscert/handler.go +++ b/src/mod/tlscert/handler.go @@ -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 diff --git a/src/web/snippet/acme.html b/src/web/snippet/acme.html index f1f8b5b..fb90ba8 100644 --- a/src/web/snippet/acme.html +++ b/src/web/snippet/acme.html @@ -468,7 +468,7 @@ defaultIntValue = 2; defaultMinValue = 1; }else if (key == "PropagationTimeout"){ - defaultIntValue = 120; + defaultIntValue = 600; defaultMinValue = 30; } optionalFieldsHTML += (`