mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-24 12:08:19 +02:00
* config: update logic for checking overlapping certificates * add test * go mod tidy
This commit is contained in:
parent
4a14cab50a
commit
2803f3949c
8 changed files with 213 additions and 135 deletions
|
@ -3,6 +3,7 @@ package config
|
|||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
|
@ -732,13 +733,17 @@ func TestOptions_ApplySettings(t *testing.T) {
|
|||
cert3, err := cryptutil.GenerateCertificate(nil, "not.example.com")
|
||||
require.NoError(t, err)
|
||||
|
||||
certsIndex := cryptutil.NewCertificatesIndex()
|
||||
xc1, _ := x509.ParseCertificate(cert1.Certificate[0])
|
||||
certsIndex.Add(xc1)
|
||||
|
||||
settings := &config.Settings{
|
||||
Certificates: []*config.Settings_Certificate{
|
||||
{CertBytes: encodeCert(cert2)},
|
||||
{CertBytes: encodeCert(cert3)},
|
||||
},
|
||||
}
|
||||
options.ApplySettings(ctx, settings)
|
||||
options.ApplySettings(ctx, certsIndex, settings)
|
||||
assert.Len(t, options.CertificateFiles, 2, "should prevent adding duplicate certificates")
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue