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

52 Commits

Author SHA1 Message Date
AJ Bahnken
adee2449f3 Don't log failures to user as an error within pgp keysource 2022-07-13 10:53:35 -07:00
Hidde Beydals
8a98401488 pgp: extend test coverage OpenPGP
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-30 16:05:13 +02:00
Hidde Beydals
3c8d637ecf pgp: allow disabling OpenPGP capabilities
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-26 11:02:42 +02:00
Hidde Beydals
c4458d7511 pgp: add Cleanup util func to GnuPGHome
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-26 11:02:42 +02:00
Hidde Beydals
c6236ada56 pgp: modernize and improve, and add tests
This replaces the current PGP keysource implementation with a modernized
version the Flux project has been using[1].

It includes utilites to configure the MasterKey via other means than
environment variables, to allow SDK users to have extensive control
over what things are decrypted with. This can for example be combined
with an own keyserver implementation.

To be able to contribute it back upstream while keeping it backwards
compatible with SOPS, a couple of changes have been made compared to
Flux:
- Instead of removing the enabling of the agent while making use of
  GnuPG, it can now be disabled.
- Support for OpenPGP has been added back. Note however my comments
  on this in-code, as I am not quite sure to what extend it is used
  at the moment, as it will not work on most setups (GnuPG <2.1 was
  released in 2017.)
- The absolute paths to the pub and sec keyrings can now be configured
  by SDK users. This would add more reason to keep OpenPGP around, if
  they are able to produce the keyring files themselves via other means
  than GnuPG.
- When a sec keyring is not detected, a lookup for the pub keyring is
  made and loaded instead if found. This to account for GnuPG >=2.1
  merging the sec keyring into pub keyring.
- Support for fetching keys from servers has been removed. This can be
  added back if we need to keep it around for a little longer.

This has extensive test coverage for GnuPG, but would need coverage for
the re-added OpenPGP implementation before it can be deemed ready.

