- 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
}
// 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 {

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
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

View File

@@ -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;">