Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vault/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,8 @@ func (c *Core) getRaftChallenge(leaderInfo *raft.LeaderJoinInfo) (*raftInformati
return nil, err
}

if sealConfig.Type != c.seal.BarrierSealConfigType().String() {
return nil, fmt.Errorf("mismatching seal types between raft leader (%s) and follower (%s)", sealConfig.Type, c.seal.BarrierSealConfigType())
if !CompatibleSealTypes(sealConfig.Type, c.seal.BarrierSealConfigType().String()) {
return nil, fmt.Errorf("incompatible seal types between raft leader (%s) and follower (%s)", sealConfig.Type, c.seal.BarrierSealConfigType())
}

challengeB64, ok := secret.Data["challenge"]
Expand Down
6 changes: 5 additions & 1 deletion vault/seal_autoseal.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (d *autoSeal) BarrierConfig(ctx context.Context) (*SealConfig, error) {

barrierTypeUpgradeCheck(d.BarrierSealConfigType(), conf)

if conf.Type != d.BarrierSealConfigType().String() && conf.Type != SealConfigTypeMultiseal.String() && d.BarrierSealConfigType() != SealConfigTypeMultiseal {
if !CompatibleSealTypes(conf.Type, d.BarrierSealConfigType().String()) {
d.logger.Error("barrier seal type does not match loaded type", "seal_type", conf.Type, "loaded_type", d.BarrierSealConfigType())
return nil, fmt.Errorf("barrier seal type of %q does not match loaded type of %q", conf.Type, d.BarrierSealConfigType())
}
Expand All @@ -203,6 +203,10 @@ func (d *autoSeal) BarrierConfig(ctx context.Context) (*SealConfig, error) {
return conf.Clone(), nil
}

func CompatibleSealTypes(a, b string) bool {
return a == b || a == SealConfigTypeMultiseal.String() || b == SealConfigTypeMultiseal.String()
}

func (d *autoSeal) ClearBarrierConfig(ctx context.Context) error {
return d.SetBarrierConfig(ctx, nil)
}
Expand Down