mirror of https://github.com/1Panel-dev/1Panel
fix: 解决自签证书使用 RSA 类型秘钥签发证书失败的问题 (#3204)
parent
a463026efe
commit
b6cbca36c2
|
@ -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)),
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue