mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
feat: 删除证书自动吊销证书 (#6300)
Refs https://github.com/1Panel-dev/1Panel/issues/4781
This commit is contained in:
parent
c492796cf8
commit
42f904e25a
@ -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…
x
Reference in New Issue
Block a user