Skip to content

Commit

Permalink
core: add hook for initializing seals for migration
Browse files Browse the repository at this point in the history
Needed in enterprise version.
  • Loading branch information
mgaffney committed Oct 15, 2019
1 parent e6e844d commit 5d73b9a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions command/server_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func adjustCoreForSealMigration(logger log.Logger, core *vault.Core, barrierSeal
var existSeal vault.Seal
var newSeal vault.Seal

// TODO(mjg): this prevents migration from/to the same seal type
if existBarrierSealConfig.Type == barrierSeal.BarrierType() {
// In this case our migration seal is set so we are using it
// (potentially) for unwrapping. Set it on core for that purpose then
Expand Down
1 change: 1 addition & 0 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,7 @@ func (c *Core) SetSealsForMigration(migrationSeal, newSeal, unwrapSeal Seal) {
c.seal = newSeal
c.seal.SetCore(c)
c.logger.Warn("entering seal migration mode; Vault will not automatically unseal even if using an autoseal", "from_barrier_type", c.migrationSeal.BarrierType(), "to_barrier_type", c.seal.BarrierType())
c.initSealsForMigration()
}
}

Expand Down
2 changes: 2 additions & 0 deletions vault/core_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,5 @@ func (c *Core) removeAllPerfStandbySecondaries() {}
func (c *Core) perfStandbyClusterHandler() (*replication.Cluster, *cache.Cache, chan struct{}, error) {
return nil, cache.New(2*cluster.HeartbeatInterval, 1*time.Second), make(chan struct{}), nil
}

func (c *Core) initSealsForMigration() {}

0 comments on commit 5d73b9a

Please sign in to comment.