Commit Graph

69 Commits

Author SHA1 Message Date
Hidde Beydals 205a0b4fea
misc: check err value in test
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:34:24 +02:00
Hidde Beydals bab4411abe
sops: always disable OpenPGP
The forked implementation did not have OpenPGP anymore, as it never
really worked. However, the upstream version still does but now allows
it to be disabled.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:18:33 +02:00
Hidde Beydals d02c5ff505
sops: disable logs key services
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:16 +02:00
Hidde Beydals 1eaa29c618
sops: drop MPL-2.0 license file
As all remaining code is now no longer derived from MPL-2.0 licensed
code.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:15 +02:00
Hidde Beydals b808e9e0c4
sops/pgp: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:15 +02:00
Hidde Beydals bc3859dfb4
sops/hcvault: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:14 +02:00
Hidde Beydals 548de2f51a
sops/gcpkms: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:14 +02:00
Hidde Beydals 1854a9f9dd
sops/azkv: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

We continue to inject our own default credentials in the key server if
none are provided by the Kustomization, to ensure we do not shell out
to `az`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:14 +02:00
Hidde Beydals 2e50f41755
sops/awskms: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:13 +02:00
Hidde Beydals 6c67d3811c
sops/age: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:13 +02:00
Hidde Beydals 815f3f0530
sops: move to `github.com/getsops/sops/v3`
This updates `go.mozilla.org/sops/v3` to the `v3.8.0-rc.1` release of
`github.com/getsops/sops/v3`.

