From 237ed4fc6ec3f34a67a65e1e79cb43302b0cb634 Mon Sep 17 00:00:00 2001 From: Jonathan Underwood Date: Wed, 21 Mar 2018 07:57:14 +0900 Subject: [PATCH] lnd+config: add TLSExtraDomain to config Self explanatory. Needed for NodeJS, as the grpc library only allows TLS connections to domains and not IP addresses. --- config.go | 21 +++++++++++---------- lnd.go | 3 +++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/config.go b/config.go index afe0f1b4..b52bdd11 100644 --- a/config.go +++ b/config.go @@ -140,16 +140,17 @@ type torConfig struct { type config struct { ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` - LndDir string `long:"lnddir" description:"The base directory that contains lnd's data, logs, configuration file, etc."` - ConfigFile string `long:"C" long:"configfile" description:"Path to configuration file"` - DataDir string `short:"b" long:"datadir" description:"The directory to store lnd's data within"` - TLSCertPath string `long:"tlscertpath" description:"Path to write the TLS certificate for lnd's RPC and REST services"` - TLSKeyPath string `long:"tlskeypath" description:"Path to write the TLS private key for lnd's RPC and REST services"` - TLSExtraIP string `long:"tlsextraip" description:"Adds an extra ip to the generated certificate"` - NoMacaroons bool `long:"no-macaroons" description:"Disable macaroon authentication"` - AdminMacPath string `long:"adminmacaroonpath" description:"Path to write the admin macaroon for lnd's RPC and REST services if it doesn't exist"` - ReadMacPath string `long:"readonlymacaroonpath" description:"Path to write the read-only macaroon for lnd's RPC and REST services if it doesn't exist"` - LogDir string `long:"logdir" description:"Directory to log output."` + LndDir string `long:"lnddir" description:"The base directory that contains lnd's data, logs, configuration file, etc."` + ConfigFile string `long:"C" long:"configfile" description:"Path to configuration file"` + DataDir string `short:"b" long:"datadir" description:"The directory to store lnd's data within"` + TLSCertPath string `long:"tlscertpath" description:"Path to write the TLS certificate for lnd's RPC and REST services"` + TLSKeyPath string `long:"tlskeypath" description:"Path to write the TLS private key for lnd's RPC and REST services"` + TLSExtraIP string `long:"tlsextraip" description:"Adds an extra ip to the generated certificate"` + TLSExtraDomain string `long:"tlsextradomain" description:"Adds an extra domain to the generated certificate"` + NoMacaroons bool `long:"no-macaroons" description:"Disable macaroon authentication"` + AdminMacPath string `long:"adminmacaroonpath" description:"Path to write the admin macaroon for lnd's RPC and REST services if it doesn't exist"` + ReadMacPath string `long:"readonlymacaroonpath" description:"Path to write the read-only macaroon for lnd's RPC and REST services if it doesn't exist"` + LogDir string `long:"logdir" description:"Directory to log output."` RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections"` RESTListeners []string `long:"restlisten" description:"Add an interface/port to listen for REST connections"` diff --git a/lnd.go b/lnd.go index 9e498275..c73225f3 100644 --- a/lnd.go +++ b/lnd.go @@ -683,6 +683,9 @@ func genCertPair(certFile, keyFile string) error { if host != "localhost" { dnsNames = append(dnsNames, "localhost") } + if cfg.TLSExtraDomain != "" { + dnsNames = append(dnsNames, cfg.TLSExtraDomain) + } // Generate a private key for the certificate. priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)