Skip to content

[release/1.7] remotes: always try to establish tls connection when tls configured#9188

Merged
estesp merged 1 commit intocontainerd:release/1.7from
dmcgowan:backport-1.7-localhost-http-fallback
Oct 4, 2023
Merged

[release/1.7] remotes: always try to establish tls connection when tls configured#9188
estesp merged 1 commit intocontainerd:release/1.7from
dmcgowan:backport-1.7-localhost-http-fallback

Conversation

@dmcgowan
Copy link
Copy Markdown
Member

@dmcgowan dmcgowan commented Oct 3, 2023

When a endpoint is configured for http and has a tls configuration, always try to the tls connection and fallback to http when the tls connections fails from receiving an http response. This fixes an issue with default localhost endpoints which get defaulted to http with insecure tls also configured but are using tls.

Backport of #9182

Fixes a regression in how localhost is handled with tls

When a endpoint is configured for http and has a tls configuration,
always try to the tls connection and fallback to http when the tls
connections fails from receiving an http response. This fixes an issue
with default localhost endpoints which get defaulted to http with
insecure tls also configured but are using tls.

Signed-off-by: Derek McGowan <[email protected]>
(cherry picked from commit 79772a0)
Signed-off-by: Derek McGowan <[email protected]>
@dcantah
Copy link
Copy Markdown
Member

dcantah commented Oct 4, 2023

/retest

@AkihiroSuda
Copy link
Copy Markdown
Member


var defaultTLSConfig *tls.Config
if options.DefaultTLS != nil {
explicitTLS = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this shouldn't be true when DefaultScheme is "http"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether the InsecureSkipVerify field should be checked?
eg:

if options.DefaultTLS != nil {
	if !options.DefaultTLS.InsecureSkipVerify {
	      explicitTLS = true
	}
	defaultTLSConfig = options.DefaultTLS
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the DefaultScheme only "http" there when explicitly set by the client? The "http" fallback should always be safe, but the tests might not expect that extra connection attempt. If the behavior is explicit from the client, we can keep as false, otherwise maybe we should see if the test could ignore the tls connection attempt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants