Commit Graph

327 Commits

Author SHA1 Message Date
Aaron Lehmann
d2ea9cc0d5 Updates to notary for gotuf's split of PublicKey and PrivateKey interfaces
Functions should now take data.PublicKey or data.PrivateKey instead of
data.Key.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 11:35:22 -07:00
Nathan McCauley
88e7346782 Merge pull request #71 from docker/unify-cryptoservice
Unify cryptoservice
2015-07-17 11:10:59 -07:00
Aaron Lehmann
125d72fd77 Big refactor to make signer use cryptoservices
- Add MemoryFileStore, a partial FileStore implementation that doesn't
  persist on disk.

- Create a KeyStore interface that allows pluggable key store types. Use
  this interface in the cryptoservice implementation.

- Add KeyMemoryStore, which uses MemoryFileStore to provide a KeyStore.

- Add GetKey and DeleteKey functions to cryptoservice.CryptoService.

- Refactor the hardware RSA signing service as a CryptoService.

- Replace custom ed25519 code with cryptoservice.CryptoService.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 09:33:19 -07:00
Aaron Lehmann
f5c1d8dbc9 Add ED25519 support to cryptoservice and x509utils
Add unit tests for cryptoservice that do sign and verify for all three
supported algorithms.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-16 18:44:44 -07:00
Richard Scothern
52acadc625 Merge pull request #70 from RichardScothern/enable-remote-signer
Enable remote signing service
2015-07-16 11:34:17 -07:00
Richard Scothern
e5d6180276 Enable remote signing service
Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
2015-07-16 11:16:40 -07:00
David Lawrence
40eaf8f2f1 Merge pull request #69 from RichardScothern/deploy
Fix the staging deployment.
2015-07-16 10:00:33 -07:00
Richard Scothern
df18a541e2 Fix the staging deployment.
Add a service name and ephemeral ports to notary server.
Remove certs as TLS is terminated in the ELB.

Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
2015-07-16 09:50:52 -07:00
Diogo Mónica
1a5ad474f3 Merge pull request #66 from docker/rename-certificate-stores
Rename certificate stores to trustedCertificateStore and trustedCAStore
2015-07-15 22:40:03 -07:00
Diogo Mónica
0ed6072a4a Merge pull request #67 from docker/adding-certs
Adding new certificates
2015-07-15 22:35:54 -07:00
Richard Scothern
8eafc998f7 Merge pull request #63 from endophage/fix_sql
fixing database queries
2015-07-15 22:33:48 -07:00
Diogo Monica
3debfbca10 Reissued all certs with correct SANs
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 21:42:24 -07:00
Diogo Monica
ddfcd50471 Changing .pem to .crt everywhere
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 20:44:09 -07:00
Diogo Monica
3d58e6b810 Added tests for x509Filestore
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 19:57:48 -07:00
Diogo Monica
d743dfac6e Fixed config files and trust manager tests to point at new fixtures
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 19:46:57 -07:00
Diogo Monica
cdee810942 Changed notary-server to point at new certs
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 19:45:34 -07:00
Diogo Monica
9a065a8d40 Adding new testing fixtures
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 19:44:58 -07:00
Diogo Monica
76d81563b3 Simplifying AddCertFromPEM to use help functions
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-15 19:44:37 -07:00
Aaron Lehmann
36a8f77129 Rename certificate stores to trustedCertificateStore and trustedCAStore
Add convenience methods to KeyStoreManager to add certs to both cert
stores.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 18:10:53 -07:00
Diogo Mónica
06e445c2ef Merge pull request #64 from docker/signer-use-gotuf-types
Change notary-signer to use gotuf's key types
2015-07-15 17:44:57 -07:00
Aaron Lehmann
c54f2d0768 Merge pull request #62 from docker/import-export
Add key import and export features
2015-07-15 17:43:19 -07:00
Aaron Lehmann
167a07c894 Change notary-signer to use gotuf's key types
This causes notary-signer to use gotuf's Key interface instead of
defining its own redundant types.

We can go further with this in the future by removing the redundant
ED25519 implementation. This would be refactored into the cryptoservice
package, and notary-signer would be changed to use that package's
cryptoservice for key creation and signing operations.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:22:46 -07:00
Aaron Lehmann
e5a42d4df9 Add ExportKeysByGUN function
It exports the keys for a particular GUN to a zip, encrypted with a
specified passphrase.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:57 -07:00
Aaron Lehmann
6d3d98b873 Move non-root keys to tuf_keys subdirectory
This subdirectory is at the same level as root_keys. It avoids having
rootKeyStore and nonRootKeyStore overlap. Previously, the base directory
for rootKeyStore was .../private/root_keys and the base directory for
nonRootKeyStore was .../private.

