mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
VAULT-32507: CE Changes (#29004)
This commit is contained in:
@@ -99,44 +99,44 @@ func newFullAddonRegistry() *registry {
|
|||||||
"snowflake-database-plugin": {Factory: dbSnowflake.New},
|
"snowflake-database-plugin": {Factory: dbSnowflake.New},
|
||||||
},
|
},
|
||||||
logicalBackends: map[string]logicalBackend{
|
logicalBackends: map[string]logicalBackend{
|
||||||
"ad": {
|
pluginconsts.SecretEngineAD: {
|
||||||
Factory: logicalAd.Factory,
|
Factory: logicalAd.Factory,
|
||||||
DeprecationStatus: consts.Deprecated,
|
DeprecationStatus: consts.Deprecated,
|
||||||
},
|
},
|
||||||
"alicloud": {Factory: logicalAlicloud.Factory},
|
pluginconsts.SecretEngineAlicloud: {Factory: logicalAlicloud.Factory},
|
||||||
"aws": {Factory: logicalAws.Factory},
|
pluginconsts.SecretEngineAWS: {Factory: logicalAws.Factory},
|
||||||
"azure": {Factory: logicalAzure.Factory},
|
pluginconsts.SecretEngineAzure: {Factory: logicalAzure.Factory},
|
||||||
"cassandra": {
|
pluginconsts.SecretEngineCassandra: {
|
||||||
Factory: removedFactory,
|
Factory: removedFactory,
|
||||||
DeprecationStatus: consts.Removed,
|
DeprecationStatus: consts.Removed,
|
||||||
},
|
},
|
||||||
"consul": {Factory: logicalConsul.Factory},
|
pluginconsts.SecretEngineConsul: {Factory: logicalConsul.Factory},
|
||||||
"gcp": {Factory: logicalGcp.Factory},
|
pluginconsts.SecretEngineGCP: {Factory: logicalGcp.Factory},
|
||||||
"gcpkms": {Factory: logicalGcpKms.Factory},
|
pluginconsts.SecretEngineGCPKMS: {Factory: logicalGcpKms.Factory},
|
||||||
"kubernetes": {Factory: logicalKube.Factory},
|
pluginconsts.SecretEngineKubernetes: {Factory: logicalKube.Factory},
|
||||||
"mongodb": {
|
pluginconsts.SecretEngineMongoDB: {
|
||||||
Factory: removedFactory,
|
Factory: removedFactory,
|
||||||
DeprecationStatus: consts.Removed,
|
DeprecationStatus: consts.Removed,
|
||||||
},
|
},
|
||||||
"mongodbatlas": {Factory: logicalMongoAtlas.Factory},
|
pluginconsts.SecretEngineMongoDBAtlas: {Factory: logicalMongoAtlas.Factory},
|
||||||
"mssql": {
|
pluginconsts.SecretEngineMSSQL: {
|
||||||
Factory: removedFactory,
|
Factory: removedFactory,
|
||||||
DeprecationStatus: consts.Removed,
|
DeprecationStatus: consts.Removed,
|
||||||
},
|
},
|
||||||
"mysql": {
|
pluginconsts.SecretEngineMySQL: {
|
||||||
Factory: removedFactory,
|
Factory: removedFactory,
|
||||||
DeprecationStatus: consts.Removed,
|
DeprecationStatus: consts.Removed,
|
||||||
},
|
},
|
||||||
"nomad": {Factory: logicalNomad.Factory},
|
pluginconsts.SecretEngineNomad: {Factory: logicalNomad.Factory},
|
||||||
"openldap": {Factory: logicalLDAP.Factory},
|
pluginconsts.SecretEngineOpenLDAP: {Factory: logicalLDAP.Factory},
|
||||||
"ldap": {Factory: logicalLDAP.Factory},
|
pluginconsts.SecretEngineLDAP: {Factory: logicalLDAP.Factory},
|
||||||
"postgresql": {
|
pluginconsts.SecretEnginePostgresql: {
|
||||||
Factory: removedFactory,
|
Factory: removedFactory,
|
||||||
DeprecationStatus: consts.Removed,
|
DeprecationStatus: consts.Removed,
|
||||||
},
|
},
|
||||||
"rabbitmq": {Factory: logicalRabbit.Factory},
|
pluginconsts.SecretEngineRabbitMQ: {Factory: logicalRabbit.Factory},
|
||||||
"terraform": {Factory: logicalTerraform.Factory},
|
pluginconsts.SecretEngineTerraform: {Factory: logicalTerraform.Factory},
|
||||||
"totp": {Factory: logicalTotp.Factory},
|
pluginconsts.SecretEngineTOTP: {Factory: logicalTotp.Factory},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,25 +5,61 @@ package pluginconsts
|
|||||||
|
|
||||||
// These consts live outside the plugin registry files to prevent import cycles.
|
// These consts live outside the plugin registry files to prevent import cycles.
|
||||||
const (
|
const (
|
||||||
AuthTypeAliCloud = "alicloud"
|
AuthTypeAliCloud = "alicloud"
|
||||||
AuthTypeAppId = "app-id"
|
AuthTypeAppId = "app-id"
|
||||||
AuthTypeAWS = "aws"
|
AuthTypeAWS = "aws"
|
||||||
AuthTypeAzure = "azure"
|
AuthTypeAzure = "azure"
|
||||||
AuthTypeCF = "cf"
|
AuthTypeCF = "cf"
|
||||||
AuthTypeGCP = "gcp"
|
AuthTypeGCP = "gcp"
|
||||||
AuthTypeGitHub = "github"
|
AuthTypeGitHub = "github"
|
||||||
AuthTypeKerberos = "kerberos"
|
AuthTypeKerberos = "kerberos"
|
||||||
AuthTypeKubernetes = "kubernetes"
|
AuthTypeKubernetes = "kubernetes"
|
||||||
AuthTypeLDAP = "ldap"
|
AuthTypeLDAP = "ldap"
|
||||||
AuthTypeOCI = "oci"
|
AuthTypeOCI = "oci"
|
||||||
AuthTypeOkta = "okta"
|
AuthTypeOkta = "okta"
|
||||||
AuthTypePCF = "pcf"
|
AuthTypePCF = "pcf"
|
||||||
AuthTypeRadius = "radius"
|
AuthTypeRadius = "radius"
|
||||||
AuthTypeToken = "token"
|
AuthTypeToken = "token"
|
||||||
AuthTypeCert = "cert"
|
AuthTypeCert = "cert"
|
||||||
AuthTypeOIDC = "oidc"
|
AuthTypeOIDC = "oidc"
|
||||||
AuthTypeUserpass = "userpass"
|
AuthTypeUserpass = "userpass"
|
||||||
AuthTypeSAML = "saml"
|
AuthTypeSAML = "saml"
|
||||||
AuthTypeApprole = "approle"
|
AuthTypeApprole = "approle"
|
||||||
AuthTypeJWT = "jwt"
|
AuthTypeJWT = "jwt"
|
||||||
|
SecretEngineAD = "ad"
|
||||||
|
SecretEngineAlicloud = "alicloud"
|
||||||
|
SecretEngineAWS = "aws"
|
||||||
|
SecretEngineAzure = "azure"
|
||||||
|
SecretEngineCassandra = "cassandra"
|
||||||
|
SecretEngineConsul = "consul"
|
||||||
|
SecretEngineGCP = "gcp"
|
||||||
|
SecretEngineGCPKMS = "gcpkms"
|
||||||
|
SecretEngineKubernetes = "kubernetes"
|
||||||
|
SecretEngineMongoDB = "mongodb"
|
||||||
|
SecretEngineMongoDBAtlas = "mongodbatlas"
|
||||||
|
SecretEngineMSSQL = "mssql"
|
||||||
|
SecretEngineMySQL = "mysql"
|
||||||
|
SecretEngineNomad = "nomad"
|
||||||
|
SecretEngineOpenLDAP = "openldap"
|
||||||
|
SecretEngineLDAP = "ldap"
|
||||||
|
SecretEnginePostgresql = "postgresql"
|
||||||
|
SecretEngineRabbitMQ = "rabbitmq"
|
||||||
|
SecretEngineTerraform = "terraform"
|
||||||
|
SecretEngineTOTP = "totp"
|
||||||
|
SecretEngineKV = "kv"
|
||||||
|
SecretEngineTransform = "transform"
|
||||||
|
SecretEngineKMIP = "kmip"
|
||||||
|
SecretEngineKeymgmt = "keymgmt"
|
||||||
|
SecretEnginePki = "pki"
|
||||||
|
SecretEngineTransit = "transit"
|
||||||
|
SecretEngineSsh = "ssh"
|
||||||
|
SecretEngineCubbyhole = "cubbyhole"
|
||||||
|
SecretEngineIdentity = "identity"
|
||||||
|
SecretEngineSystem = "system"
|
||||||
|
// SecretEngineGeneric is a very old and deprecated version of KV, but is left
|
||||||
|
// for completeness.
|
||||||
|
SecretEngineGeneric = "generic"
|
||||||
|
// SecretEngineDatabase is the entry type for all databases, i.e. this is the combined
|
||||||
|
// database type for every database.
|
||||||
|
SecretEngineDatabase = "database"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/armon/go-metrics"
|
"github.com/armon/go-metrics"
|
||||||
"github.com/hashicorp/vault/helper/metricsutil"
|
"github.com/hashicorp/vault/helper/metricsutil"
|
||||||
"github.com/hashicorp/vault/helper/namespace"
|
"github.com/hashicorp/vault/helper/namespace"
|
||||||
|
"github.com/hashicorp/vault/helper/pluginconsts"
|
||||||
"github.com/hashicorp/vault/limits"
|
"github.com/hashicorp/vault/limits"
|
||||||
"github.com/hashicorp/vault/physical/raft"
|
"github.com/hashicorp/vault/physical/raft"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
"github.com/hashicorp/vault/sdk/helper/consts"
|
||||||
@@ -402,7 +403,7 @@ func (c *Core) findKvMounts() []*kvMount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, entry := range c.mounts.Entries {
|
for _, entry := range c.mounts.Entries {
|
||||||
if entry.Type == "kv" || entry.Type == "generic" {
|
if entry.Type == pluginconsts.SecretEngineKV || entry.Type == pluginconsts.SecretEngineGeneric {
|
||||||
version, ok := entry.Options["version"]
|
version, ok := entry.Options["version"]
|
||||||
if !ok || version == "" {
|
if !ok || version == "" {
|
||||||
version = "1"
|
version = "1"
|
||||||
@@ -535,6 +536,31 @@ func getMeanNamespaceSecrets(mapOfNamespacesToSecrets map[string]int) int {
|
|||||||
return getTotalSecretsAcrossAllNamespaces(mapOfNamespacesToSecrets) / length
|
return getTotalSecretsAcrossAllNamespaces(mapOfNamespacesToSecrets) / length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSecretEngineUsageMetrics returns a map of secret engine mount types to the number of those mounts that exist.
|
||||||
|
func (c *Core) GetSecretEngineUsageMetrics() map[string]int {
|
||||||
|
mounts := make(map[string]int)
|
||||||
|
|
||||||
|
c.authLock.RLock()
|
||||||
|
defer c.authLock.RUnlock()
|
||||||
|
|
||||||
|
// we don't grab the statelock, so this code might run during or after the seal process.
|
||||||
|
// Therefore, we need to check if c.auth is nil. If we do not, this will panic when
|
||||||
|
// run after seal.
|
||||||
|
if c.auth == nil {
|
||||||
|
return mounts
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, entry := range c.mounts.Entries {
|
||||||
|
authType := entry.Type
|
||||||
|
if _, ok := mounts[authType]; !ok {
|
||||||
|
mounts[authType] = 1
|
||||||
|
} else {
|
||||||
|
mounts[authType] += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mounts
|
||||||
|
}
|
||||||
|
|
||||||
// GetAuthMethodUsageMetrics returns a map of auth mount types to the number of those mounts that exist.
|
// GetAuthMethodUsageMetrics returns a map of auth mount types to the number of those mounts that exist.
|
||||||
func (c *Core) GetAuthMethodUsageMetrics() map[string]int {
|
func (c *Core) GetAuthMethodUsageMetrics() map[string]int {
|
||||||
mounts := make(map[string]int)
|
mounts := make(map[string]int)
|
||||||
|
|||||||
Reference in New Issue
Block a user