Commit Graph

247 Commits

Author SHA1 Message Date
cyli 684a8253fb Provide the default uesrname/password in the mysql start file, for ease of starting with notary
As per #75, the default username/password should not be hardcoded, so when that changes this README should also change
2015-10-05 12:08:24 -07:00
moxiegirl 1ce6aa4c34 Merge pull request #196 from ggtools/birthday-pr
Minor improvements on server url
2015-09-24 17:15:01 -07:00
Christophe Labouisse f9508e37e0 Add env var for default server url
The default server URL can now be set using the `NOTARY_SERVER_URL`
environment variable. Specifying the `--server` parameter still
override this value.

Signed-off-by: Christophe Labouisse <christophe@labouisse.org>
2015-09-19 17:25:12 +02:00
Christophe Labouisse 36594b360c Add missing --server option to verify.
Verify was making call to the server but didn't have a way to
override the default value.

Signed-off-by: Christophe Labouisse <christophe@labouisse.org>
2015-09-19 17:15:08 +02:00
Joe Beda f7d0ea70af Use pure-go library to get user home directory.
Fixes #194.

Signed-off-by: Joe Beda <joe.github@bedafamily.com>
2015-09-10 16:07:38 -07:00
David Lawrence 2532363fa3 wrapping up token authentication
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-08-19 14:36:30 -07:00
Derek McGowan a5aea53ef5 Add username and password prompt
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-08-19 13:48:16 -07:00
Derek McGowan 16ff63599d Updated notary cli to use authenticated transport
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-08-19 13:48:16 -07:00
Nathan McCauley bbe780fba1 Update README
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-08-11 23:26:49 -07:00
Diogo Mónica 52b064b6a6 Merge pull request #174 from docker/logging
Change logging to use contexts effectively
2015-08-10 10:31:21 -07:00
Aaron Lehmann ec3167eedb Import and export symlinks in keystore
- Export symlinks by encoding them in the zip file.

- Detect symlinks in a zip file on import and create them on the local
  filesystem.

- Add test coverage.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-08-03 15:03:31 -07:00
Aaron Lehmann a833f055e2 Change logging to use contexts effectively
Use the github.com/docker/distribution/context package to get a logger
that adds a unique ID and useful information about each HTTP request.

Use this logger in HTTP handlers instead of using logrus or the log
package directly.

Remove [Notary Server] and [Notary Signer] prefixes from log messages.

The distribution/context package was already vendored, so there are no
Godeps changes necessary.

Sample output:

    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="retrieving timestamp key for docker.com/docker"
    notarysigner_1 | time="2015-07-31T23:02:01Z" level=debug msg="generated ECDSA key with keyID: ea89e7dc49a13feab1e5ed349760b148c3c6ebd86968b2bc6cb0d003a8b79f78"
    notarysigner_1 | time="2015-07-31T23:02:01Z" level=debug msg="generated new ecdsa key for role:  and keyID: ea89e7dc49a13feab1e5ed349760b148c3c6ebd86968b2bc6cb0d003a8b79f78"
    notarysigner_1 | time="2015-07-31T23:02:01Z" level=info msg="CreateKey: Created KeyID ea89e7dc49a13feab1e5ed349760b148c3c6ebd86968b2bc6cb0d003a8b79f78"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="Creating new timestamp key for docker.com/docker. With algo: ecdsa"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="Inserting timestamp key for docker.com/docker"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="200 GET timestamp key" docker.com/docker=gun http.request.host="192.168.99.100:4443" http.request.id=a720da02-4312-48ae-b122-6d4bce9d3b20 http.request.method=GET http.request.remoteaddr="192.168.99.1:58178" http.request.uri="/v2/docker.com/docker/_trust/tuf/timestamp.key" http.request.useragent="Go 1.1 package http"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=info msg="response completed" http.request.host="192.168.99.100:4443" http.request.id=a720da02-4312-48ae-b122-6d4bce9d3b20 http.request.method=GET http.request.remoteaddr="192.168.99.1:58178" http.request.uri="/v2/docker.com/docker/_trust/tuf/timestamp.key" http.request.useragent="Go 1.1 package http" http.response.duration=29.703624ms http.response.status=200 http.response.written=181

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-31 16:06:56 -07:00
Jessica Frazelle 95cdfbeb58 add version to signer and server logs for debugging and issues
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-07-31 15:17:42 -07:00
Aaron Lehmann d7f11844c8 Accept configuration parameters from environment variables
For example, trust_service.type becomes
NOTARY_SERVER_TRUST_SERVICE_TYPE.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-31 13:05:34 -07:00
David Lawrence e7fa1951ab hard fail if TLS is only partially configured
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-31 10:49:42 -07:00
David Lawrence 056622d801 Merge pull request #163 from dmcgowan/refactor-keydbstore
Move key database to signer package
2015-07-30 21:13:32 -07:00
David Lawrence 58187d97d1 don't want bugsnag config template in config.json
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-30 16:39:08 -07:00
Derek McGowan bd9d7c9c74 Move key database to signer package
The key database is not generally used but only used by the signing service.
Move the implementation to the signer package to be imported by the signer.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-30 16:22:47 -07:00
Diogo Monica b04ed5042b Added -y no confirmation and more integration tests
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-30 16:22:14 -07:00
Diogo Monica af2da799bf Added support for env passphrases and improved integration script
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-30 16:22:14 -07:00
David Lawrence f7ca3ef62e make key algorithm configurable for local development with in memory ed25519 crypto service
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-30 11:53:39 -07:00
David Lawrence d27f480231 parse string log level from config
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-29 15:52:35 -07:00
Diogo Monica 59b02db807 Addressing nits
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 19:35:29 -07:00
Diogo Monica 27461ad9fb Added cli cert command, changed keylisting to be a map, fixed key removal
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 18:14:29 -07:00
Diogo Monica 297fc42e66 Fixing tests
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 15:32:01 -07:00
Diogo Monica c4e4518d04 Adding version from version.go
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 15:27:41 -07:00
Diogo Monica 4cf84b3e46 Adding version to notary
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 15:27:41 -07:00
Aaron Lehmann c3cf6c4083 Add a flag to change the password of the root key when exporting it
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-28 15:08:41 -07:00
Aaron Lehmann 3af03daa42 Change "notary keys" command to "notary key"
This makes the full subcommand names smoother; for example "notary key
generate" instead of "notary keys generate".

