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.
This commit is contained in:
Jonathan Underwood 2018-03-21 07:57:14 +09:00 committed by Olaoluwa Osuntokun
parent 6d07b865d6
commit 237ed4fc6e
2 changed files with 14 additions and 10 deletions

@ -146,6 +146,7 @@ type config struct {
TLSCertPath string `long:"tlscertpath" description:"Path to write the TLS certificate for lnd's RPC and REST services"` 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"` 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"` 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"` 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"` 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"` ReadMacPath string `long:"readonlymacaroonpath" description:"Path to write the read-only macaroon for lnd's RPC and REST services if it doesn't exist"`

3
lnd.go

@ -683,6 +683,9 @@ func genCertPair(certFile, keyFile string) error {
if host != "localhost" { if host != "localhost" {
dnsNames = append(dnsNames, "localhost") dnsNames = append(dnsNames, "localhost")
} }
if cfg.TLSExtraDomain != "" {
dnsNames = append(dnsNames, cfg.TLSExtraDomain)
}
// Generate a private key for the certificate. // Generate a private key for the certificate.
priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)