Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 90ba036

Browse files
feat: Restrict deletion of certificates that are being applied for. (1Panel-dev#9753)
Refs 1Panel-dev#9737 (comment)
1 parent d1e18e4 commit 90ba036

File tree

10 files changed

+23
-4
lines changed

10 files changed

+23
-4
lines changed

‎agent/app/service/website_ssl.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,15 @@ func (w WebsiteSSLService) GetWebsiteSSL(websiteId uint) (response.WebsiteSSLDTO
442442
}
443443

444444
func (w WebsiteSSLService) Delete(ids []uint) error {
445-
var names []string
445+
var (
446+
websiteSSLS []string
447+
applySSLS []string
448+
)
446449
for _, id := range ids {
447450
if websites, _ := websiteRepo.GetBy(websiteRepo.WithWebsiteSSLID(id)); len(websites) > 0 {
448451
oldSSL, _ := websiteSSLRepo.GetFirst(repo.WithByID(id))
449452
if oldSSL.ID > 0 {
450-
names = append(names, oldSSL.PrimaryDomain)
453+
websiteSSLS = append(websiteSSLS, oldSSL.PrimaryDomain)
451454
}
452455
continue
453456
}
@@ -463,6 +466,10 @@ func (w WebsiteSSLService) Delete(ids []uint) error {
463466
if err != nil {
464467
return err
465468
}
469+
if websiteSSL.Status == constant.SSLApply {
470+
applySSLS = append(applySSLS, websiteSSL.PrimaryDomain)
471+
continue
472+
}
466473
if websiteSSL.Provider != constant.Manual && websiteSSL.Provider != constant.SelfSigned {
467474
acmeAccount, err := websiteAcmeRepo.GetFirst(repo.WithByID(websiteSSL.AcmeAccountID))
468475
if err != nil {
@@ -478,8 +485,11 @@ func (w WebsiteSSLService) Delete(ids []uint) error {
478485
}
479486
_ = websiteSSLRepo.DeleteBy(repo.WithByID(id))
480487
}
481-
if len(names) > 0 {
482-
return buserr.WithName("ErrSSLCannotDelete", strings.Join(names, ","))
488+
if len(websiteSSLS) > 0 {
489+
return buserr.WithName("ErrSSLCannotDelete", strings.Join(websiteSSLS, ","))
490+
}
491+
if len(applySSLS) > 0 {
492+
return buserr.WithName("ErrApplySSLCanNotDelete", strings.Join(applySSLS, ","))
483493
}
484494
return nil
485495
}

‎agent/i18n/lang/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ExecShellSuccess: 'Script execution successful'
155155
StartUpdateSystemSSL: 'Start updating system certificate'
156156
UpdateSystemSSLSuccess: 'Update system certificate successfully'
157157
ErrWildcardDomain: 'Unable to apply for wildcard domain name certificate in HTTP mode'
158+
ErrApplySSLCanNotDelete: "The certificate {{.name}} being applied for cannot be deleted, please try again later."
158159

159160
#mysql
160161
ErrUserIsExist: 'The current user already exists, please re-enter'

‎agent/i18n/lang/ja.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ExecShellSuccess: 'スクリプトの実行が成功しました'
155155
StartUpdateSystemSSL: 'システム証明書の更新を開始します'
156156
UpdateSystemSSLSuccess: 'システム証明書を正常に更新しました'
157157
ErrWildcardDomain: 'HTTP モードでワイルドカード ドメイン名証明書を申請できません'
158+
ErrApplySSLCanNotDelete: "申請中の証明書 {{.name}} は削除できません。しばらくしてからもう一度お試しください。"
158159

159160
#mysql
160161
ErrUserIsExist: '現在のユーザーは既に存在します。再入力してください'

‎agent/i18n/lang/ko.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ExecShellSuccess: '스크립트 실행 성공'
155155
StartUpdateSystemSSL: '시스템 인증서 업데이트 시작'
156156
UpdateSystemSSLSuccess: '시스템 인증서 업데이트가 성공적으로 완료되었습니다.'
157157
ErrWildcardDomain: 'HTTP 모드에서 와일드카드 도메인 이름 인증서를 신청할 수 없습니다'
158+
ErrApplySSLCanNotDelete: "신청 중인 인증서 {{.name}}는 삭제할 수 없습니다. 나중에 다시 시도해 주세요."
158159

159160
#마이SQL
160161
ErrUserIsExist: '현재 사용자가 이미 존재합니다. 다시 입력하세요'

‎agent/i18n/lang/ms.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ ExecShellSuccess: 'Pelaksanaan skrip berjaya'
154154
StartUpdateSystemSSL: 'Mula mengemas kini sijil sistem'
155155
UpdateSystemSSLSuccess: 'Berjaya kemas kini sijil sistem'
156156
ErrWildcardDomain: 'Tidak dapat memohon sijil nama domain kad bebas dalam mod HTTP'
157+
ErrApplySSLCanNotDelete: "Sertifikat {{.name}} yang sedang diajukan tidak dapat dihapus, sila cuba lagi kemudian."
157158

158159
#mysql
159160
ErrUserIsExist: 'Pengguna semasa sudah wujud, sila masukkan semula'

‎agent/i18n/lang/pt-BR.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ExecShellSuccess: 'Execução do script bem-sucedida'
155155
StartUpdateSystemSSL: 'Iniciar atualização do certificado do sistema'
156156
UpdateSystemSSLSuccess: 'Atualizar certificado do sistema com sucesso'
157157
ErrWildcardDomain: 'Não é possível solicitar certificado de nome de domínio curinga no modo HTTP'
158+
ErrApplySSLCanNotDelete: "O certificado {{.name}} que está sendo solicitado não pode ser excluído, tente novamente mais tarde."
158159

159160
#mysql
160161
ErrUserIsExist: 'O usuário atual já existe, digite novamente'

‎agent/i18n/lang/ru.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ExecShellSuccess: 'Скрипт выполнен успешно'
155155
StartUpdateSystemSSL: 'Начать обновление системного сертификата'
156156
UpdateSystemSSLSuccess: 'Сертификат системы обновлен успешно'
157157
ErrWildcardDomain: 'Невозможно подать заявку на получение подстановочного сертификата доменного имени в режиме HTTP'
158+
ErrApplySSLCanNotDelete: "Нельзя удалить сертификат {{.name}}, который находится в процессе выпуска. Пожалуйста, попробуйте позже."
158159

159160
#mysql
160161
ErrUserIsExist: 'Текущий пользователь уже существует, пожалуйста, введите еще раз'

‎agent/i18n/lang/tr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ExecShellSuccess: 'Betik yürütme başarılı'
155155
StartUpdateSystemSSL: 'Sistem sertifikası güncellemeyi başlat'
156156
UpdateSystemSSLSuccess: 'Sistem sertifikası güncelleme başarılı'
157157
ErrWildcardDomain: 'HTTP modunda joker alan adı sertifikası başvurusu yapılamıyor'
158+
ErrApplySSLCanNotDelete: "İşlemde olan sertifika {{.name}} silinemez, lütfen daha sonra tekrar deneyin."
158159

159160
#mysql
160161
ErrUserIsExist: 'Mevcut kullanıcı zaten mevcut, lütfen yeniden girin'

‎agent/i18n/lang/zh-Hant.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ ExecShellSuccess: '腳本執行成功'
154154
StartUpdateSystemSSL: '開始更新系統憑證'
155155
UpdateSystemSSLSuccess: '更新系統憑證成功'
156156
ErrWildcardDomain: 'HTTP 模式無法申請泛網域憑證'
157+
ErrApplySSLCanNotDelete: "正在申請的證書 {{.name}} 無法刪除,請稍後再試"
157158

158159
#mysql
159160
ErrUserIsExist: '目前使用者已存在,請重新輸入'

‎agent/i18n/lang/zh.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ ExecShellSuccess: "脚本执行成功"
154154
StartUpdateSystemSSL: "开始更新系统证书"
155155
UpdateSystemSSLSuccess: "更新系统证书成功"
156156
ErrWildcardDomain: "HTTP 模式无法申请泛域名证书"
157+
ErrApplySSLCanNotDelete: "正在申请的证书{{.name}}无法删除,请稍后再试"
157158

158159
#mysql
159160
ErrUserIsExist: "当前用户已存在,请重新输入"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /