mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
enhance: limit cert renewal interval between 7 to 21 days
This commit is contained in:
parent
49b41d6eb7
commit
e3876cffaf
2 changed files with 11 additions and 1 deletions
|
@ -60,7 +60,7 @@ func renew(certModel *model.Cert) {
|
|||
notification.Error("Renew Certificate Error", strings.Join(certModel.Domains, ", "))
|
||||
return
|
||||
}
|
||||
if int(time.Now().Sub(cert.NotBefore).Hours()/24) < settings.ServerSettings.CertRenewalInterval {
|
||||
if int(time.Now().Sub(cert.NotBefore).Hours()/24) < settings.ServerSettings.GetCertRenewalInterval() {
|
||||
// not after settings.ServerSettings.CertRenewalInterval, ignore
|
||||
return
|
||||
}
|
||||
|
|
|
@ -33,6 +33,16 @@ func (s *Server) GetCADir() string {
|
|||
return lego.LEDirectoryProduction
|
||||
}
|
||||
|
||||
func (s *Server) GetCertRenewalInterval() int {
|
||||
if s.CertRenewalInterval < 7 {
|
||||
return 7
|
||||
}
|
||||
if s.CertRenewalInterval > 21 {
|
||||
return 21
|
||||
}
|
||||
return s.CertRenewalInterval
|
||||
}
|
||||
|
||||
var ServerSettings = Server{
|
||||
HttpHost: "0.0.0.0",
|
||||
HttpPort: "9000",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue