Skip to content

Commit

Permalink
Allow loopd autogenerated TLS cert validity override with a new loopd…
Browse files Browse the repository at this point in the history
… flag

Co-authored-by: George Tsagkarelis <34623190+GeorgeTsagk@users.noreply.github.com>
  • Loading branch information
gcaracuel and GeorgeTsagk committed Jul 27, 2023
1 parent e9f5861 commit 9ac8db6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions loopd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ type Config struct {
TLSExtraDomains []string `long:"tlsextradomain" description:"Adds an extra domain to the generated certificate."`
TLSAutoRefresh bool `long:"tlsautorefresh" description:"Re-generate TLS certificate and key if the IPs or domains are changed."`
TLSDisableAutofill bool `long:"tlsdisableautofill" description:"Do not include the interface IPs or the system hostname in TLS certificate, use first --tlsextradomain as Common Name instead, if set."`
TLSValidity int `long:"tlsvalidity" description:"Loop's TLS certificate validity period in days. Defaults to 430 (roughly 14 months)"`
TLSValidity int `long:"tlsvalidity" description:"Loop's TLS certificate validity period in days. Defaults to 420 (roughly 14 months)"`

MacaroonPath string `long:"macaroonpath" description:"Path to write the macaroon for loop's RPC and REST services if it doesn't exist."`

Expand Down Expand Up @@ -417,13 +417,13 @@ func loadCertWithCreate(cfg *Config) (tls.Certificate, *x509.Certificate,
if !lnrpc.FileExists(cfg.TLSCertPath) &&
!lnrpc.FileExists(cfg.TLSKeyPath) {

validityPeriod := time.Duration(cfg.TLSValidity) * 24 * time.Hour
validity := time.Duration(cfg.TLSValidity) * 24 * time.Hour

log.Infof("Generating TLS certificates...")
certBytes, keyBytes, err := cert.GenCertPair(
defaultSelfSignedOrganization, cfg.TLSExtraIPs,
cfg.TLSExtraDomains, cfg.TLSDisableAutofill,
validityPeriod,
validity,
)
if err != nil {
return tls.Certificate{}, nil, err
Expand Down

0 comments on commit 9ac8db6

Please sign in to comment.