feat: 删除证书自动吊销证书 (#6300)

Refs https://github.com/1Panel-dev/1Panel/issues/4781
pull/6338/head
zhengkunwang 3 months ago committed by GitHub
parent c492796cf8
commit 42f904e25a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -410,6 +410,19 @@ func (w WebsiteSSLService) Delete(ids []uint) error {
return buserr.New("ErrDeleteWithPanelSSL")
}
}
websiteSSL, err := websiteSSLRepo.GetFirst(commonRepo.WithByID(id))
if err != nil {
return err
}
acmeAccount, err := websiteAcmeRepo.GetFirst(commonRepo.WithByID(websiteSSL.AcmeAccountID))
if err != nil {
return err
}
client, err := ssl.NewAcmeClient(acmeAccount)
if err != nil {
return err
}
_ = client.RevokeSSL([]byte(websiteSSL.Pem))
_ = websiteSSLRepo.DeleteBy(commonRepo.WithByID(id))
}
if len(names) > 0 {

@ -227,6 +227,10 @@ func (c *AcmeClient) ObtainSSL(domains []string, privateKey crypto.PrivateKey) (
return *certificates, nil
}
func (c *AcmeClient) RevokeSSL(pemSSL []byte) error {
return c.Client.Certificate.Revoke(pemSSL)
}
type Resolve struct {
Key string
Value string

Loading…
Cancel
Save