1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

27 Commits

Author SHA1 Message Date
Johannes Rothe
5184d1a9f9 fix(gcpkms): Set quota project to API project
Like described in the linked issue, if the GCP KMS key is stored in
project foo, but the service account is created in project bar, sops
complains that KMS API is not enabled in project bar.

The quota project used by default is the one encoded in the service
account key. With this commit, the behavior changes, so the project
where the KMS key and API reside, is read from the key ID and set
via the quota project option.

Fixes #1142

Signed-off-by: Johannes Rothe <mail@johannes-rothe.de>
2025-12-05 22:35:38 +01:00
shin.fukami.nd
d6673932f8 feat(gcpkms): Add SOPS_GCP_KMS_CLIENT_TYPE environment variable support
This change allows users to select between gRPC and REST clients for GCP KMS
by setting the SOPS_GCP_KMS_CLIENT_TYPE environment variable.

- Default: gRPC client (when not set or set to 'grpc')
- REST client: when set to 'rest'
- Updated documentation

Fixes #1570)

Signed-off-by: shin.fukami.nd <shin.fukami@nttdata.com>
2025-11-07 13:07:29 +09:00
Matheus Pimenta
6d70a2836b Allow injecting custom HTTP client for AWS, Azure, GCP and HashiCorp
Vault

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-21 19:06:26 +01:00
Matheus Pimenta
036ef9faec Introduce EncryptContext and DecryptContext for AWS, Azure, GCP, PGP
and HashiCorp Vault

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-14 10:29:33 +01:00
Hidde Beydals
ecf3194d4a Support GOOGLE_OAUTH_ACCESS_TOKEN for GCP
Co-authored-by: Maren Sofie Ringsby <marensofieringsby@gmail.com>
Co-authored-by: Matheus Pimenta <matheuscscp@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2025-03-30 14:11:51 +01:00
Matheus Pimenta
cac6e62e1a Add support for oauth2.TokenSource in GCP KMS
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-27 20:52:19 +00:00
Felix Fontein
060f7a45c4 Stop using deprecated grpc.Dial(), use grpc.NewClient() instead.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-03-25 20:34:48 +01:00
Boris Kreitchman
c822b55290 Sort masterkeys according to decryption-order
Co-authored-by: Gabriel Martinez <19713226+GMartinez-Sisti@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Bastien Wermeille <bastien.wermeille@gmail.com>
Co-authored-by: Hidde Beydals <hiddeco@users.noreply.github.com>
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
2023-12-18 08:38:43 +01:00
Hidde Beydals
6ec0312ffe keyservices: address logging regression
Replace the logging of failed encryption and decryption attempts from
error to info level.

This to address a regression in which an encryption or decryption
attempt with a series of keys would result in a list of failed attempts
logged to stderr even when the operation itself eventually succeeded.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-09-13 07:44:08 +02:00
Hidde Beydals
faa0e29136 *: deal with various gRPC deprecations
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-23 13:42:49 +02:00
Hidde Beydals
2b7b02351b gcpkms: further deal with Google SDK deprecations
xref: e535dc7c1d/migration.md

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-23 13:42:49 +02:00
Hidde Beydals
4848bb2aa3 gcpkms: update GCP related dependencies
While also updating the deprecated API module to
`cloud.google.com/go/kms/apiv1/kmspb`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-12 12:09:25 +02:00
Hidde Beydals
f2a1d4c782 Rename Go module to github.com/getsops/sops/v3
This commit renames the Go module from `go.mozilla.org/sops/v3` to
`github.com/getsops/sops/v3` without a major version bump, to align
with new stewardship.

For more information around this change, refer to
https://github.com/getsops/sops/issues/1246.

For a one-liner to change the `go.mod` and any import paths in your
Go project making use of this module, run:

```
find /path/to/repo -type f \( -name "*.go" -o -name "go.mod" \) -exec sed -i 's|go.mozilla.org/sops/v3|github.com/getsops/sops/v3|g' {} \;
find /path/to/repo -type f \( -name "*.go" -o -name "go.mod" \) -exec sed -i '' 's|go.mozilla.org/sops/v3|github.com/getsops/sops/v3|g' {} \;
```

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-31 22:51:36 +02:00
Hidde Beydals
d54c1286e1 Revert intro of WithError for most key sources
Most of the rewritten key sources introduced `WithError` calls, which
does not appear to go well with the UX of the CLI. This reverts it to
be the semi equal to current `master`.

During the diff, I noticed the current age implementation in master
does make use of `WithError`. Which makes me wonder if errors are not
returned twice at present in the CLI.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-07-11 23:13:11 +02:00
Hidde Beydals
b700beff05 gcpkms: allow use of Google default credentials
By addressing the bug in the introduced logic around
the `GOOGLE_CREDENTIALS` environment variable.

The variable is now only taken into account when set, and actually
containing a value.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-11 23:05:04 +02:00
Hidde Beydals
d9a5644df1 gcpkms: update SDK to latest, add tests, tidy
This updates the GCP KMS client to latest, adds more extensive test
coverage, and general tidying of bits of code.
The improvements are based on a fork of the key source in the Flux
project's kustomize-controller, built due to SOPS' limitation around
credential management without relying on runtime environment variables.

- Updates the deprecated `google.golang.org/api/cloudkms/v1` to
  `cloud.google.com/go/kms/apiv1`.
- It introduces a `CredentialJSON` type which holds a Service Account
  credential file, and can be applied to the `MasterKey`.
  When applied, the provided credentials are used in the GCP KMS
  service client configuration, instead of relying on
  `GOOGLE_CREDENTIALS`, or the default client environment variables.
  This is most useful when working with SOPS as an SDK, in combination
  with e.g. a local key service server implementation.
- Test coverage.

The forked version of this has compatability (and integration) tests to
ensure it works with current SOPS:

- cbb0fc9df5/internal/sops/gcpkms/keysource_integration_test.go (L39)
- cbb0fc9df5/internal/sops/gcpkms/keysource_integration_test.go (L59)

Co-authored-by: Somtochi Onyekwere <somtochi@weave.works>
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-07-04 22:23:24 +02:00
Josh Kaplinsky
4ffb54c791 Use custom GOOGLE_CREDENTIALS or fallback to default 2022-05-03 18:30:15 -05:00
Josh Kaplinsky
c0dc48401a Update keysource.go 2022-01-18 08:41:00 -06:00
Kaplinsky, Joshua B
ea8b3bb31d support gcp credentials as env var 2021-10-27 12:08:06 -05:00
Mikhail Katychev
0f2ebcf7ff added wrap verb to outputs (#817) 2021-02-17 22:21:20 +01:00
AJ Bahnken
8e21de8dbc Upgrade sops to go 1.13 (#566) 2019-11-18 10:06:58 -08:00
Adrian Utrilla
9d6a8d0e21 Default to Warn log level unless verbose flag is passed 2018-03-07 17:18:45 +01:00
Adrian Utrilla
bd846afea9 Add new logging to GCP KMS 2017-09-25 10:05:40 -07:00
Calin Don
8e15b25cad Fix typos 2017-09-18 18:48:34 +03:00
Adrian Utrilla
34c7380d00 Fix golint issues 2017-09-15 14:40:57 -07:00
Adrian Utrilla
bcf8adebea Merge branch 'master' into gcloud-kms 2017-09-15 14:34:02 -07:00
Calin Don
f7d72449b2 Rename Cloud KMS to GCP KMS 2017-09-12 15:37:30 +03:00