-
Couldn't load subscription status.
- Fork 146
discovery: add insecureTls flag to skip TLS checks #551
discovery: add insecureTls flag to skip TLS checks #551
Conversation
7600119 to
fe1d9d1
Compare
|
Should we use bit flags rather than separate bools or are we pretty confident these are the only two there'll ever be? |
|
@jonboulle: As stated in #545 by @alban - we will likely need three flags - one for allowing connections over unencrypted HTTP, one for skipping TLS certificates verification and one for allowing credentials passing over insecure connections (either HTTP or HTTPS with unverified TLS certificates). So I guess it would be better to have bit flags. Another solution, quicker and less dirty than 3 bools, would be separate bool-like, self-documenting types (like in https://github.com/coreos/rkt/blob/master/rkt/pubkey/pubkey.go#L42) |
discovery/http.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably do a shallow copy of http.DefaultTransport and modify the TLSClientConfig field.
tInsecureTls := *http.DefaultTransport
tInsecureTls.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
ClientInsecureTls = &http.Client{
Transport: &tInsecureTls,
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
|
This PR doesn't allow to skip sending credentials over HTTP. |
fe1d9d1 to
29bafaa
Compare
|
Updated with a bit field for
Can this be done separately? Now that it is a bitfield, it should be possible to add after without changing the function prototype. |
actool/discover.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about insecure := discovery.InsecureNone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
|
Looks fine, but the testing is not sufficient. |
29bafaa to
296ac04
Compare
The "insecure" bool was previously used to allow http. This is now changed to a bit field with "InsecureHttp" and "InsecureTls". Related to appc#545
296ac04 to
dec3590
Compare
|
@krnowak ready for another review :) |
discovery/discovery_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle the case when err == nil and tt.expectDiscoverySuccess == false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixed in a separate commit.
|
One question, but otherwise LFAD. But won't merge it anyway, I have no power here. |
The test cases where a failure was expected was not tested correctly.
|
Branch updated. |
|
@jonboulle can you review this? :) |
|
thanks! |
discovery: add insecureTls flag to skip TLS checks
|
For the record, this is in v0.7.4 |
The "insecure" was previously used to allow http. This is now split into
two flags "insecureHttp" and "insecureTls".
Related to #545
/cc @krnowak
I will need this for tests in rkt, see rkt/rkt#1822.