mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-18 19:41:21 +02:00
cert: allow cert expiry to be set in config
This commit is contained in:
committed by
GitHub
parent
1ccf6ed7d4
commit
786568fa46
@@ -16,13 +16,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultAutogenValidity is the default validity of a self-signed
|
||||
// certificate. The value corresponds to 14 months
|
||||
// (14 months * 30 days * 24 hours).
|
||||
DefaultAutogenValidity = 14 * 30 * 24 * time.Hour
|
||||
)
|
||||
|
||||
var (
|
||||
// End of ASN.1 time.
|
||||
endOfTime = time.Date(2049, 12, 31, 23, 59, 59, 0, time.UTC)
|
||||
|
@@ -3,11 +3,16 @@ package cert_test
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/lightningnetwork/lnd/cert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
testTLSCertDuration = 42 * time.Hour
|
||||
)
|
||||
|
||||
var (
|
||||
extraIPs = []string{"1.1.1.1", "123.123.123.1", "199.189.12.12"}
|
||||
extraDomains = []string{"home", "and", "away"}
|
||||
@@ -27,7 +32,7 @@ func TestIsOutdatedCert(t *testing.T) {
|
||||
// Generate TLS files with two extra IPs and domains.
|
||||
err = cert.GenCertPair(
|
||||
"lnd autogenerated cert", certPath, keyPath, extraIPs[:2],
|
||||
extraDomains[:2], false, cert.DefaultAutogenValidity,
|
||||
extraDomains[:2], false, testTLSCertDuration,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -82,7 +87,7 @@ func TestIsOutdatedPermutation(t *testing.T) {
|
||||
// Generate TLS files from the IPs and domains.
|
||||
err = cert.GenCertPair(
|
||||
"lnd autogenerated cert", certPath, keyPath, extraIPs[:],
|
||||
extraDomains[:], false, cert.DefaultAutogenValidity,
|
||||
extraDomains[:], false, testTLSCertDuration,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -149,7 +154,7 @@ func TestTLSDisableAutofill(t *testing.T) {
|
||||
// Generate TLS files with two extra IPs and domains and no interface IPs.
|
||||
err = cert.GenCertPair(
|
||||
"lnd autogenerated cert", certPath, keyPath, extraIPs[:2],
|
||||
extraDomains[:2], true, cert.DefaultAutogenValidity,
|
||||
extraDomains[:2], true, testTLSCertDuration,
|
||||
)
|
||||
require.NoError(
|
||||
t, err,
|
||||
|
Reference in New Issue
Block a user