mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-10 00:27:02 +02:00
* Port awskms autoseal * Rename files * WIP autoseal * Fix protobuf conflict * Expose some structs to properly allow encrypting stored keys * Update awskms with the latest changes * Add KeyGuard implementation to abstract encryption/decryption of keys * Fully decouple seal.Access implementations from sealwrap structs * Add extra line to proto files, comment update * Update seal_access_entry.go * govendor sync * Add endpoint info to configureAWSKMSSeal * Update comment * Refactor structs * Update make proto * Remove remove KeyGuard, move encrypt/decrypt to autoSeal * Add rest of seals, update VerifyRecoveryKeys, add deps * Fix some merge conflicts via govendor updates * Rename SealWrapEntry to EncryptedBlobInfo * Remove barrier type upgrade check in oss * Add key to EncryptedBlobInfo proto * Update barrierTypeUpgradeCheck signature
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package seal
|
|
|
|
import (
|
|
"github.com/hashicorp/errwrap"
|
|
log "github.com/hashicorp/go-hclog"
|
|
"github.com/hashicorp/vault/command/server"
|
|
"github.com/hashicorp/vault/logical"
|
|
"github.com/hashicorp/vault/vault"
|
|
"github.com/hashicorp/vault/vault/seal/gcpckms"
|
|
)
|
|
|
|
func configureGCPCKMSSeal(config *server.Config, infoKeys *[]string, info *map[string]string, logger log.Logger, inseal vault.Seal) (vault.Seal, error) {
|
|
kms := gcpckms.NewSeal(logger)
|
|
kmsInfo, err := kms.SetConfig(config.Seal.Config)
|
|
if err != nil {
|
|
// If the error is any other than logical.KeyNotFoundError, return the error
|
|
if !errwrap.ContainsType(err, new(logical.KeyNotFoundError)) {
|
|
return nil, err
|
|
}
|
|
}
|
|
autoseal := vault.NewAutoSeal(kms)
|
|
if kmsInfo != nil {
|
|
*infoKeys = append(*infoKeys, "Seal Type", "GCP KMS Project", "GCP KMS Region", "GCP KMS Key Ring", "GCP KMS Crypto Key")
|
|
(*info)["Seal Type"] = config.Seal.Type
|
|
(*info)["GCP KMS Project"] = kmsInfo["project"]
|
|
(*info)["GCP KMS Region"] = kmsInfo["region"]
|
|
(*info)["GCP KMS Key Ring"] = kmsInfo["key_ring"]
|
|
(*info)["GCP KMS Crypto Key"] = kmsInfo["crypto_key"]
|
|
}
|
|
return autoseal, nil
|
|
}
|