diff --git a/backend/utils/ssl/client.go b/backend/utils/ssl/client.go index 754b47015..ccefdc807 100644 --- a/backend/utils/ssl/client.go +++ b/backend/utils/ssl/client.go @@ -10,6 +10,7 @@ import ( "github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/providers/dns/alidns" + "github.com/go-acme/lego/v4/providers/dns/cloudflare" "github.com/go-acme/lego/v4/providers/dns/dnspod" "github.com/go-acme/lego/v4/providers/http/webroot" "github.com/go-acme/lego/v4/registration" @@ -62,8 +63,9 @@ func NewAcmeClient(email, privateKey string) (*AcmeClient, error) { type DnsType string const ( - DnsPod DnsType = "DnsPod" - AliYun DnsType = "AliYun" + DnsPod DnsType = "DnsPod" + AliYun DnsType = "AliYun" + Cloudflare DnsType = "Cloudflare" ) type DNSParam struct { @@ -101,6 +103,15 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string) error { return err } } + if dnsType == Cloudflare { + cloudflareConfig := cloudflare.NewDefaultConfig() + cloudflareConfig.AuthEmail = param.Email + cloudflareConfig.AuthKey = param.APIkey + p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig) + if err != nil { + return err + } + } return c.Client.Challenge.SetDNS01Provider(p, dns01.AddDNSTimeout(3*time.Minute)) } diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 997c1604f..b2d00b9bd 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -729,7 +729,7 @@ export default { applySSL: '证书申请', SSLList: '证书列表', createDnsAccount: 'DNS账号', - aliyun: '阿里云', + aliyun: '阿里云DNS', manual: '手动解析', key: '密钥', check: '查看', diff --git a/frontend/src/views/website/ssl/dns-account/create/index.vue b/frontend/src/views/website/ssl/dns-account/create/index.vue index cdeb347d5..86176758c 100644 --- a/frontend/src/views/website/ssl/dns-account/create/index.vue +++ b/frontend/src/views/website/ssl/dns-account/create/index.vue @@ -30,6 +30,14 @@ +
+ + + + + + +
- + + +