From e7cb8e2417a60080d5163038cdb7a7fd1de63610 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:36:39 +0800 Subject: [PATCH] feat(website): Manually request certificates using a custom nameserver. (#7840) --- agent/app/service/website_ssl.go | 2 +- agent/utils/ssl/client.go | 33 ++++- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/ja.ts | 1 + frontend/src/lang/modules/ko.ts | 1 + frontend/src/lang/modules/ms.ts | 1 + frontend/src/lang/modules/pt-br.ts | 1 + frontend/src/lang/modules/ru.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/styles/common.scss | 139 +----------------- frontend/src/views/app-store/index.scss | 5 - .../src/views/app-store/installed/index.vue | 13 +- .../website/config/basic/redirect/index.vue | 2 +- 14 files changed, 41 insertions(+), 161 deletions(-) diff --git a/agent/app/service/website_ssl.go b/agent/app/service/website_ssl.go index ac53b865f..bcc3c760d 100644 --- a/agent/app/service/website_ssl.go +++ b/agent/app/service/website_ssl.go @@ -255,7 +255,7 @@ func (w WebsiteSSLService) ObtainSSL(apply request.WebsiteSSLApply) error { return err } case constant.DnsManual: - if err := client.UseManualDns(); err != nil { + if err := client.UseManualDns(*websiteSSL); err != nil { return err } } diff --git a/agent/utils/ssl/client.go b/agent/utils/ssl/client.go index 9f50badb4..af0b948a3 100644 --- a/agent/utils/ssl/client.go +++ b/agent/utils/ssl/client.go @@ -101,6 +101,7 @@ var ( propagationTimeout = 30 * time.Minute pollingInterval = 10 * time.Second ttl = 3600 + dnsTimeOut = 30 * time.Minute ) func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.WebsiteSSL) error { @@ -136,7 +137,7 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web cloudflareConfig.AuthToken = param.APIkey cloudflareConfig.PropagationTimeout = propagationTimeout cloudflareConfig.PollingInterval = pollingInterval - cloudflareConfig.TTL = 3600 + cloudflareConfig.TTL = ttl p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig) case CloudDns: clouddnsConfig := clouddns.NewDefaultConfig() @@ -231,14 +232,34 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web dns01.CondOption(len(nameservers) > 0, dns01.AddRecursiveNameservers(nameservers)), dns01.CondOption(websiteSSL.SkipDNS, - dns01.DisableCompletePropagationRequirement()), - dns01.AddDNSTimeout(10*time.Minute), + dns01.DisableAuthoritativeNssPropagationRequirement()), + dns01.AddDNSTimeout(dnsTimeOut), ) } -func (c *AcmeClient) UseManualDns() error { - p := &manualDnsProvider{} - if err := c.Client.Challenge.SetDNS01Provider(p, dns01.AddDNSTimeout(10*time.Minute)); err != nil { +func (c *AcmeClient) UseManualDns(websiteSSL model.WebsiteSSL) error { + p, err := dns01.NewDNSProviderManual() + if err != nil { + return err + } + var nameservers []string + if websiteSSL.Nameserver1 != "" { + nameservers = append(nameservers, websiteSSL.Nameserver1) + } + if websiteSSL.Nameserver2 != "" { + nameservers = append(nameservers, websiteSSL.Nameserver2) + } + if websiteSSL.DisableCNAME { + _ = os.Setenv("LEGO_DISABLE_CNAME_SUPPORT", "true") + } else { + _ = os.Setenv("LEGO_DISABLE_CNAME_SUPPORT", "false") + } + if err = c.Client.Challenge.SetDNS01Provider(p, + dns01.CondOption(len(nameservers) > 0, + dns01.AddRecursiveNameservers(nameservers)), + dns01.CondOption(websiteSSL.SkipDNS, + dns01.DisableAuthoritativeNssPropagationRequirement()), + dns01.AddDNSTimeout(dnsTimeOut)); err != nil { return err } return nil diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 3fc9bc94c..07d78a399 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -293,6 +293,7 @@ const message = { healthy: 'Normal', executing: 'Executing', installerr: 'Installation failed', + applyerror: 'Apply failed', }, units: { second: 'Second', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index c1d8f19c7..bb0dce173 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -287,6 +287,7 @@ const message = { healthy: '正常', executing: '実行中', installerr: 'インストールに失敗しました', + applyerror: '適用に失敗しました', }, units: { second: '2番目|2番目|秒', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 616df2e34..84968e69f 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -288,6 +288,7 @@ const message = { healthy: '정상', executing: '실행 중', installerr: '설치 실패', + applyerror: '적용 실패', }, units: { second: '초 | 초 | 초', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index 1380d1fe0..e444bf211 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -294,6 +294,7 @@ const message = { healthy: 'Sihat', executing: 'Melaksanakan', installerr: 'Pemasangan gagal', + applyerror: 'Permohonan gagal', }, units: { second: 'saat | saat | saat', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index c4b99ba39..4900cd283 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -292,6 +292,7 @@ const message = { healthy: 'Saudável', executing: 'Executando', installerr: 'Falha na instalação', + applyerror: 'Falha na aplicação', }, units: { second: 'segundo | segundos | segundos', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 8021e37d9..f1bda4e64 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -288,6 +288,7 @@ const message = { healthy: 'Нормально', executing: 'Выполнение', installerr: 'Ошибка установки', + applyerror: 'Ошибка применения', }, units: { second: ' секунда | секунда | секунд', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index a037c2cfc..944999d4b 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -287,6 +287,7 @@ const message = { healthy: '正常', executing: '執行中', installerr: '安裝失敗', + applyerror: '申請失敗', }, units: { second: '秒', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index a96a02665..86e1668e4 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -285,6 +285,7 @@ const message = { healthy: '正常', executing: '执行中', installerr: '安装失败', + applyerror: '申请失败', }, units: { second: '秒', diff --git a/frontend/src/styles/common.scss b/frontend/src/styles/common.scss index 9c3763c20..fdfe3f6dd 100644 --- a/frontend/src/styles/common.scss +++ b/frontend/src/styles/common.scss @@ -6,47 +6,18 @@ html { align-items: center; justify-content: center; } -.flx-justify-between { - display: flex; - align-items: center; - justify-content: space-between; -} + .flx-align-center { display: flex; align-items: center; } -.flx-wrap { - display: flex; - flex-wrap: wrap; -} - -.clearfix::after { - display: block; - height: 0; - overflow: hidden; - clear: both; - content: ''; -} - .sle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.mle { - display: -webkit-box; - overflow: hidden; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; -} - -.break-word { - word-break: break-all; - word-wrap: break-word; -} - .fade-transform-leave-active, .fade-transform-enter-active { transition: all 0.2s; @@ -87,18 +58,6 @@ html { border-radius: 20px; box-shadow: inset 0 0 0 white; } -.content-box { - display: flex; - flex-direction: column; - align-items: center; - height: 100%; - .text { - margin: 30px 0; - font-size: 23px; - font-weight: bold; - color: rgb(88 88 88); - } -} #nprogress { .bar { @@ -113,10 +72,6 @@ html { } } -.inline-block { - display: inline-block; -} - .form-button { float: right; } @@ -141,37 +96,6 @@ html { white-space: normal; } -.myTable { - border-collapse: collapse; - font-size: 12px; - table-layout: fixed; - td { - width: 35%; - padding: 8px; - height: 23px; - border: 1px solid #383c42; - word-wrap: break-word; - div { - margin-top: 2px; - } - th { - border: 0; - height: 30px; - } - tr { - &:hover { - background-color: #d9dde2; - } - &:first-child:hover { - background-color: transparent !important; - } - td:nth-child(even) { - color: #85888e; - } - } - } -} - .mask { width: 100%; height: 100%; @@ -195,48 +119,6 @@ html { } } -.table-button { - display: inline; - margin-right: 5px; -} - -.button-left { - float: left; -} - -.topRouterCard { - .el-card__body { - --el-card-border-color: var(--el-border-color-light); - --el-card-border-radius: 4px; - --el-card-padding: 0px; - --el-card-bg-color: var(--el-fill-color-blank); - } -} -.topRouterButton { - .el-radio-button__inner { - display: inline-block; - line-height: 1; - white-space: nowrap; - vertical-align: middle; - background: var(--el-button-bg-color, var(--el-fill-color-blank)); - border: 0; - font-weight: 350; - color: var(--el-button-text-color, var(--el-text-color-regular)); - text-align: center; - box-sizing: border-box; - outline: 0; - margin: 0; - position: relative; - cursor: pointer; - transition: var(--el-transition-all); - -webkit-user-select: none; - user-select: none; - padding: 8px 15px; - font-size: var(--el-font-size-base); - border-radius: 0; - } -} - .sidebar-container-popper { .el-menu--popup-right-start { background-color: rgba(0, 94, 235, 0.1); @@ -247,7 +129,6 @@ html { width: 250px; } -// drawer头部增加按钮 .drawer-header-button { span { color: currentColor !important; @@ -288,9 +169,6 @@ html { background-color: #000000; } -.middle-center { - vertical-align: middle; -} .status-count { font-size: 24px; } @@ -338,10 +216,6 @@ html { width: 40% !important; } -.left-button { - margin-left: 10px; -} - .pre-select { width: 85px !important; } @@ -377,12 +251,6 @@ html { margin-right: 20px; } -.text-parent { - display: flex; - width: 100%; - margin-left: 2px; -} - .text-ellipsis { overflow: hidden; text-overflow: ellipsis; @@ -399,10 +267,6 @@ html { margin-left: 5px !important; } -.p-mb-5 { - margin-bottom: 5px !important; -} - .p-w-200 { width: 200px !important; } @@ -469,7 +333,6 @@ html { } } - .el-descriptions { overflow: hidden; text-overflow: ellipsis; diff --git a/frontend/src/views/app-store/index.scss b/frontend/src/views/app-store/index.scss index c4ed82a27..9b33a9cba 100644 --- a/frontend/src/views/app-store/index.scss +++ b/frontend/src/views/app-store/index.scss @@ -66,11 +66,6 @@ } } -.table-button { - display: inline; - margin-right: 5px; -} - .app-divider { margin-top: 5px; border: 0; diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index 8fd31af26..d06c5cf78 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -233,25 +233,18 @@
- + {{ $t('app.version') }}:{{ installed.version }} - {{ $t('app.busPort') }}:{{ installed.httpPort }} - - + {{ $t('app.busPort') }}:{{ installed.httpsPort }} diff --git a/frontend/src/views/website/website/config/basic/redirect/index.vue b/frontend/src/views/website/website/config/basic/redirect/index.vue index c6b2ab203..732a26956 100644 --- a/frontend/src/views/website/website/config/basic/redirect/index.vue +++ b/frontend/src/views/website/website/config/basic/redirect/index.vue @@ -14,7 +14,7 @@