mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
cmd/lncli: add insecure flag to skip tls auth
Add an `insecure` global flag to lncli. If set, tls authentication with the specified rpc server will be skipped.
This commit is contained in:
@@ -33,6 +33,7 @@ type profileEntry struct {
|
||||
TLSCert string `json:"tlscert"`
|
||||
Macaroons *macaroonJar `json:"macaroons"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
Insecure bool `json:"insecure,omitempty"`
|
||||
}
|
||||
|
||||
// cert returns the profile's TLS certificate as a x509 certificate pool.
|
||||
@@ -122,10 +123,12 @@ func profileFromContext(ctx *cli.Context, store, skipMacaroons bool) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
insecure := ctx.GlobalBool("insecure")
|
||||
|
||||
// Load the certificate file now, if specified. We store it as plain PEM
|
||||
// directly.
|
||||
var tlsCert []byte
|
||||
if tlsCertPath != "" {
|
||||
if tlsCertPath != "" && !insecure {
|
||||
var err error
|
||||
tlsCert, err = ioutil.ReadFile(tlsCertPath)
|
||||
if err != nil {
|
||||
@@ -155,6 +158,7 @@ func profileFromContext(ctx *cli.Context, store, skipMacaroons bool) (
|
||||
NoMacaroons: ctx.GlobalBool("no-macaroons"),
|
||||
TLSCert: string(tlsCert),
|
||||
Metadata: metadata,
|
||||
Insecure: insecure,
|
||||
}
|
||||
|
||||
// If we aren't using macaroons in general (flag --no-macaroons) or
|
||||
|
||||
Reference in New Issue
Block a user