diff --git a/backend/app/service/website_ca.go b/backend/app/service/website_ca.go index 15bb9abad..40bdcb5c7 100644 --- a/backend/app/service/website_ca.go +++ b/backend/app/service/website_ca.go @@ -276,7 +276,7 @@ func (w WebsiteCAService) ObtainSSL(req request.WebsiteCAObtain) (*model.Website } var rootPrivateKey any - if ssl.KeyType(websiteSSL.KeyType) == certcrypto.EC256 || ssl.KeyType(websiteSSL.KeyType) == certcrypto.EC384 { + if ssl.KeyType(ca.KeyType) == certcrypto.EC256 || ssl.KeyType(ca.KeyType) == certcrypto.EC384 { rootPrivateKey, err = x509.ParseECPrivateKey(rootPrivateKeyBlock.Bytes) if err != nil { return nil, err @@ -396,8 +396,7 @@ func createPrivateKey(keyType string) (privateKey any, publicKey any, privateKey block.Bytes = privateBytes _ = pem.Encode(caPrivateKeyPEM, block) } else { - publicKey = privateKey.(*rsa.PrivateKey).PublicKey - publicKey = publicKey.(*rsa.PublicKey) + publicKey = &privateKey.(*rsa.PrivateKey).PublicKey _ = pem.Encode(caPrivateKeyPEM, &pem.Block{ Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey.(*rsa.PrivateKey)), diff --git a/backend/cron/job/ssl.go b/backend/cron/job/ssl.go index 1256fcf1d..374d45664 100644 --- a/backend/cron/job/ssl.go +++ b/backend/cron/job/ssl.go @@ -35,7 +35,7 @@ func (ssl *ssl) Run() { expireDate := s.ExpireDate.In(nyc) sub := expireDate.Sub(now) if sub.Hours() < 720 { - global.LOG.Errorf("Update the SSL certificate for the [%s] domain", s.PrimaryDomain) + global.LOG.Infof("Update the SSL certificate for the [%s] domain", s.PrimaryDomain) if s.Provider == constant.SelfSigned { caService := service.NewIWebsiteCAService() if _, err := caService.ObtainSSL(request.WebsiteCAObtain{ @@ -43,7 +43,7 @@ func (ssl *ssl) Run() { SSLID: s.ID, Renew: true, Unit: "year", - Time: 1, + Time: 10, }); err != nil { global.LOG.Errorf("Failed to update the SSL certificate for the [%s] domain , err:%s", s.PrimaryDomain, err.Error()) continue @@ -69,7 +69,7 @@ func (ssl *ssl) Run() { continue } } - global.LOG.Errorf("The SSL certificate for the [%s] domain has been successfully updated", s.PrimaryDomain) + global.LOG.Infof("The SSL certificate for the [%s] domain has been successfully updated", s.PrimaryDomain) } } global.LOG.Info("The scheduled certificate update task has completed")