Skip to content

Commit 2b08b83

Browse files
authored
feat: skip the TLS verification of the ACME server (#2335)
1 parent 4efd1e1 commit 2b08b83

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

cmd/flags.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const (
3838
flgDNSPropagationRNS = "dns.propagation-rns"
3939
flgDNSResolvers = "dns.resolvers"
4040
flgHTTPTimeout = "http-timeout"
41+
flgTLSSkipVerify = "tls-skip-verify"
4142
flgDNSTimeout = "dns-timeout"
4243
flgPEM = "pem"
4344
flgPFX = "pfx"
@@ -175,6 +176,10 @@ func CreateFlags(defaultPath string) []cli.Flag {
175176
Name: flgHTTPTimeout,
176177
Usage: "Set the HTTP timeout value to a specific value in seconds.",
177178
},
179+
&cli.BoolFlag{
180+
Name: flgTLSSkipVerify,
181+
Usage: "Skip the TLS verification of the ACME server.",
182+
},
178183
&cli.IntFlag{
179184
Name: flgDNSTimeout,
180185
Usage: "Set the DNS timeout value to a specific value in seconds. Used only when performing authoritative name server queries.",

cmd/setup.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package cmd
22

33
import (
4+
"crypto/tls"
45
"crypto/x509"
56
"encoding/pem"
67
"fmt"
8+
"net/http"
79
"os"
810
"strings"
911
"time"
@@ -48,6 +50,12 @@ func newClient(ctx *cli.Context, acc registration.User, keyType certcrypto.KeyTy
4850
config.HTTPClient.Timeout = time.Duration(ctx.Int(flgHTTPTimeout)) * time.Second
4951
}
5052

53+
if ctx.Bool(flgTLSSkipVerify) {
54+
config.HTTPClient.Transport = &http.Transport{
55+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
56+
}
57+
}
58+
5159
client, err := lego.NewClient(config)
5260
if err != nil {
5361
log.Fatalf("Could not create client: %v", err)

docs/data/zz_cli_help.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ GLOBAL OPTIONS:
4545
--dns.propagation-wait value By setting this flag, disables all the propagation checks of the TXT record and uses a wait duration instead. (default: 0s)
4646
--dns.resolvers value [ --dns.resolvers value ] Set the resolvers to use for performing (recursive) CNAME resolving and apex domain determination. For DNS-01 challenge verification, the authoritative DNS server is queried directly. Supported: host:port. The default is to use the system resolvers, or Google's DNS resolvers if the system's cannot be determined.
4747
--http-timeout value Set the HTTP timeout value to a specific value in seconds. (default: 0)
48+
--tls-skip-verify Skip the TLS verification of the ACME server. (default: false)
4849
--dns-timeout value Set the DNS timeout value to a specific value in seconds. Used only when performing authoritative name server queries. (default: 10)
4950
--pem Generate an additional .pem (base64) file by concatenating the .key and .crt files together. (default: false)
5051
--pfx Generate an additional .pfx (PKCS#12) file by concatenating the .key and .crt and issuer .crt files together. (default: false) [$LEGO_PFX]

0 commit comments

Comments
 (0)