mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-28 22:21:30 +01:00
Fix segfault when seal block is removed (#8517)
This commit is contained in:
parent
b98401d984
commit
bb4b2b024e
@ -103,17 +103,17 @@ func adjustCoreForSealMigration(logger log.Logger, core *vault.Core, barrierSeal
|
|||||||
|
|
||||||
// Set the appropriate barrier and recovery configs.
|
// Set the appropriate barrier and recovery configs.
|
||||||
switch {
|
switch {
|
||||||
case migrationSeal.RecoveryKeySupported() && newSeal.RecoveryKeySupported():
|
case migrationSeal != nil && newSeal != nil && migrationSeal.RecoveryKeySupported() && newSeal.RecoveryKeySupported():
|
||||||
// Migrating from auto->auto, copy the configs over
|
// Migrating from auto->auto, copy the configs over
|
||||||
newSeal.SetCachedBarrierConfig(existBarrierSealConfig)
|
newSeal.SetCachedBarrierConfig(existBarrierSealConfig)
|
||||||
newSeal.SetCachedRecoveryConfig(existRecoverySealConfig)
|
newSeal.SetCachedRecoveryConfig(existRecoverySealConfig)
|
||||||
case migrationSeal.RecoveryKeySupported():
|
case migrationSeal != nil && newSeal != nil && migrationSeal.RecoveryKeySupported():
|
||||||
// Migrating from auto->shamir, clone auto's recovery config and set
|
// Migrating from auto->shamir, clone auto's recovery config and set
|
||||||
// stored keys to 1.
|
// stored keys to 1.
|
||||||
newSealConfig := existRecoverySealConfig.Clone()
|
newSealConfig := existRecoverySealConfig.Clone()
|
||||||
newSealConfig.StoredShares = 1
|
newSealConfig.StoredShares = 1
|
||||||
newSeal.SetCachedBarrierConfig(newSealConfig)
|
newSeal.SetCachedBarrierConfig(newSealConfig)
|
||||||
case newSeal.RecoveryKeySupported():
|
case newSeal != nil && newSeal.RecoveryKeySupported():
|
||||||
// Migrating from shamir->auto, set a new barrier config and set
|
// Migrating from shamir->auto, set a new barrier config and set
|
||||||
// recovery config to a clone of shamir's barrier config with stored
|
// recovery config to a clone of shamir's barrier config with stored
|
||||||
// keys set to 0.
|
// keys set to 0.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user