Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:证书 DNS 账号增加腾讯云类型 #3673

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions backend/utils/ssl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/go-acme/lego/v4/providers/dns/namecheap"
"github.com/go-acme/lego/v4/providers/dns/namedotcom"
"github.com/go-acme/lego/v4/providers/dns/namesilo"
"github.com/go-acme/lego/v4/providers/dns/tencentcloud"
"github.com/go-acme/lego/v4/providers/http/webroot"
"github.com/go-acme/lego/v4/registration"
"github.com/pkg/errors"
Expand Down Expand Up @@ -60,13 +61,14 @@ func NewAcmeClient(acmeAccount *model.WebsiteAcmeAccount) (*AcmeClient, error) {
type DnsType string

const (
DnsPod DnsType = "DnsPod"
AliYun DnsType = "AliYun"
CloudFlare DnsType = "CloudFlare"
NameSilo DnsType = "NameSilo"
NameCheap DnsType = "NameCheap"
NameCom DnsType = "NameCom"
Godaddy DnsType = "Godaddy"
DnsPod DnsType = "DnsPod"
AliYun DnsType = "AliYun"
CloudFlare DnsType = "CloudFlare"
NameSilo DnsType = "NameSilo"
NameCheap DnsType = "NameCheap"
NameCom DnsType = "NameCom"
Godaddy DnsType = "Godaddy"
TencentCloud DnsType = "TencentCloud"
)

type DNSParam struct {
Expand All @@ -78,6 +80,7 @@ type DNSParam struct {
APIkey string `json:"apiKey"`
APIUser string `json:"apiUser"`
APISecret string `json:"apiSecret"`
SecretID string `json:"secretID"`
}

func (c *AcmeClient) UseDns(dnsType DnsType, params string, skipDNSCheck bool) error {
Expand Down Expand Up @@ -146,6 +149,14 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, skipDNSCheck bool) e
nameComConfig.PollingInterval = 30 * time.Second
nameComConfig.TTL = 3600
p, err = namedotcom.NewDNSProviderConfig(nameComConfig)
case TencentCloud:
tencentCloudConfig := tencentcloud.NewDefaultConfig()
tencentCloudConfig.SecretID = param.SecretID
tencentCloudConfig.SecretKey = param.SecretKey
tencentCloudConfig.PropagationTimeout = 30 * time.Minute
tencentCloudConfig.PollingInterval = 30 * time.Second
tencentCloudConfig.TTL = 3600
p, err = tencentcloud.NewDNSProviderConfig(tencentCloudConfig)
}
if err != nil {
return err
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/global/mimetype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ export const DNSTypes = [
value: 'AliYun',
},
{
label: 'DNSPod',
label: i18n.global.t('website.tencentCloud'),
value: 'TencentCloud',
},
{
label: 'DNSPod (' + i18n.global.t('ssl.deprecated') + ')',
value: 'DnsPod',
},
{
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,7 @@ const message = {
primaryDomainHelper: 'Support domain name: port',
acmeAccountType: 'Account Type',
keyType: 'Key algorithm',
tencentCloud: 'Tencent Cloud',
},
php: {
short_open_tag: 'Short tag support',
Expand Down Expand Up @@ -1938,6 +1939,9 @@ const message = {
skipDNSCheck: 'Skip DNS check',
skipDNSCheckHelper: 'If there is an application timeout problem, please check here, otherwise do not check it',
cfHelper: 'Do not use Global API Key',
deprecated: 'will be deprecated',
deprecatedHelper:
'Maintenance has been stopped and may be abandoned in a future version. Please use Tencent Cloud method for analysis',
},
firewall: {
create: 'Create rule',
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,7 @@ const message = {
primaryDomainHelper: '支援網域:port',
acmeAccountType: '賬號類型',
keyType: '密鑰演算法',
tencentCloud: '騰訊雲',
},
php: {
short_open_tag: '短標簽支持',
Expand Down Expand Up @@ -1819,6 +1820,8 @@ const message = {
skipDNSCheck: '跳過 DNS 校驗',
skipDNSCheckHelper: '如果出現申請超時問題,請勾選此處,其他情況請勿勾選',
cfHelper: '請勿使用 Global API Key',
deprecated: '即將廢棄',
deprecatedHelper: '已經停止維護,可能會在以後的某個版本廢棄,請使用騰訊雲方式解析',
},
firewall: {
create: '創建規則',
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,7 @@ const message = {
primaryDomainHelper: '支持域名:端口',
acmeAccountType: '账号类型',
keyType: '密钥算法',
tencentCloud: '腾讯云',
},
php: {
short_open_tag: '短标签支持',
Expand Down Expand Up @@ -1819,6 +1820,8 @@ const message = {
skipDNSCheck: '跳过 DNS 校验',
skipDNSCheckHelper: '如果出现申请超时问题,请勾选此处,其他情况请勿勾选',
cfHelper: '请勿使用 Global API Key',
deprecated: '即将废弃',
deprecatedHelper: '已经停止维护,可能会在以后的某个版本废弃,请使用腾讯云方式解析',
},
firewall: {
create: '创建规则',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/website/ssl/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
v-if="ssl.dnsAccount && ssl.dnsAccount.id > 0"
>
{{ ssl.dnsAccount.name }}
<el-tag type="info">{{ ssl.dnsAccount.type }}</el-tag>
<el-tag type="info">{{ getDNSName(ssl.dnsAccount.type) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item
:label="$t('ssl.acmeAccount')"
Expand Down Expand Up @@ -76,7 +76,7 @@
import DrawerHeader from '@/components/drawer-header/index.vue';
import { GetSSL } from '@/api/modules/website';
import { ref } from 'vue';
import { dateFormatSimple, getProvider } from '@/utils/util';
import { dateFormatSimple, getProvider, getDNSName } from '@/utils/util';

const open = ref(false);
const id = ref(0);
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/views/website/ssl/dns-account/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
:value="type.value"
></el-option>
</el-select>
<span class="input-help text-red-500" v-if="account.type === 'DnsPod'">
{{ $t('ssl.deprecatedHelper') }}
</span>
</el-form-item>
<div v-if="account.type === 'AliYun'">
<el-form-item label="Access Key" prop="authorization.accessKey">
Expand All @@ -31,6 +34,14 @@
<el-input v-model.trim="account.authorization['secretKey']"></el-input>
</el-form-item>
</div>
<div v-if="account.type === 'TencentCloud'">
<el-form-item label="Secret ID" prop="authorization.secretID">
<el-input v-model.trim="account.authorization['secretID']"></el-input>
</el-form-item>
<el-form-item label="Secret Key" prop="authorization.secretKey">
<el-input v-model.trim="account.authorization['secretKey']"></el-input>
</el-form-item>
</div>
<div v-if="account.type === 'DnsPod'">
<el-form-item label="ID" prop="authorization.id">
<el-input v-model.trim="account.authorization['id']"></el-input>
Expand Down Expand Up @@ -119,6 +130,7 @@ const rules = ref<any>({
email: [Rules.requiredInput],
apiKey: [Rules.requiredInput],
apiUser: [Rules.requiredInput],
secretID: [Rules.requiredInput],
},
});
const account = ref({
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.490 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.490 // indirect
github.com/therootcompany/xz v1.0.1 // indirect
github.com/theupdateframework/notary v0.7.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
Expand Down
Loading
Loading