Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ import (
"crypto/x509"
"encoding/json"
"fmt"
"math"
"net/url"
"os"
"strings"
"time"

"github.com/hashicorp/go-hclog"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/channel/v4"
"github.com/openziti/identity"
"github.com/openziti/sdk-golang/xgress"
"github.com/openziti/storage/boltz"
"github.com/openziti/transport/v2"
transporttls "github.com/openziti/transport/v2/tls"
Expand All @@ -36,14 +43,8 @@ import (
"github.com/openziti/ziti/common/pb/mgmt_pb"
"github.com/openziti/ziti/controller/command"
"github.com/openziti/ziti/controller/db"
"github.com/openziti/sdk-golang/xgress"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
"math"
"net/url"
"os"
"strings"
"time"
)

const (
Expand Down Expand Up @@ -198,6 +199,21 @@ func LoadConfig(path string) (*Config, error) {
} else {
controllerConfig.Id = identity.NewIdentity(id)

conflicts := controllerConfig.Id.CheckServerCertSansForConflicts()

if len(conflicts) > 0 {
conflictsStr := ""

for _, conflict := range conflicts {
if conflictsStr != "" {
conflictsStr += ", "
}
conflictsStr += conflict.Error()
}

return nil, fmt.Errorf("conflicting SANs found in root [identity] section server certificate, ensure each server certificate is the sole representation of each DNS/IP SAN: %s", conflictsStr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it only check the root identity section? it'd have to synthesize all of them or does that happen during config-time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other sections are xweb and handled by this PR: openziti/xweb#31

}

if err := controllerConfig.Id.WatchFiles(); err != nil {
pfxlog.Logger().Warn("could not enable file watching on identity: %w", err)
}
Expand Down
Loading