From 0df48451f4fb723a20fd2c38397364e284161d4b Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Tue, 17 Oct 2023 17:21:37 -0400 Subject: [PATCH] Remove some no longer used ent init hooks. (#23704) --- helper/builtinplugins/registry.go | 3 - http/util.go | 17 +----- vault/core.go | 96 ------------------------------- vault/init.go | 2 - vault/request_handling.go | 7 --- 5 files changed, 1 insertion(+), 124 deletions(-) diff --git a/helper/builtinplugins/registry.go b/helper/builtinplugins/registry.go index 462b858824..978321c8ad 100644 --- a/helper/builtinplugins/registry.go +++ b/helper/builtinplugins/registry.go @@ -64,9 +64,6 @@ import ( // Thus, rather than creating multiple instances of it, we only need one. var Registry = newRegistry() -// TODO remove once entAddExtPlugins is implemented in ENT -var addExternalPlugins = addExtPluginsImpl - // BuiltinFactory is the func signature that should be returned by // the plugin's New() func. type BuiltinFactory func() (interface{}, error) diff --git a/http/util.go b/http/util.go index 2b0d7cc0d2..dc824c1269 100644 --- a/http/util.go +++ b/http/util.go @@ -20,22 +20,7 @@ import ( "github.com/hashicorp/vault/vault/quotas" ) -var ( - // TODO remove once entWrapGenericHandler is implemented in ENT - genericWrapping = func(core *vault.Core, in http.Handler, props *vault.HandlerProperties) http.Handler { - // Wrap the help wrapped handler with another layer with a generic - // handler - return wrapGenericHandler(core, in, props) - } - - // TODO remove once entAdditionalRoutes is implemented in ENT - additionalRoutes = func(mux *http.ServeMux, core *vault.Core) {} - - nonVotersAllowed = false - - // TODO remove once entAdjustResponse is implemented in ENT - adjustResponse = func(core *vault.Core, w http.ResponseWriter, req *logical.Request) {} -) +var nonVotersAllowed = false func rateLimitQuotaWrapping(handler http.Handler, core *vault.Core) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/vault/core.go b/vault/core.go index b91a80bcb7..5a47c58948 100644 --- a/vault/core.go +++ b/vault/core.go @@ -162,48 +162,6 @@ var ( // step down of the active node, to prevent instantly regrabbing the lock. // It's var not const so that tests can manipulate it. manualStepDownSleepPeriod = 10 * time.Second - - // Functions only in the Enterprise version - // TODO remove once entPostUnseal is implemented in ENT - enterprisePostUnseal = enterprisePostUnsealImpl - // TODO remove once entPreSeal is implemented in ENT - enterprisePreSeal = enterprisePreSealImpl - // TODO remove once entSetupFilteredPaths is implemented in ENT - enterpriseSetupFilteredPaths = enterpriseSetupFilteredPathsImpl - // TODO remove once entSetupQuotas is implemented in ENT - enterpriseSetupQuotas = enterpriseSetupQuotasImpl - // TODO remove once entSetupAPILock is implemented in ENT - enterpriseSetupAPILock = setupAPILockImpl - // TODO remove once entStartReplication is implemented in ENT - startReplication = startReplicationImpl - // TODO remove once entStopReplication is implemented in ENT - stopReplication = stopReplicationImpl - // TODO remove once EntLastWAL is implemented in ENT - LastWAL = lastWALImpl - // TODO remove once EntLastPerformanceWAL is implemented in ENT - LastPerformanceWAL = lastPerformanceWALImpl - // TODO remove once EntLastDRWAL is implemented in ENT - LastDRWAL = lastDRWALImpl - // TODO remove once EntPerformanceMerkleRoot is implemented in ENT - PerformanceMerkleRoot = merkleRootImpl - // TODO remove once EntDRMerkleRoot is implemented in ENT - DRMerkleRoot = merkleRootImpl - // TODO remove once EntLastRemoteWAL is implemented in ENT - LastRemoteWAL = lastRemoteWALImpl - // TODO remove once entLastRemoteUpstreamWAL is implemented in ENT - LastRemoteUpstreamWAL = lastRemoteUpstreamWALImpl - // TODO remove once EntWaitUntilWALShipped is implemented in ENT - WaitUntilWALShipped = waitUntilWALShippedImpl - // TODO remove once entCheckStoredLicense is implemented in ENT - storedLicenseCheck = func(c *Core, conf *CoreConfig) error { return nil } - // TODO remove once entIsLicenseAutoloaded is implemented in ENT - LicenseAutoloaded = func(*Core) bool { return false } - // TODO remove once entCheckLicenseInit is implemented in ENT - LicenseInitCheck = func(*Core) error { return nil } - // TODO remove once EntGetLicenseState is implemented in ENT - LicenseSummary = func(*Core) (*LicenseState, error) { return nil, nil } - // TODO remove once EntReloadLicense is implemented in ENT - LicenseReload = func(*Core) error { return nil } ) // NonFatalError is an error that can be returned during NewCore that should be @@ -2758,32 +2716,6 @@ func (c *Core) preSeal() error { return result } -func enterprisePostUnsealImpl(c *Core, isStandby bool) error { - return nil -} - -func enterprisePreSealImpl(c *Core) error { - return nil -} - -func enterpriseSetupFilteredPathsImpl(c *Core) error { - return nil -} - -func enterpriseSetupQuotasImpl(ctx context.Context, c *Core) error { - return nil -} - -func startReplicationImpl(c *Core) error { - return nil -} - -func stopReplicationImpl(c *Core) error { - return nil -} - -func setupAPILockImpl(_ *Core, _ context.Context) error { return nil } - func (c *Core) ReplicationState() consts.ReplicationState { return consts.ReplicationState(atomic.LoadUint32(c.replicationState)) } @@ -2815,34 +2747,6 @@ func (c *Core) AuditedHeadersConfig() *AuditedHeadersConfig { return c.auditedHeaders } -func waitUntilWALShippedImpl(ctx context.Context, c *Core, index uint64) bool { - return true -} - -func merkleRootImpl(c *Core) string { - return "" -} - -func lastWALImpl(c *Core) uint64 { - return 0 -} - -func lastPerformanceWALImpl(c *Core) uint64 { - return 0 -} - -func lastDRWALImpl(c *Core) uint64 { - return 0 -} - -func lastRemoteWALImpl(c *Core) uint64 { - return 0 -} - -func lastRemoteUpstreamWALImpl(c *Core) uint64 { - return 0 -} - // physicalBarrierSealConfig reads the storage entry at configPath and parses and validates it as SealConfig. func physicalSealConfig(ctx context.Context, c *Core, label, configPath string) (*SealConfig, error) { pe, err := c.physical.Get(ctx, configPath) diff --git a/vault/init.go b/vault/init.go index c7e49850c2..01c7ba8728 100644 --- a/vault/init.go +++ b/vault/init.go @@ -40,8 +40,6 @@ type InitResult struct { } var ( - // TODO remove once entInitWALPassThrough is implemented in ENT - initPTFunc = func(c *Core) func() { return nil } initInProgress uint32 ErrInitWithoutAutoloading = errors.New("cannot initialize storage without an autoloaded license") ) diff --git a/vault/request_handling.go b/vault/request_handling.go index 4a95ccb48d..a3938ba6b7 100644 --- a/vault/request_handling.go +++ b/vault/request_handling.go @@ -55,11 +55,6 @@ var ( ErrNoApplicablePolicies = errors.New("no applicable policies") egpDebugLogging bool - - // if this returns an error, the request should be blocked and the error - // should be returned to the client - // TODO remove once entBlockRequestIfError is implemented in ENT - enterpriseBlockRequestIfError = blockRequestIfErrorImpl ) // HandlerProperties is used to seed configuration into a vaulthttp.Handler. @@ -2202,8 +2197,6 @@ func (c *Core) buildMfaEnforcementResponse(eConfig *mfa.MFAEnforcementConfig) (* return mfaAny, nil } -func blockRequestIfErrorImpl(_ *Core, _, _ string) error { return nil } - // RegisterAuth uses a logical.Auth object to create a token entry in the token // store, and registers a corresponding token lease to the expiration manager. // role is the login role used as part of the creation of the token entry. If not