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
}
case constant.DnsManual:
if err := client.UseManualDns(); err != nil {
if err := client.UseManualDns(*websiteSSL); err != nil {
return err
}
}

View file

@ -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

View file

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

View file

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

View file

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

View file

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

View file

@ -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',

View file

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

View file

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

View file

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

View file

@ -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;

View file

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

View file

@ -233,25 +233,18 @@
<div
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 }}
</el-button>
<el-button
v-if="installed.httpPort > 0"
class="tagMargin"
class="mr-1"
plain
size="small"
>
{{ $t('app.busPort') }}{{ installed.httpPort }}
</el-button>
<el-button
v-if="installed.httpsPort > 0"
class="tagMargin"
plain
size="small"
>
<el-button v-if="installed.httpsPort > 0" plain size="small">
{{ $t('app.busPort') }}{{ installed.httpsPort }}
</el-button>

View file

@ -14,7 +14,7 @@
</el-table-column>
<el-table-column :label="$t('commons.table.type')" prop="type" min-width="60px">
<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>
</template>
</el-table-column>