mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-11 20:20:48 +08:00
feat(ssl): add vercel dns provider (#8485)
This commit is contained in:
parent
4aa628121c
commit
f4038e879e
4 changed files with 34 additions and 17 deletions
|
|
@ -243,9 +243,8 @@ func createHTTPClientWithProxy(proxyURL, username, password string) *http.Client
|
||||||
TLSHandshakeTimeout: 60 * time.Second,
|
TLSHandshakeTimeout: 60 * time.Second,
|
||||||
ResponseHeaderTimeout: 60 * time.Second,
|
ResponseHeaderTimeout: 60 * time.Second,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
ServerName: os.Getenv("LEGO_CA_SERVER_NAME"),
|
||||||
//ServerName: os.Getenv("LEGO_CA_SERVER_NAME"),
|
RootCAs: initCertPool(),
|
||||||
//RootCAs: initCertPool(),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,19 @@ import (
|
||||||
"crypto"
|
"crypto"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
|
"github.com/go-acme/lego/v4/providers/dns/alidns"
|
||||||
"github.com/go-acme/lego/v4/providers/dns/clouddns"
|
"github.com/go-acme/lego/v4/providers/dns/clouddns"
|
||||||
|
"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/dns/freemyip"
|
"github.com/go-acme/lego/v4/providers/dns/freemyip"
|
||||||
|
"github.com/go-acme/lego/v4/providers/dns/godaddy"
|
||||||
"github.com/go-acme/lego/v4/providers/dns/huaweicloud"
|
"github.com/go-acme/lego/v4/providers/dns/huaweicloud"
|
||||||
|
"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/rainyun"
|
"github.com/go-acme/lego/v4/providers/dns/rainyun"
|
||||||
|
"github.com/go-acme/lego/v4/providers/dns/tencentcloud"
|
||||||
|
"github.com/go-acme/lego/v4/providers/dns/vercel"
|
||||||
"github.com/go-acme/lego/v4/providers/dns/volcengine"
|
"github.com/go-acme/lego/v4/providers/dns/volcengine"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -20,14 +29,6 @@ import (
|
||||||
"github.com/go-acme/lego/v4/challenge"
|
"github.com/go-acme/lego/v4/challenge"
|
||||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||||
"github.com/go-acme/lego/v4/lego"
|
"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/dns/godaddy"
|
|
||||||
"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/providers/http/webroot"
|
||||||
"github.com/go-acme/lego/v4/registration"
|
"github.com/go-acme/lego/v4/registration"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
@ -97,6 +98,7 @@ const (
|
||||||
Volcengine DnsType = "Volcengine"
|
Volcengine DnsType = "Volcengine"
|
||||||
HuaweiCloud DnsType = "HuaweiCloud"
|
HuaweiCloud DnsType = "HuaweiCloud"
|
||||||
FreeMyIP DnsType = "FreeMyIP"
|
FreeMyIP DnsType = "FreeMyIP"
|
||||||
|
Vercel DnsType = "Vercel"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DNSParam struct {
|
type DNSParam struct {
|
||||||
|
|
@ -121,17 +123,15 @@ var (
|
||||||
dnsTimeOut = 30 * time.Minute
|
dnsTimeOut = 30 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.WebsiteSSL) error {
|
func getDNSProviderConfig(dnsType DnsType, params string) (challenge.Provider, error) {
|
||||||
var (
|
var (
|
||||||
param DNSParam
|
param DNSParam
|
||||||
p challenge.Provider
|
p challenge.Provider
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
if err := json.Unmarshal([]byte(params), ¶m); err != nil {
|
||||||
if err = json.Unmarshal([]byte(params), ¶m); err != nil {
|
return nil, err
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch dnsType {
|
switch dnsType {
|
||||||
case DnsPod:
|
case DnsPod:
|
||||||
dnsPodConfig := dnspod.NewDefaultConfig()
|
dnsPodConfig := dnspod.NewDefaultConfig()
|
||||||
|
|
@ -234,7 +234,21 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web
|
||||||
freeMyIpConfig.PropagationTimeout = propagationTimeout
|
freeMyIpConfig.PropagationTimeout = propagationTimeout
|
||||||
freeMyIpConfig.PollingInterval = pollingInterval
|
freeMyIpConfig.PollingInterval = pollingInterval
|
||||||
p, err = freemyip.NewDNSProviderConfig(freeMyIpConfig)
|
p, err = freemyip.NewDNSProviderConfig(freeMyIpConfig)
|
||||||
|
case Vercel:
|
||||||
|
vercelConfig := vercel.NewDefaultConfig()
|
||||||
|
vercelConfig.AuthToken = param.Token
|
||||||
|
vercelConfig.PropagationTimeout = propagationTimeout
|
||||||
|
vercelConfig.PollingInterval = pollingInterval
|
||||||
|
p, err = vercel.NewDNSProviderConfig(vercelConfig)
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.WebsiteSSL) error {
|
||||||
|
p, err := getDNSProviderConfig(dnsType, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,10 @@ export const DNSTypes = [
|
||||||
label: 'Cloudflare',
|
label: 'Cloudflare',
|
||||||
value: 'CloudFlare',
|
value: 'CloudFlare',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Vercel',
|
||||||
|
value: 'Vercel',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'CloudDNS',
|
label: 'CloudDNS',
|
||||||
value: 'CloudDns',
|
value: 'CloudDns',
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
<el-input v-model.trim="account.authorization['token']"></el-input>
|
<el-input v-model.trim="account.authorization['token']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="account.type === 'FreeMyIP'">
|
<div v-if="account.type === 'FreeMyIP' || account.type === 'Vercel'">
|
||||||
<el-form-item label="Token" prop="authorization.token">
|
<el-form-item label="Token" prop="authorization.token">
|
||||||
<el-input v-model.trim="account.authorization['token']"></el-input>
|
<el-input v-model.trim="account.authorization['token']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue