Commit Graph

58 Commits

Author SHA1 Message Date
Ying Li ef5d62a503 Address code reviews and make the server endpoint list easier to read.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-05-23 13:09:36 -07:00
Ying Li b4b2e51502 Update the server to reject operations on images which do not match the prefix.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-05-20 11:21:00 -05:00
Ying Li e25746dac3 Use a CacheControlHandler that wraps other handlers instead
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-14 17:19:13 -07:00
David Lawrence cb2dd07edc the server was not setting the longer snapshot expiry time. When generating a timestamp it was also retriving the snapshot directly from the database and only validating the checksum still matched what was in the timestamp. Due to the addition of consistent downloads, this mean a new snapshot never got generated. It is necessary for GetOrCreateTimestamp to call GetOrCreateSnapshot to ensure a new snapshot is generated as and when required
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-24 15:51:31 -08:00
David Lawrence 905cbb7852 Merge pull request #531 from endophage/metrics_url
update metrics endpoint
2016-02-02 10:33:40 -08:00
David Lawrence f26a5c3c57 update metrics endpoint
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-02 09:52:43 -08:00
David Lawrence 637a2331d4 client side of consistent downloads
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-29 16:52:58 -08:00
David Lawrence d38d7ceb89 moving checksum after role in urls. We're breaking with spec for an easier to manage filename system
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
David Lawrence 4738760794 get by checksum
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
David Lawrence 6f7acb6ddf adding server logic for clients to request consistent TUF files
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
David Lawrence f72f799806 fixing up ListTargets and GetTargetByName to process prioritized roles more efficiently
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 14:56:05 -08:00
David Lawrence 4a9ebb8bc8 adding test for ListTargets with delegation
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 10:09:34 -08:00
Ying Li 4208945fc1 Move the notary errors HTTP errors into the server package.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-09 11:22:49 -08:00
Ying Li d59ae2d90f Add the handler for GET-ting a snapshot key.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-07 15:13:58 -08:00
David Lawrence a1ec8c69e0 unify the timestamp handler with the handler for getting other tuf metadata
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-02 15:50:54 -08:00
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
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 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 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 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
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
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
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
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 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
Diogo Monica 3b261e8972 Removing comments
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-20 10:08:15 -07:00
David Lawrence b561f347ed updating errors to use distribution's errcode package
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-17 18:02:56 -07:00
David Lawrence c39a218a40 Merge pull request #51 from dmcgowan/add-ping-endpoint
Add ping endpoint
2015-07-17 17:55:22 -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
Derek McGowan 93dc0285bc Add ping endpoint
Ping endpoint added so clients can get the list of authentication challenges before making an initial request.
Updated MainHandler to return JSON object instead of a string.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-14 14:08:12 -07:00
David Lawrence ec08d28610 provide an additional handler to allow clients to update any set of TUF metadata atomically
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-13 18:18:33 -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 682e7ea00b Fixing lint
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-09 17:58:55 -07:00
David Lawrence 89379a728c adding timestamping and some general cleanup
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-03 15:38:09 -07:00
David Lawrence 0f1e8b0134 adding delete to server
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-06-21 16:37:30 -07:00
Nathan McCauley 518d0a2702 Notary Server in server log messages
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-06-19 11:17:06 -07:00
Nathan McCauley e46a95227c rename vetinari to notary
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-06-19 11:01:19 -07:00
David Lawrence 322f60b1ba tuf push working 2015-06-17 22:10:07 -07:00
David Lawrence 801dd397ff runs with basic setup for demo 2015-06-16 12:17:40 -07:00
David Lawrence cc0782d3d2 rewriting imports to 'gotuf', adding config to set log level, making
restart/shutdown cleanup connections after timeout, updating godeps
2015-06-11 16:30:25 -07:00
David Lawrence 4508a1db9a fixing server tests 2015-05-12 16:06:30 -07:00
David Lawrence 4b39bf0c97 changing over logging to logrus 2015-05-12 11:11:39 -07:00
Diogo Monica 0f6c4799aa Changing compose and logging 2015-04-28 22:53:09 -07:00
David Lawrence b858e939a3 couple of fixes for demo 2015-04-28 13:47:50 -07:00
Nathan McCauley 2106645af9 gofmt updates 2015-04-28 11:28:30 -07:00
Nathan McCauley faeed37c22 print debugging on failure to load keys, correct cert paths 2015-04-28 11:22:10 -07:00
Nathan McCauley 95adc15e36 debugging stuffz 2015-04-28 11:22:10 -07:00