diff --git a/sdk/verify.go b/sdk/verify.go index 8fb0fb737..a8315edc6 100644 --- a/sdk/verify.go +++ b/sdk/verify.go @@ -19,349 +19,18 @@ import ( "io" "io/ioutil" "os" + "path/filepath" "strings" "golang.org/x/crypto/openpgp" + "golang.org/x/crypto/openpgp/armor" + "golang.org/x/crypto/openpgp/packet" ) -// CoreOS image signing key https://coreos.com/security/image-signing-key/ -// $ gpg2 --list-keys --list-options show-unusable-subkeys \ -// --keyid-format SHORT 04127D0BFABEC8871FFB2CCE50E0885593D2DCB4 -// pub rsa4096/93D2DCB4 2013-09-06 [SC] -// 04127D0BFABEC8871FFB2CCE50E0885593D2DCB4 -// uid [ unknown] CoreOS Buildbot (Offical Builds) -// sub rsa4096/74E7E361 2013-09-06 [S] [expired: 2014-09-06] -// sub rsa4096/E5676EFC 2014-09-08 [S] [expired: 2015-09-08] -// sub rsa4096/1CB5FA26 2015-08-31 [S] [expired: 2017-08-30] -// sub rsa4096/B58844F1 2015-11-20 [S] [revoked: 2016-05-16] -// sub rsa4096/2E16137F 2016-05-16 [S] [expired: 2017-05-16] -// sub rsa4096/EF4B4ED9 2017-05-22 [S] [expired: 2018-06-01] -// sub rsa4096/0638EB2F 2018-02-10 [S] [expires: 2019-06-01] -// sub rsa4096/67B3CA0E 2019-02-04 [S] [expires: 2021-06-01] -const buildbot_coreos_PubKey = ` ------BEGIN PGP PUBLIC KEY BLOCK----- +const rpmgpgKeyring = "/etc/pki/rpm-gpg" -mQINBFIqVhQBEADjC7oxg5N9Xqmqqrac70EHITgjEXZfGm7Q50fuQlqDoeNWY+sN -szpw//dWz8lxvPAqUlTSeR+dl7nwdpG2yJSBY6pXnXFF9sdHoFAUI0uy1Pp6VU9b -/9uMzZo+BBaIfojwHCa91JcX3FwLly5sPmNAjgiTeYoFmeb7vmV9ZMjoda1B8k4e -8E0oVPgdDqCguBEP80NuosAONTib3fZ8ERmRw4HIwc9xjFDzyPpvyc25liyPKr57 -UDoDbO/DwhrrKGZP11JZHUn4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RUmG9JVizkqFxw0dLSFQ/A3M2nAE3anVaKyo0mYwtSI2ociMTsI -ZczgoliOhiUX0kRp12LvAYbQK/NUXyc7rtPdWaOUHtU1nQQiVUs70pbfatdQazTl -c4Jv9INSjBcQ2f8Bi7mKFaIDEUgGgUuRJihTYsBaKhxNaDqRro3pm0EDP0GMottp -QVP4rtqNcCjndbY7VhNcBkoB9F9DT+/uPH2+IlmtYDJK2rQv+fGVQYlDVB3nCOtM -gIh5G4uBMP3cvc2w6EUtvKw1+CnBkn9GNTIda9e+IkGcxBa5e6GsrsD+uFZWH89Z -kyYDYO8lRxhMfw9pufVJHQz3RH3BQ+cDXQKB4hG/PLFVuKp4/dxRv1wq3Wqjtich -u8FHnUTnJIo36yYZ5RcepLueSkYSMeSgCZG3Zmq6AkMKggwEa9c4w9xp -=28ZS ------END PGP PUBLIC KEY BLOCK----- -` - -func Verify(signed, signature io.Reader, key string) error { - - keyring, err := openpgp.ReadArmoredKeyRing(strings.NewReader(key)) - - if err != nil { - panic(err) - } - - _, err = openpgp.CheckDetachedSignature(keyring, signed, signature) +func Verify(signed, signature io.Reader, keyring openpgp.EntityList) error { + _, err := openpgp.CheckDetachedSignature(keyring, signed, signature) return err } @@ -378,19 +47,62 @@ func VerifyFile(file, verifyKeyFile string) error { } defer signature.Close() - var key string + var keyring openpgp.EntityList if verifyKeyFile == "" { - key = buildbot_coreos_PubKey + keyring, err = generateKeyRingFromDir(rpmgpgKeyring) + if err != nil { + return err + } } else { b, err := ioutil.ReadFile(verifyKeyFile) if err != nil { return fmt.Errorf("%v: %s", err, verifyKeyFile) } - key = string(b[:]) + keyring, err = openpgp.ReadArmoredKeyRing(strings.NewReader(string(b[:]))) + if err != nil { + return err + } } - if err := Verify(signed, signature, key); err != nil { + if err := Verify(signed, signature, keyring); err != nil { return fmt.Errorf("%v: %s", err, file) } return nil } + +func generateKeyRingFromDir(dir string) (openpgp.EntityList, error) { + var keyring openpgp.EntityList + + err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if !info.Mode().IsRegular() { + return nil + } + f, err := os.OpenFile(path, os.O_RDONLY, 0) + if err != nil { + return err + } + defer f.Close() + + block, err := armor.Decode(f) + if err != nil { + return err + } + + if block.Type != openpgp.PublicKeyType { + return nil + } + + e, err := openpgp.ReadEntity(packet.NewReader(block.Body)) + if err != nil { + return err + } + + keyring = append(keyring, e) + return nil + }) + if err != nil { + return nil, err + } + + return keyring, nil +} diff --git a/sdk/verify_test.go b/sdk/verify_test.go deleted file mode 100644 index 434e3ff62..000000000 --- a/sdk/verify_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdk - -import ( - "encoding/base64" - "io" - "strings" - "testing" - - "golang.org/x/crypto/openpgp/errors" -) - -const ( - versionTxt = `COREOS_BUILD=723 -COREOS_BRANCH=1 -COREOS_PATCH=0 -COREOS_VERSION=723.1.0 -COREOS_VERSION_ID=723.1.0 -COREOS_BUILD_ID="" -COREOS_SDK_VERSION=717.0.0 -` - versionSig = ` -iQIcBAABAgAGBQJVjgCWAAoJEKWpZjXlZ278G/kQAKSqkurFrKywkPhCe3VejSUp -GSS2MmHT4UAhHzopof33eV1mwI7NxPP7oDOeg5ovLxiHbawo/fHYUI9Wt2r9ZUCB -QxXt1fk9yBbUlVd6vdsrLmUZpVNfFmnxUL8iurRJczgSKmqyxbk+HcD+fidkgSAU -5xpLYEfCp1VSZ61a+3NZO8NHval4x3+AYZXOBNqfWz1s7Sewmvm/YbIs0BlwZxrY -CUiYzuNCgDl0qZLRx8C2EmnHk675XvN4Nr0xAHRsARIXfgFR1AVSqVdvzW2ZW3Bq -KBNiF0zfhZ2cdG6Rj9Dp39+skazUYW8bzn1fr374prSALef/WZIAUkLWvUpPdEli -ZnQr9Ufm+ZW2XM+Nm/Ks5Zf5f+0axHESF1ANSKNM7gp7a6+cbXLniXQKUxMLlTGL -TCz29ZdK1M8Wx2V8bisOk24yneOJyVzn5jSO4zCr6xWxBH8yf0B6UQnXWK8fhVDR -V/mehjhms7/8xCfRlTo42h69UqCzp/ZMlJZOTikw4Q7yZwhAu1bERlOWUVSHik8W -UjVp1b0FyuBYEJA3ht2QuIdf54M3bKGsFGMUB0/ro6sm00UF3pjVkG+a7WEU4zpp -nhqSIf7YIqso/oohdpmc338F7G3RgfYoZ2+THXGTxpIvMvkEqxCaKPsprXLZQd94 -ULECDto3pYB5cT5A/blA -=/zkZ -` -) - -func b64reader(s string) io.Reader { - return base64.NewDecoder(base64.StdEncoding, strings.NewReader(s)) -} - -func TestValidSig(t *testing.T) { - err := Verify(strings.NewReader(versionTxt), b64reader(versionSig), buildbot_coreos_PubKey) - if err != nil { - t.Errorf("Verify failed: %v", err) - } -} - -func TestInvalidSig(t *testing.T) { - err := Verify(strings.NewReader(versionTxt+"bad"), b64reader(versionSig), buildbot_coreos_PubKey) - if err == nil { - t.Errorf("Verify failed to report bad signature") - } else if _, ok := err.(errors.SignatureError); !ok { - t.Errorf("Verify failed: %v", err) - } -}