Refactor TLS code with a new tlsconfig package#13636
Conversation
|
do we really need a new package just for this configuration? maybe it should live within the |
|
@calavera in my opinion, yes. |
pkg/tlsutil/config.go
Outdated
There was a problem hiding this comment.
I find this weird but it was like that: https://github.com/docker/docker/pull/13636/files#diff-d6f439c36bc4930ab43c13d5ad3868d2L58
I wonder if this shouldn't be if ca != "" && verify {, on the other hand, why would you provide a CA if you don't want to verify the certificate.
There was a problem hiding this comment.
The verify flag has no meaning in this context, if the CA is provided the client should always be verified against it. Using require any client certificate has no value unless you plan on using the certificate for something else after after the handshake.
|
I don't see any issues with this. LGTM |
|
/cc @ehazlett @nathanleclaire for machine |
|
Yes!! Thanks! On Monday, June 1, 2015, Andrea Luzzardi notifications@github.com wrote:
|
docker/docker.go
Outdated
There was a problem hiding this comment.
I think this is why you have a broken CI test on janky.. currently TestRunTLSverify assumes that specifying --tls-verify without enabling tls will cause a docker run failure, but it isn't anymore.
There was a problem hiding this comment.
yes fixing now :) Thanks!
|
Nice. |
5ddf913 to
5a9f05e
Compare
pkg/tlsutil/config.go
Outdated
There was a problem hiding this comment.
@dmcgowan verify is never used here, should we remove it?
There was a problem hiding this comment.
I vote remove it, it is unused and without meaning
api/server/server.go
Outdated
|
@tiborvass This looks like a good change. I would prefer to call it |
|
@aluzzardi @stevvooe I can rename it to |
tlsutil packagetlsconfig package
|
Renamed the package from |
|
There are still a few docs and naming issues but they don't matter. LGTM! |
pkg/tlsconfig/config.go
Outdated
There was a problem hiding this comment.
(OCD warning ;-)) change to "Could not load ...", to be consistent with the other errors? (Don't forget the related test)
82b06b8 to
855db5a
Compare
|
LGTM |
ccb860f to
6460f90
Compare
docker/docker.go
Outdated
There was a problem hiding this comment.
This logic is backwards, it should only check this if the flag is NOT set. When the flag is set, then not exists should cause an error later on. This should only check if the default file exists if the flag is not set.
There was a problem hiding this comment.
nice catch... fixing
|
@jfrazelle Still LGTM for you? |
|
re LGTM |
|
Waiting on CI. |
|
I'm testing the actual options based on the docs list of supported settings. But if someone else has already finished that then I'm fine with the existing LGTMs Sent from my iPhone
|
|
Well, tests fail: back to |
This patch creates a new `tlsconfig` package to handle creation of secure-enough TLS configurations for clients and servers. The package was created by refactoring TLS code in the client and the daemon. After this patch, it is expected that all code creating TLS configurations use this `tlsconfig` package for greater security, consistency and readability. On the server side, this fixes a bug where --tlsverify was not taken into account. Now, if specified, it will require the client to authenticate. Signed-off-by: Tibor Vass <tibor@docker.com>
|
Fixed the failing test. |
|
LGTM |
Refactor TLS code with a new `tlsconfig` package
|
Great. LGTM, although I'd love to see the server and client have separate defaults. That could easily come in a follow-up patch. |
This patch creates a new
tlsconfigpackage to handle creation ofsecure-enough TLS configurations for clients and servers.
The package was created by refactoring TLS code in the client and the
daemon. After this patch, it is expected that all code creating TLS
configurations use this
tlsconfigpackage for greater security,consistency and readability.
On the server side, this fixes a bug where --tlsverify was not taken
into account. Now, if specified, it will require the client to
authenticate.
Signed-off-by: Tibor Vass tibor@docker.com
Note: this patch does not modify code under
registry/although it is expected for other patches touching code that creates TLS configurations (includingregistry/), to reuse thistlsconfigpackage.Ping @diogomonica @NathanMcCauley @dmcgowan @docker/core-maintainers