2021-10-04 21:01:51 +00:00
|
|
|
//go:build !consulent
|
2019-05-01 15:11:27 +00:00
|
|
|
// +build !consulent
|
2018-05-24 14:36:42 +00:00
|
|
|
|
|
|
|
package consul
|
|
|
|
|
|
|
|
import (
|
2021-05-20 14:07:23 +00:00
|
|
|
"context"
|
2020-06-26 21:59:15 +00:00
|
|
|
"errors"
|
2018-05-24 14:36:42 +00:00
|
|
|
"net"
|
2020-06-26 21:59:15 +00:00
|
|
|
"strings"
|
2018-05-24 14:36:42 +00:00
|
|
|
|
2019-07-26 19:57:57 +00:00
|
|
|
"github.com/hashicorp/go-version"
|
2018-05-24 14:36:42 +00:00
|
|
|
"github.com/hashicorp/serf/serf"
|
2021-05-19 19:07:24 +00:00
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2021-05-19 19:07:24 +00:00
|
|
|
"github.com/hashicorp/consul/agent/pool"
|
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
2018-05-24 14:36:42 +00:00
|
|
|
)
|
|
|
|
|
2019-07-26 19:57:57 +00:00
|
|
|
var (
|
|
|
|
// minMultiDCConnectVersion is the minimum version in order to support multi-DC Connect
|
|
|
|
// features.
|
|
|
|
minMultiDCConnectVersion = version.Must(version.NewVersion("1.6.0"))
|
|
|
|
)
|
|
|
|
|
2018-05-24 14:36:42 +00:00
|
|
|
type EnterpriseServer struct{}
|
|
|
|
|
2021-05-11 14:50:03 +00:00
|
|
|
func (s *Server) initEnterprise(_ Deps) error {
|
2018-05-24 14:36:42 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) startEnterprise() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) handleEnterpriseUserEvents(event serf.UserEvent) bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) handleEnterpriseRPCConn(rtype pool.RPCType, conn net.Conn, isTLS bool) bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2020-03-09 20:59:02 +00:00
|
|
|
func (s *Server) handleEnterpriseNativeTLSConn(alpnProto string, conn net.Conn) bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-09-11 09:01:37 +00:00
|
|
|
func (s *Server) handleEnterpriseLeave() {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-05-20 14:07:23 +00:00
|
|
|
func (s *Server) establishEnterpriseLeadership(_ context.Context) error {
|
2019-09-24 00:09:56 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) revokeEnterpriseLeadership() error {
|
|
|
|
return nil
|
|
|
|
}
|
2019-10-30 16:42:39 +00:00
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
func (s *Server) validateEnterpriseRequest(entMeta *acl.EnterpriseMeta, write bool) error {
|
2019-10-30 16:42:39 +00:00
|
|
|
return nil
|
|
|
|
}
|
2020-01-29 18:21:38 +00:00
|
|
|
|
2021-09-08 15:59:30 +00:00
|
|
|
func (s *Server) validateEnterpriseIntentionPartition(partition string) error {
|
|
|
|
if partition == "" {
|
|
|
|
return nil
|
|
|
|
} else if strings.ToLower(partition) == "default" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// No special handling for wildcard partitions as they are pointless in OSS.
|
|
|
|
|
|
|
|
return errors.New("Partitions is a Consul Enterprise feature")
|
|
|
|
}
|
|
|
|
|
2020-06-26 21:59:15 +00:00
|
|
|
func (s *Server) validateEnterpriseIntentionNamespace(ns string, _ bool) error {
|
|
|
|
if ns == "" {
|
|
|
|
return nil
|
|
|
|
} else if strings.ToLower(ns) == structs.IntentionDefaultNamespace {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// No special handling for wildcard namespaces as they are pointless in OSS.
|
|
|
|
|
|
|
|
return errors.New("Namespaces is a Consul Enterprise feature")
|
|
|
|
}
|
|
|
|
|
2021-11-15 15:51:14 +00:00
|
|
|
// setupSerfLAN is used to setup and initialize a Serf for the LAN
|
|
|
|
func (s *Server) setupSerfLAN(config *Config) error {
|
|
|
|
var err error
|
|
|
|
// Initialize the LAN Serf for the default network segment.
|
2021-12-06 19:18:02 +00:00
|
|
|
s.serfLAN, _, err = s.setupSerf(setupSerfOptions{
|
2021-11-15 15:51:14 +00:00
|
|
|
Config: config.SerfLANConfig,
|
|
|
|
EventCh: s.eventChLAN,
|
|
|
|
SnapshotPath: serfLANSnapshot,
|
|
|
|
Listener: s.Listener,
|
|
|
|
WAN: false,
|
|
|
|
Segment: "",
|
|
|
|
Partition: "",
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) shutdownSerfLAN() {
|
|
|
|
if s.serfLAN != nil {
|
|
|
|
s.serfLAN.Shutdown()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
func addEnterpriseSerfTags(_ map[string]string, _ *acl.EnterpriseMeta) {
|
2020-01-29 18:21:38 +00:00
|
|
|
// do nothing
|
|
|
|
}
|