[1]: ffdda3f3da/internal/sops/pgp

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-26 11:02:42 +02:00
Hidde Beydals
25817ed0f5 Replace x/crypto/openpgp with ProtonMail/go-crypto
As `golang.org/x/crypto/openpgp` has been deprecated (see
golang/go#44226 for details).

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-20 21:10:58 +02:00
ikedam
6130ffe35c Use the key of release@mozilla.com for the unit test (#882) (#906)
* `golang.org/x/crypto/openpgp` requires keys contain identity information.
* A email address can have only a single key with identity information on keys.openpgp.org.
2021-07-24 12:12:18 +02:00
Mikhail Katychev
0f2ebcf7ff added wrap verb to outputs (#817) 2021-02-17 22:21:20 +01:00
cloudstarz
886c1ee781 Returning stderr when gpg encrypt fails (#762)
Co-authored-by: AJ Bahnken <1144310+ajvb@users.noreply.github.com>
2020-10-30 00:00:20 +01:00
AJ Bahnken
8acbe730b2 typo fix for deprecation warning in getKeyFromKeyServer 2020-09-24 12:26:16 -07:00
AJ Bahnken
8a09f056de Switch gpg.mozilla.org out for keys.openpgp.org 2020-09-02 11:45:01 -07:00
Dr. Uwe Daub
4f06780ab2 Fix endless loop in x/crypto/openpgp func ReadMessage (#690)
* Fix tests

* Fix endless loop in x/crypto/openpgp func ReadMessage

This fixes https://github.com/mozilla/sops/issues/665
See also https://github.com/golang/go/issues/28786

In some strange situations it can happen, that openpgp.ReadMessage()
runs into a endless loop. This seems to be triggered by a slightly
inconsistency in key settings.
It happened to me, but I wasn't able to reproduce it with a fresh key.
A proposed solution from the x/crypto community was, to break this loop
in the callback passphrasePrompt.

* Revert "Fix tests"

This reverts commit 285f4dc8a1.

* Improve error description

https://github.com/mozilla/sops/pull/690#discussion_r451630193
2020-07-14 21:25:06 +02:00
AJ Bahnken
8e21de8dbc Upgrade sops to go 1.13 (#566) 2019-11-18 10:06:58 -08:00
AJ Bahnken
e9b9f7aeef Replace old functional test gpg keys (#512)
Two of the three old keys have expired, so create a new set with no
expiration.
2019-08-30 09:07:00 -07:00
Benoît Knecht
1de402b5ad pgp/keysource: Check size of key fingerprint
Make sure the key fingerprint is longer than 16 characters before
slicing it.

Closes #463
2019-05-23 16:17:23 +02:00
rabadin
410a687a35 Add support for custom GPG key servers
Add support for the SOPS_GPG_KEYSERVER environment variable to
override the default GPG key server (gpg.mozilla.org).
2019-03-12 12:17:33 +01:00
Jan-Otto Kröpke
b72e3bf3f1 Use $HOME instead ~ to find the gnupg directory. 2018-11-25 16:27:36 +01:00
Dov Reshef
e57c8f2c85 Fixed wrong Errorf format in message 2018-04-08 10:48:11 +03:00
Adrian Utrilla
9d6a8d0e21 Default to Warn log level unless verbose flag is passed 2018-03-07 17:18:45 +01:00
azhi
4efe53ff42 add IsBinary: true to FileHints when encoding with crypto/openpgp
since we encode binary data this is generally a good idea

this commit fixes #278 - now both crypto/openpgp and gpg work in a binary
mode, and we can safely use both interchangeably
(e.g. encrypt with crypto/openpgp, and then decrypt with gpg)
2017-11-28 01:17:44 +03:00
Adrian Utrilla
1847c6cdd6 Support retrieving PGP keys from keyservers 2017-10-05 13:26:10 -07:00
Adrian Utrilla
20046c1b48 Merge branch 'master' into logging 2017-09-16 17:59:00 -07:00
Adrian Utrilla
08a4c7e657 Add documentation to all main packages 2017-09-12 20:01:12 -07:00
Adrian Utrilla
93570b20d7 Fix golint errors 2017-09-12 09:59:23 -07:00
Adrian Utrilla
d1637e0da7 Use custom error type for pgp instead of Errorf 2017-09-12 09:22:33 -07:00
Adrian Utrilla
cdbac51221 s/GPG/PGP 2017-09-12 09:00:12 -07:00
Adrian Utrilla
55c7174713 Use logrus features for better logging 2017-09-07 10:49:27 -07:00
Adrian Utrilla
17d5d6b65c Move all loggers to logrus 2017-09-06 17:36:39 -07:00
Adrian Utrilla
252e0dba17 Fix style problems 2017-08-29 17:57:29 -07:00
Adrian Utrilla
be4a35e7f5 Fix shamir tests 2017-08-25 13:12:34 -07:00
Adrian Utrilla
dae5c6ce6f Add logging to KMS key operations 2017-08-25 09:59:58 -07:00
Adrian Utrilla
e3705100c2 Add support for GPG binary 2017-08-23 14:29:53 -07:00
Adrian Utrilla
48ee4bff63 First step towards keygroups 2017-08-23 11:06:47 -07:00
Adrian Utrilla
10dd9b5441 Use KeyService for all encrypt and decrypt operations 2017-08-17 11:32:04 -07:00
Andy Freeland
89e75471cc Fix KMS encryption context for backwards compatibility with SOPS 1.x
In SOPS 1.x, KMS encryption context was stored as a JSON object, but
SOPS 2.0 stored it as a comma-separated list of key/value pairs:

```
$ jq '.sops.kms | .[].context' encrypted-python
{
  "a": "b",
  "c": "d"
}
> jq '.sops.kms | .[].context' encrypted-go
"a:b,c:d"
```

The two outputs are incompatible with each other and caused a stack
trace when reading files encrypted with SOPS 1.x.

This patch restores read and output compatibility with SOPS 1.x.

Fixes #190.
2017-03-22 09:59:51 -07:00
Jeremiah Orem
3f04525a82 pgp: print errors if they occur in quick test 2016-10-28 10:16:14 -07:00
Jeremiah Orem
76f4ae8db0 return lists of pointers to avoid repackaging 2016-10-28 10:04:18 -07:00
Adrian Utrilla
71d4a3cfd2 Added go.mozilla.org imports
Fixes #122
2016-10-27 18:09:19 +02:00
Adrian Utrilla
786a863a3d PGP tests can now run anywhere 2016-08-25 12:21:10 -07:00
Adrian Utrilla
49a3ef3e3c Added Makefile 2016-08-24 12:37:18 -07:00
Adrian Utrilla
c9d63a838e Fixed golint issues 2016-08-24 10:29:28 -07:00
Adrian Utrilla
9ffe1c4908 Renamed GPGMasterKey and KMSMasterKey to MasterKey 2016-08-23 13:28:56 -07:00
Adrian Utrilla
e4c57636d2 Use UTC instead of local timezone 2016-08-23 12:57:13 -07:00
Adrian Utrilla
762c5cd559 Use time.RFC3339 instead of custom format 2016-08-23 12:54:13 -07:00
Adrian Utrilla
e885735260 aes decryptor now takes []byte keys 2016-08-23 12:49:18 -07:00
Adrian Utrilla
c522a7e93f Added ability to add and remove keys from files 2016-08-22 17:47:37 -07:00
Adrian Utrilla
0679be3598 Implemented unencrypted suffix
Move keysource tests to their respective packages
2016-08-22 14:22:04 -07:00
Adrian Utrilla
eca5943708 Moved pgpagent to an outside package 2016-08-19 10:36:53 -07:00
Adrian Utrilla
0fbba59163 Added YAML encryption 2016-08-18 15:49:27 -07:00
Adrian Utrilla
3997384272 Set key creation date to current date 2016-08-17 15:24:22 -07:00