Add a "notary key list" subcommand to list keys, so "notary key"
lists the possible subcommands, instead of needing to use "notary key
-h".

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-28 13:46:45 -07:00
Aaron Lehmann 558f52530b Add key import and export commands
This adds four commands:

- notary keys export: export all keys, or keys for a particular GUN
  (with -g)
- notary keys export-root: export root key by ID
- notary keys import: import a zip file of keys
- notary keys import-root: import a single root key

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-28 13:46:45 -07:00
Diogo Monica bdd6760c69 Changing key removal message
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 13:30:41 -07:00
Diogo Monica 5a57f5e970 Rebased off of master, working removes
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 11:55:53 -07:00
Diogo Monica e7fb8ab46c Fixing golint
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 11:47:14 -07:00
Diogo Monica 579f51866b Removed all local keystores, added configurable trust dir
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 11:47:14 -07:00
David Lawrence 0f322c69a2 fixing remove
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-28 10:21:14 -07:00
David Lawrence 70f9f3277a viper config for notary signer
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-27 17:33:11 -07:00
Diogo Monica 4546ded7e0 Adding support for passphrases from env
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-27 12:07:03 -07:00
Diogo Monica a2472a5a72 Addressed comments, changed to PBES2, added key rotation
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-26 09:18:08 -07:00
Diogo Monica e568babc0a Added one more test, and fixed delete bug
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 06:47:04 -07:00
Diogo Monica 37bced3efa Changed signer to use DB, added initial SQL for private_keys
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 05:49:02 -07:00
Aaron Lehmann 2db2764874 Only skip TLS certificate verification if this is explicitly specified in the config
Fixes #111

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-21 17:45:38 -07:00
Nathan McCauley 6ffcb134d7 fix hash compare on verfy to be bytewise
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 17:58:46 -07:00
Derek McGowan c35c1ea254 Move passphrase logic to its own package
The logic to retrieve passphrase is generic and may be used by directly by clients.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-20 13:02:05 -07:00
Nathan McCauley 6b23e7d249 review feedback
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:10:13 -07:00
Nathan McCauley 75ae5b65df remove incorrect TODO comment
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley bc939bdf1f basic caching of root password for notary cli
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley f07876602f add test for passphraseRetriever
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley 0642da80f1 review feedback
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley 38fe6bd45b gofmt across the baord
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley de6f65b7e7 many testing fixups to support key aliasing
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:22 -07:00
Nathan McCauley f239757dfd keystore aliasing, take 2
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 10:58:20 -07:00
Nathan McCauley 5df1eb21f3 keystore aliasing, take 1
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 10:58:20 -07:00
Nathan McCauley 23b7e8c6af Update keyfilestore to use passwordRetriever
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 10:58:16 -07:00
David Lawrence 7db33797a8 fixing timestamp errors on list
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-20 10:35:40 -07:00
David Lawrence d453c6548d client side of multi TUF file atomic update
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-17 17:48:06 -07:00
Diogo Mónica 552ccf411a Merge pull request #80 from docker/test-publish
Add a unit test for publish
2015-07-17 16:53:45 -07:00
Aaron Lehmann afc331b930 Add a unit test for publish
This instantiates a temporary server, publishes some targets to it, and
makes sure we can pull back the correct targets from the server.

Also fixes a few problems with the client unit tests, error reporting in
the client, and logging in the server.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 16:27:31 -07:00
Diogo Monica 58e6544d0a Adding Cert retrieval by common name, and renaming KeyID to CertID
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:28:30 -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
Richard Scothern e5d6180276 Enable remote signing service
Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
2015-07-16 11:16:40 -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 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 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
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
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
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 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
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
Diogo Mónica 935b9a9366 Merge pull request #47 from docker/cryptoservice-refactor
Refactor crypto service
2015-07-13 15:29:59 -07:00
Aaron Lehmann e4704f9729 Update notary for removal of signed.Signer
We now deal with CryptoServices directly instead of passing around
Signers.

UnlockedSigner becomes UnlockedCryptoService because it no longer
contains a Signer.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-13 15:18:02 -07:00
David Lawrence da59198191 adding htpasswd auth to support the same set of mechanisms as distribution
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-13 14:17:24 -07:00
Diogo Monica 765a2cf661 Refactor crypto service
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-13 13:53:47 -07:00
Diogo Monica ba94fdd19d Signature/key types are now used correcty and are represented by constants.
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-12 22:21:29 -07:00
Diogo Monica 085c613527 Refactored fingerprint cert and added better debugging
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-12 22:21:29 -07:00
Diogo Monica 39482c2397 Working ECDSA implementation
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-12 22:21:29 -07:00
David Lawrence d1b09962f1 using roundtripper in notary client
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-10 10:02:38 -07:00
Diogo Mónica 436e02d390 Merge pull request #32 from dmcgowan/fix-default-loglevel
Fix default log level
2015-07-09 23:56:13 -07:00
Ian Duffy ed4454c9c9 Fix example configuration file given in README.md
The example configuration given in README.md is missing a comma character and doesn't form valid JSON.

This PR adds the comma as required.

Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2015-07-10 04:35:02 +01:00
Diogo Monica 06a28c89ee Added root key creation if non-existing to notary
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-09 18:56:06 -07:00
Aaron Lehmann 082d4f3c7c Change NotaryRepository to honor the baseURL passed in
Remove "transport", because it's not used.

In the actual notary client, pass in a hard-coded URL for now (same one
previously hardcoded in getRemoteStore). In tests, create a trivial HTTP
server using net/http/httptest, which returns a timestamp.key file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-09 17:58:33 -07:00
Diogo Monica 8c6de46aca Added list keys that ignores symlinks 2015-07-09 17:58:10 -07:00
David Lawrence 73ca456297 annotating Publish and making it accept a password retriever function
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:09 -07:00
David Lawrence 6bff14a679 refactoring NotaryClient out
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:09 -07:00
David Lawrence ebbb30b56c hold unlocked signer on repository
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:09 -07:00
David Lawrence c9ab3394de further publish updates, it pushes now, but doesn't sign roots correctly
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:09 -07:00
Diogo Monica f9f11e5781 Starting the key refactor; rename UnlockedRootKey
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-09 17:58:09 -07:00
David Lawrence 1d163650a3 changelist implementation
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:09 -07:00
David Lawrence 9d5e988586 working refactor
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:08 -07:00
Diogo Monica e66dc12eca More refactor 2015-07-09 17:58:08 -07:00
Diogo Monica 93f7d9911f Implementing ListTargets 2015-07-09 17:58:08 -07:00
Diogo Monica 30c0856266 Remove config from libnotary 2015-07-09 17:58:08 -07:00
Diogo Monica 1346296869 Initial libnotary refactor
Signed-off-by: Diogo Monica <diogo@docker.com>

Ported more functionality to libnotary
2015-07-09 17:57:48 -07:00
Derek McGowan 0f5f340d0c Fix default log level
Work around bug in viper configuration.
Viper will always use the default since it matches the whole key match first.
Setting the default to a map keeps the config file as the first matched item.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-07 11:55:49 -07:00
Diogo Monica d5cdeb93bb Adding EncryptedFileStore and changing interfaces
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-05 21:02:16 -07:00