feat(website): Manually request certificates using a custom nameserver. (#7840)

This commit is contained in:
zhengkunwang 2025-02-11 10:36:39 +08:00 committed by GitHub
parent a0d01d9a55
commit e7cb8e2417
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 41 additions and 161 deletions

View file

@ -255,7 +255,7 @@ func (w WebsiteSSLService) ObtainSSL(apply request.WebsiteSSLApply) error {
return err return err
} }
case constant.DnsManual: case constant.DnsManual:
if err := client.UseManualDns(); err != nil { if err := client.UseManualDns(*websiteSSL); err != nil {
return err return err
} }
} }

View file

@ -101,6 +101,7 @@ var (
propagationTimeout = 30 * time.Minute propagationTimeout = 30 * time.Minute
pollingInterval = 10 * time.Second pollingInterval = 10 * time.Second
ttl = 3600 ttl = 3600
dnsTimeOut = 30 * time.Minute
) )
func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.WebsiteSSL) error { 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.AuthToken = param.APIkey
cloudflareConfig.PropagationTimeout = propagationTimeout cloudflareConfig.PropagationTimeout = propagationTimeout
cloudflareConfig.PollingInterval = pollingInterval cloudflareConfig.PollingInterval = pollingInterval
cloudflareConfig.TTL = 3600 cloudflareConfig.TTL = ttl
p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig) p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig)
case CloudDns: case CloudDns:
clouddnsConfig := clouddns.NewDefaultConfig() clouddnsConfig := clouddns.NewDefaultConfig()
@ -231,14 +232,34 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web
dns01.CondOption(len(nameservers) > 0, dns01.CondOption(len(nameservers) > 0,
dns01.AddRecursiveNameservers(nameservers)), dns01.AddRecursiveNameservers(nameservers)),
dns01.CondOption(websiteSSL.SkipDNS, dns01.CondOption(websiteSSL.SkipDNS,
dns01.DisableCompletePropagationRequirement()), dns01.DisableAuthoritativeNssPropagationRequirement()),
dns01.AddDNSTimeout(10*time.Minute), dns01.AddDNSTimeout(dnsTimeOut),
) )
} }
func (c *AcmeClient) UseManualDns() error { func (c *AcmeClient) UseManualDns(websiteSSL model.WebsiteSSL) error {
p := &manualDnsProvider{} p, err := dns01.NewDNSProviderManual()
if err := c.Client.Challenge.SetDNS01Provider(p, dns01.AddDNSTimeout(10*time.Minute)); err != nil { 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 err
} }
return nil return nil

View file

@ -293,6 +293,7 @@ const message = {
healthy: 'Normal', healthy: 'Normal',
executing: 'Executing', executing: 'Executing',
installerr: 'Installation failed', installerr: 'Installation failed',
applyerror: 'Apply failed',
}, },
units: { units: {
second: 'Second', second: 'Second',

View file

@ -287,6 +287,7 @@ const message = {
healthy: '正常', healthy: '正常',
executing: '実行中', executing: '実行中',
installerr: 'インストールに失敗しました', installerr: 'インストールに失敗しました',
applyerror: '適用に失敗しました',
}, },
units: { units: {
second: '2番目|2番目|', second: '2番目|2番目|',

View file

@ -288,6 +288,7 @@ const message = {
healthy: '정상', healthy: '정상',
executing: '실행 ', executing: '실행 ',
installerr: '설치 실패', installerr: '설치 실패',
applyerror: '적용 실패',
}, },
units: { units: {
second: ' | | ', second: ' | | ',

View file

@ -294,6 +294,7 @@ const message = {
healthy: 'Sihat', healthy: 'Sihat',
executing: 'Melaksanakan', executing: 'Melaksanakan',
installerr: 'Pemasangan gagal', installerr: 'Pemasangan gagal',
applyerror: 'Permohonan gagal',
}, },
units: { units: {
second: 'saat | saat | saat', second: 'saat | saat | saat',

View file

@ -292,6 +292,7 @@ const message = {
healthy: 'Saudável', healthy: 'Saudável',
executing: 'Executando', executing: 'Executando',
installerr: 'Falha na instalação', installerr: 'Falha na instalação',
applyerror: 'Falha na aplicação',
}, },
units: { units: {
second: 'segundo | segundos | segundos', second: 'segundo | segundos | segundos',

View file

@ -288,6 +288,7 @@ const message = {
healthy: 'Нормально', healthy: 'Нормально',
executing: 'Выполнение', executing: 'Выполнение',
installerr: 'Ошибка установки', installerr: 'Ошибка установки',
applyerror: 'Ошибка применения',
}, },
units: { units: {
second: ' секунда | секунда | секунд', second: ' секунда | секунда | секунд',

View file

@ -287,6 +287,7 @@ const message = {
healthy: '正常', healthy: '正常',
executing: '執行中', executing: '執行中',
installerr: '安裝失敗', installerr: '安裝失敗',
applyerror: '申請失敗',
}, },
units: { units: {
second: '秒', second: '秒',

View file

@ -285,6 +285,7 @@ const message = {
healthy: '正常', healthy: '正常',
executing: '执行中', executing: '执行中',
installerr: '安装失败', installerr: '安装失败',
applyerror: '申请失败',
}, },
units: { units: {
second: '秒', second: '秒',

View file

@ -6,47 +6,18 @@ html {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.flx-justify-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flx-align-center { .flx-align-center {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.flx-wrap {
display: flex;
flex-wrap: wrap;
}
.clearfix::after {
display: block;
height: 0;
overflow: hidden;
clear: both;
content: '';
}
.sle { .sle {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; 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-leave-active,
.fade-transform-enter-active { .fade-transform-enter-active {
transition: all 0.2s; transition: all 0.2s;
@ -87,18 +58,6 @@ html {
border-radius: 20px; border-radius: 20px;
box-shadow: inset 0 0 0 white; 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 { #nprogress {
.bar { .bar {
@ -113,10 +72,6 @@ html {
} }
} }
.inline-block {
display: inline-block;
}
.form-button { .form-button {
float: right; float: right;
} }
@ -141,37 +96,6 @@ html {
white-space: normal; 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 { .mask {
width: 100%; width: 100%;
height: 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 { .sidebar-container-popper {
.el-menu--popup-right-start { .el-menu--popup-right-start {
background-color: rgba(0, 94, 235, 0.1); background-color: rgba(0, 94, 235, 0.1);
@ -247,7 +129,6 @@ html {
width: 250px; width: 250px;
} }
// drawer头部增加按钮
.drawer-header-button { .drawer-header-button {
span { span {
color: currentColor !important; color: currentColor !important;
@ -288,9 +169,6 @@ html {
background-color: #000000; background-color: #000000;
} }
.middle-center {
vertical-align: middle;
}
.status-count { .status-count {
font-size: 24px; font-size: 24px;
} }
@ -338,10 +216,6 @@ html {
width: 40% !important; width: 40% !important;
} }
.left-button {
margin-left: 10px;
}
.pre-select { .pre-select {
width: 85px !important; width: 85px !important;
} }
@ -377,12 +251,6 @@ html {
margin-right: 20px; margin-right: 20px;
} }
.text-parent {
display: flex;
width: 100%;
margin-left: 2px;
}
.text-ellipsis { .text-ellipsis {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -399,10 +267,6 @@ html {
margin-left: 5px !important; margin-left: 5px !important;
} }
.p-mb-5 {
margin-bottom: 5px !important;
}
.p-w-200 { .p-w-200 {
width: 200px !important; width: 200px !important;
} }
@ -469,7 +333,6 @@ html {
} }
} }
.el-descriptions { .el-descriptions {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;

View file

@ -66,11 +66,6 @@
} }
} }
.table-button {
display: inline;
margin-right: 5px;
}
.app-divider { .app-divider {
margin-top: 5px; margin-top: 5px;
border: 0; border: 0;

View file

@ -233,25 +233,18 @@
<div <div
class="d-description flex flex-wrap items-center justify-start gap-1.5" class="d-description flex flex-wrap items-center justify-start gap-1.5"
> >
<el-button class="tagMargin" plain size="small"> <el-button class="mr-1" plain size="small">
{{ $t('app.version') }}{{ installed.version }} {{ $t('app.version') }}{{ installed.version }}
</el-button> </el-button>
<el-button <el-button
v-if="installed.httpPort > 0" v-if="installed.httpPort > 0"
class="tagMargin" class="mr-1"
plain plain
size="small" size="small"
> >
{{ $t('app.busPort') }}{{ installed.httpPort }} {{ $t('app.busPort') }}{{ installed.httpPort }}
</el-button> </el-button>
<el-button v-if="installed.httpsPort > 0" plain size="small">
<el-button
v-if="installed.httpsPort > 0"
class="tagMargin"
plain
size="small"
>
{{ $t('app.busPort') }}{{ installed.httpsPort }} {{ $t('app.busPort') }}{{ installed.httpsPort }}
</el-button> </el-button>

View file

@ -14,7 +14,7 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.type')" prop="type" min-width="60px"> <el-table-column :label="$t('commons.table.type')" prop="type" min-width="60px">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="row.type != 404">{{ $t('website.' + row.type) }}</span> <span v-if="row.type && row.type != 404">{{ $t('website.' + row.type) }}</span>
<span v-else>{{ 404 }}</span> <span v-else>{{ 404 }}</span>
</template> </template>
</el-table-column> </el-table-column>