This commit also removes deduplicating logic in ExportAllKeys, which is
no longer needed now that the stores don't overlap.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:57 -07:00
Aaron Lehmann
0ffb2c69d9 Add a check that a root key being imported is encrypted
Add unit test coverage that makes this check fail. Also add unit test
coverage for making sure trying to import something that isn't PEM fails
in the expected way.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:56 -07:00
Aaron Lehmann
479333ca7b Add ExportRootKey and ImportRootKey functions
Also add a unit test

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:56 -07:00
Aaron Lehmann
20633e3e12 Make FileStore only allow operations on files inside the store
Paths that abuse .. shouldn't be able to escape from the filestore. This
is especially important when importing keys from zip files that could
have "creative" paths encoded in the zip.

Add test coverage for this protection.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:56 -07:00
Aaron Lehmann
eb8a7a0e25 Add ImportKeysZip and test coverage
This function reads a zip file and populates the keystores with the keys
in the zip file. Root keys are left encrypted, and non-root keys are
decrypted before being added to the keystore.

The unit test first exports a repo's keys to a zip file, then imports it
into another repo. It checks that all the correct keys exist in the new
repo after the import operation.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:56 -07:00
Aaron Lehmann
878a8a083d Add ExportAllKeys function
This allows all keys to be exported to a zip file. Keys that were
already encrypted are kept as-is, and keys that weren't encrypted are
encrypted with the specified passphrase.

Also add a unit test that creates the zip file and checks the expected
keys all exist, and are all encrypted with the expected passphrase.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:49 -07:00
David Lawrence
72d7d35221 fixing database queries
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-15 16:19:14 -07:00
Diogo Mónica
7331b3a0e8 Merge pull request #60 from docker/coverage-script
Adding script to output coverage over all packages
2015-07-14 20:17:00 -07:00
Diogo Monica
bbc53376ba Removing uneeded push to coveralls
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 20:16:17 -07:00
Diogo Monica
dea91dff07 Adding script to output coverage over all packages
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 19:23:53 -07:00
Diogo Mónica
0884207464 Merge pull request #59 from docker/keystoremanager
KeyStoreManager
2015-07-14 18:47:35 -07:00
Aaron Lehmann
a16581ecc7 Move CryptoService and UnlockedCryptoService into a cryptoservice package
Move GenRootKey and GetRootCryptoService to KeyStoreManager, now that
they don't depend on client-specific types.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 18:39:38 -07:00
Aaron Lehmann
6068f30145 Move caStore and certificateStore into KeyStoreManager
Refactor validateRoot into KeyStoreManager. It now takes the DNS name as
a parameter. When KeyStoreManager is used with a NotaryRepository, the
DNS name should be the GUN of the repository.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 18:39:38 -07:00
Aaron Lehmann
d5c7c40955 Introduce a KeyStoreManager to abstract management of root and non-root key storage
This structure encapsulates what used to be "rootKeyStore" and
"privKeyStore". These are being moved out of NotaryRepository, so that
operations like listing keys, importing keys, and exporting keys aren't
tied to a NotaryRepository structure.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 18:39:38 -07:00
Richard Scothern
3cc3a0d489 Merge pull request #58 from docker/fixing-docker-building
Working docker build/docker compose
2015-07-14 16:05:57 -07:00
Diogo Monica
394237cfe6 Adding link to notary-signer in dockerfile
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 15:57:11 -07:00
Diogo Monica
657150ca9b Working docker build/docker compose
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 15:46:21 -07:00
Diogo Mónica
5490ece809 Merge pull request #56 from dmcgowan/fix-timestamp-algorithm
Change fallback timestamp algorithtm to supported version
2015-07-14 15:39:48 -07:00
Diogo Mónica
eb8e868e6d Merge pull request #53 from docker/import-notary-signer
Import notary signer, refactor notary-signer API again
2015-07-14 14:33:10 -07:00
Nathan McCauley
79af8434d3 exclude proto gen'd code from go fmt during circle ci
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-14 14:21:52 -07:00
Nathan McCauley
40fd60264a exclude proto gen'd code from go fmt
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-14 14:13:19 -07:00
Aaron Lehmann
c82440258f Add documentation for FindKeyByID function
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 14:06:52 -07:00
Derek McGowan
3971955cfe Change fallback timestamp algorithtm to supported version
ECDSA timestamp keys currently not supported by crypto service, use support ED25519.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-14 11:44:50 -07:00
Aaron Lehmann
e7e9ef4a0d Don't hardcode RSA algorithm
When we need to find a key from its ID, search all available signing
services. There should only be a few, so this shouldn't have much
overhead. This avoids the need to maintain a persistent mapping between
key ID and the responsible signing service.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 10:49:43 -07:00
Diogo Monica
321b155596 Godeps update, removed dependency on rufus
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:39:03 -07:00
Diogo Monica
f03626a10e Refactored Rufus API
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:23:38 -07:00
Diogo Monica
9a4c2dc744 Initial copy of notary-signer
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:23:22 -07:00