mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Provide a more reasonable error message for disabled Shamir seals (#24275)
This commit is contained in:
@@ -2572,6 +2572,8 @@ func setSeal(c *ServerCommand, config *server.Config, infoKeys []string, info ma
|
||||
for _, c := range config.Seals {
|
||||
if !c.Disabled {
|
||||
allSealsDisabled = false
|
||||
} else if c.Type == vault.SealConfigTypeShamir.String() {
|
||||
return nil, errors.New("shamir seals cannot be set disabled (they should simply not be set)")
|
||||
}
|
||||
}
|
||||
// If all seals are disabled assume they want to
|
||||
@@ -2722,9 +2724,6 @@ func setSeal(c *ServerCommand, config *server.Config, infoKeys []string, info ma
|
||||
return nil, errors.Join(sealConfigWarning, errors.New("no enabled Seals in configuration"))
|
||||
case configuredSeals == 0:
|
||||
return nil, errors.Join(sealConfigWarning, errors.New("no seals were successfully initialized"))
|
||||
case containsShamir(enabledSealWrappers) && containsShamir(disabledSealWrappers):
|
||||
return nil, errors.Join(sealConfigWarning, errors.New("shamir seals cannot be set disabled (they should simply not be set)"))
|
||||
|
||||
case len(enabledSealWrappers) == 1 && containsShamir(enabledSealWrappers):
|
||||
// The barrier seal is Shamir. If there are any disabled seals, then we put them all in the same
|
||||
// autoSeal.
|
||||
|
||||
Reference in New Issue
Block a user