This (finally) allows us to drop our forked key sources, as they have
now been contributed upstream in a slightly modified form which still
allows us to maintain control over the used credentials in isolation.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:12 +02:00
Stefan Prodan b74c152953
Fix Azure Key Vault integration tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-07 19:35:40 +03:00
Stefan Prodan 0bc265c71c
Update dependencies
- k8s.io/* v0.27.4
- cloud.google.com/go/kms v1.15.0
- github.com/aws/aws-sdk-go-v2 v1.20.0
- github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0
- github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0
- github.com/fluxcd/pkg/runtime v0.41.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-07 18:19:31 +03:00
Stefan Prodan c61358d5a6
Update azidentity from beta to v1.3.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 18:31:34 +03:00
Aaron Peschel 2b98fbf3b7 Fix SOPS azkv envCred
At the moment, the envCred logic can't actually set the Azure credentials.

This commit fixes the logic so that the environment variables can
actually be used to set the Azure credentials.

There are other issues that come up from this block of code, but those
can be dealt with separately.

Signed-off-by: Aaron Peschel <aaron.peschel@gmail.com>
2023-04-21 12:58:22 -07:00
Somtochi Onyekwere 45ad400f2a Add Workload Identity support for Azure Vault
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Co-authored-by: Hidde Beydals <hidde@hhh.computer>
2023-04-03 11:23:44 +01:00
Hidde Beydals 648825603c build: update dockertest to Go Mod compatible v3
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-12-14 14:38:37 +00:00
Hidde Beydals d10a45bf7f Update `keyvault/azkeys` Azure SDK to v0.9.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-11-09 09:19:08 +00:00
Stefan Prodan 69509c92e2
Build with Go 1.19
- Update Go to 1.19 in CI
- Use Go 1.19 in base image
- Update controller-gen v0.8.0 (v0.7 fails with Go 1.19) and regenerate manifests

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-09-28 18:17:34 +03:00
Stefan Prodan 8feccf0aeb
Merge pull request #726 from bkreitch/try-offline-methods-first
Sort SOPS masterkeys so offline decrypt methods are tried first
2022-09-12 12:06:11 +03:00
Boris Kreitchman 5fe7910ab8 Sort masterkeys so offline decrypt methods are tried first
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
2022-09-10 15:38:57 +03:00
Paulo Gomes 73f005e541
fuzz: Refactor Fuzzers based on Go native fuzzing
The existing fuzzers are converted into the Go native format. This
works well with most fuzzers, apart from the one that fuzzes the
controller.

That specific test depends on funcs and vars that are defined on
suite_test.go, which is not supported when building fuzzers leveraging
Go native fuzz for oss-fuzz. That test is therefore ignored when
executed with make fuzz-native. But, all tests are covered with
make fuzz-smoketest, in order to support oss-fuzz.

Once the controller is rewritten we can revist this and ensure that
fuzzers does not require envtest nor embedded CRDs.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-07 12:26:43 +01:00
Sanskar Jaiswal 72f0e605be sops/awskms: fix compatibility tests with upstream sops
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-30 18:03:04 +05:30
Sanskar Jaiswal 10bc7eadff sops/awskms: fix awskms config creation and expand tests
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-28 00:36:54 +05:30
Hidde Beydals 0539f6f3dc Drop deprecated github.com/golang/protobuf
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-25 10:40:33 +02:00
Hidde Beydals cbb0fc9df5 sops/gcpkms: disable integration tests
This temporarily disables the integration tests as we are waiting for
the CNCF to provide us with GCP credits.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-24 21:52:01 +02:00
Somtochi Onyekwere 2ac475ebef sops/gcpkms: add key source implementation
This adds a SOPS GCP KMS key source which makes use of the latest GCP
client, and supports both injection of master key credentials and a
default client making use of environmental runtime values.

The implementation fully replaces SOPS', and is covered with
compatability tests.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-05-24 21:51:46 +02:00
Max Jonas Werner 62fb2d96a2
Merge pull request #656 from fluxcd/relicense-sops
Relicense SOPS module to MPL 2.0
2022-05-22 09:03:24 +02:00
Sanskar Jaiswal c8a00fb495 update sops awskms files to use MPL 2.0
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-20 17:39:42 +05:30
Hidde Beydals 327a3560b3 Relicense SOPS module to MPL 2.0
This relicenses all of our SOPS implementation code to MPL 2.0, where
Apache 2.0 was previously used due to code being written from scratch.

By making this license change, we are better capable of contributing
the changes upstream.

In case there is doubt about validity of DCO sign-off to make such
changes: all code where Apache 2.0 license applies were authored by
myself. In addition, Apache 2.0 is compatible with MPL 2.0[1][2].

[1]: https://opensource.com/law/11/9/mpl-20-copyleft-and-license-compatibility
[2]: https://blog.gerv.net/2013/02/relicensing-when-do-you-have-to-ask/

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-20 13:10:06 +02:00
Sanskar Jaiswal 326e20c41b update code comments and kms decryption docs
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:34:16 +05:30
Sanskar Jaiswal 1ee85e5988 add and update tests for awskms and hcvault
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:34:16 +05:30
Sanskar Jaiswal e5a37b7013 migrate aws kms implementation to aws-go-sdk-v2
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:34:15 +05:30
Sanskar Jaiswal c801f75458 add docs
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:33:31 +05:30
Sanskar Jaiswal 53aded2596 add support for AWS KMS credentials using .spec.decryption
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:33:22 +05:30
Hidde Beydals e5653b2ff3 Drop SOPS LocalClient implementation
As patch has been merged upstream, and `keyservice.LocalClient` does
now accept the `KeyServiceServer` interface.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-09 22:02:05 +02:00
Hidde Beydals 9db141d9db sops/keyservice: tidy and add tests
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-05 12:44:35 +02:00
Hidde Beydals ffdda3f3da sops/azkv: add Token utility type
This adds a new Token type which can be used to configure an
azcore.TokenCredential on a master key. Due to this introduction, the
server only has to go through the AADConfig once.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-05 12:44:35 +02:00
Hidde Beydals dfbeae9487 sops/age: add ParsedIdentities utility type
This adds a new ParsedIdentities type which can be used to parse a set
of age identities just once, instead of parsing them for every Decrypt
request.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-05 12:44:35 +02:00
Hidde Beydals ed49f8427f sops/pgp: add GnuPGHome utility type
This adds a new GnuPGHome type which can be used to create a new
contained GnuPG home directory. The type is self-validating, ensuring
it adheres to e.g. permission rules set out by GnuPG, and allows for
importing keys from armored bytes and files.

Because of this introduction, the decryptor service no longer has to
write data from a Secret to a temporary file, but is instead able to
directly import them into the keyring from the Secret entry's bytes.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals eaec2b9164 sops/hcvault: tidy and test keysource impl
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 6554be2208 sops/pgp: tidy and test keysource implementation
This revises the PGP keysource implementation, removing bits of code
that were not actually in use, or not viable in combination with how we
work with keys. In short:

- crypto/openpgp implementation has been removed. As it is unable to read
  the keystore created by newer versions of GnuPG. Given we import user
  provided keys _with_ GnuPG, this was basically dead code.
- All capabilities around fetching public keys from a server have been
  removed.
- "Jailing" of GnuPG shell-out is now handled in `gpgExec`, in addition,
  arguments for encrypt and decrypt execs have been revised to ensure
  they e.g. do not instruct to use the agent.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 182ddbf837 sops/age: tidy and test keysource implementation
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 2487b51e51 sops/keyservice: error on unfulfilled requirements
This ensures we signal early that we will be unable to fulfill the
request, instead of letting the underlying keysource implementation
run into mayhem. Which can be problematic for e.g. PGP, which has
assumptions about things being located relative to the given home
directory, resulting in possible unexpected behavior if an empty path
is given.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 512e749219 sops/keyservice: handle nil key requests
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals e5c2730342 sops/keyservice: allow config of server via opts
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 2e30a18b50 sops/keyservice: keep server fields private
This ensures data used for decryption is not exposed widely after
constructing the Server, and prevents a bypass to the default server
fallback.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 7450a1a9a3 sops/keyservice: simplify switch logic
These bits of code have a history of accidents around the fallback
behavior. By simplifying it, the fallback should generally always work,
unless you put in instructions to take another route.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Hidde Beydals 31bfd5a057 sops/keyservice: remove prompt capabilities
The original keyservice implementation was forked from SOPS, keeping
the prompt capabilities intact. However, since the implementations have
started to grow, it is better to remove this capability and resort to
a hardcoded `false` default for the fallback server. As the controller
is never expected to have an interactive TTY/shell.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-04 23:57:46 +02:00
Paulo Gomes 1ba95077df
Fix build tag syntax
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-04-01 10:11:25 +01:00