mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 15:06:37 +08:00
feat: 删除证书自动吊销证书 (#6300)
Some checks failed
sync2gitee / repo-sync (push) Failing after -8m25s
Some checks failed
sync2gitee / repo-sync (push) Failing after -8m25s
Refs https://github.com/1Panel-dev/1Panel/issues/4781
This commit is contained in:
parent
c492796cf8
commit
42f904e25a
2 changed files with 17 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue