Commit Graph

123 Commits

Author SHA1 Message Date
David Lawrence bc0c0d4ea1 health check will never be able to get auth token so remove RootHandler wrapper
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:08:41 -08:00
Diogo Mónica 7e5cc048b7 Merge pull request #253 from cyli/prometheus-server
Add prometheus stats to server http handlers
2015-10-29 22:22:24 -07:00
Ying Li 5ea5b40d3f Add prometheus stats to server http handlers
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-29 21:04:35 -07:00
Ying Li 7dc0dbec84 Remove the cryptoservice argument to sign
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-29 16:34:21 -07:00
Ying Li f9019873a6 Merge pull request #243 from endophage/key_types
creating concrete types for the various key ciphers
2015-10-29 14:21:33 -07:00
David Lawrence f73560d839 creating concrete types for the various key ciphers
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-28 16:02:55 -07:00
Ying Li 04a78e720f Factor out and test TLS configuration in notary-server.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-28 15:39:52 -07:00
David Lawrence 21ee24bc30 fixing vet error in existing notary code
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 16:37:41 -07:00
David Lawrence 2833a88292 adding gotuf to notary
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 16:36:06 -07:00
Ying Li b238d85159 Add the health handler to the main server
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-26 14:23:48 -07:00
Ying Li bcdd375ce5 Merge pull request #229 from cyli/tls-config-refactor
Factor out TLS configuration code for server and TLS
2015-10-26 09:33:41 -07:00
Ying Li 61f9f84254 Use configuration option structures to set up client TLS and server TLS.
Test for if client cert is passed without a client key and vice versa.
Fail in ConfigureClientTLS if only one of client cert/key is passed.
Lint fixes.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-21 18:43:33 -07:00
David Lawrence 8a996f417a updating godeps and notary for some syntax changes in gotuf brought on by golint
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-20 23:56:35 -07:00
Ying Li 8d96cf0c1f Use ConfigureServerTLS for notary-server and notary-signer
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-19 17:29:54 -07:00
Ying Li 272f442fee Use an anonymous interface instead, thanks @endophage
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-14 11:33:45 -07:00
Ying Li 79066c3403 Just drop the test tables when they should not exist
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-14 11:30:34 -07:00
Ying Li 7f0078d513 Define interface for iterating through gorm models by table name
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-14 11:30:04 -07:00
Ying Li e786d62f0f Check for duplicate key errors in both mysql and sqlite3 in server/db
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-13 17:04:24 -07:00
Ying Li ba4e596457 Move the testing.T module to be the first argument to helper functions.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-13 16:19:17 -07:00
Ying Li 09a041be14 Use more idiomatic go in if conditions.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-13 16:18:59 -07:00
Ying Li 9290507a1f In server/storage/database, do not panic, and also return the right error.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-13 15:56:45 -07:00
Ying Li 517dd4bbd0 Rename MySQL to SQL in server DB tests
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-13 11:28:57 -07:00
Ying Li df95dc4564 Add a DB health check to the server storage DB
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-13 11:28:14 -07:00
Ying Li 85a447f701 Clean up SQLStorage docstring to refer to the model
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-12 17:10:33 -07:00
Ying Li 7fa991c3ff Gormizes the server database and make it SQL-DB agnostic.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-12 16:45:41 -07:00
Ying Li e8528ec391 Attempt to match the model exactly up with the initial sql + the
migrate sql.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-12 15:44:00 -07:00
Ying Li 1bb1f1acd2 Refactor server/storage models to use gorm.Model and to be in their
file.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-12 14:28:20 -07:00
Ying Li 01f7adc80c Document the intended behavior of each function in the storage
interface.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-10 18:44:44 -07:00
Ying Li 99cac889b1 Add some more tests for storing TUF files in the db
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-09 22:48:21 -07:00
Ying Li 5f70699937 Add more tests for UpdateCurrent
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-09 12:19:17 -07:00
Ying Li 31bb0b0525 Do more verifications on the server store DB tests using gorm
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-08 23:20:48 -07:00
Ying Li 06e21a234c Convert server/storage/database tests to use SQLite3
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-08 16:42:05 -07:00
Jessica Frazelle 74b4ef064c change canonical json package
update godeps for gotuf and canonical json

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-09-03 20:11: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
David Lawrence 6616bed616 validation tests
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-08-06 17:38:37 -07:00
David Lawrence 0ece438313 server side validation during updates
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-08-05 14:00:07 -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
David Lawrence efda5034d9 can't be so restrictive on notary's GUN matching in URLs
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-31 14:38:24 -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
Diogo Mónica 149ba6fd0f Merge pull request #157 from docker/configurable_key_algo
make key algorithm configurable for local development with in memory …
2015-07-30 13:36:01 -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
Derek McGowan f9c63780b7 Use gotuf expires function
The gotuf library defines a function to check expiration of timestamps which notary will make use of.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-29 17:11:56 -07:00
Diogo Mónica 383f51134e Merge pull request #131 from docker/diogo-env-passphrases
Adding support for passphrases from env
2015-07-27 17:43:59 -07:00
Diogo Monica b9dd9efe12 Adding default timestamp key to be ECDSA
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-27 17:35:30 -07:00
Aaron Lehmann 02dfdaf197 Use correct regular expression for repository names in HTTP handlers
Import github.com/docker/distribution/registry/api/v2 to share the
regexps that the registry API uses.

Remove ErrUnauthorized in errors package, since it conflicts with one
defined in v2.

Fixes #92

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-27 14:51:59 -07:00
David Lawrence 47f651ef8a fixing timestamp key retrieval
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-24 18:05:46 -07:00
Diogo Monica a0f5411bcf Remove old GORM attempt from server
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 05:47:01 -07:00
David Lawrence ee383ced9c adding db queries
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-24 14:35:45 -07:00
Diogo Monica 85898a578d Removing Writing data debug line
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-22 23:41:18 -07:00
David Lawrence b44e835275 update default expiry times to those agreed on
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-20 14:59:19 -07:00