Skip to content

Commit

Permalink
Add HTTP fallback to all insecure registries
Browse files Browse the repository at this point in the history
Note that while it is not safe to use http fallback on non-localhost
registries, this can be avoided using the new host directories. The
previous legacy insecure configuration is ambiguous and less secure.

Signed-off-by: Derek McGowan <derek@mcg.dev>
  • Loading branch information
dmcgowan committed Apr 22, 2024
1 parent 2cbe40a commit 4e5cf6d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions daemon/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,14 @@ func (daemon *Daemon) mergeLegacyConfig(host string, hosts []docker.RegistryHost
}
if daemon.registryService.IsInsecureRegistry(hosts[i].Host) {
if t.TLSClientConfig != nil {
isLocalhost, err := docker.MatchLocalhost(hosts[i].Host)
if err != nil {
continue
}
if isLocalhost {
hosts[i].Client.Transport = docker.HTTPFallback{RoundTripper: hosts[i].Client.Transport}
}
t.TLSClientConfig.InsecureSkipVerify = true
} else {
hosts[i].Scheme = "http"
t.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
}

hosts[i].Client.Transport = docker.HTTPFallback{RoundTripper: hosts[i].Client.Transport}
}
}
return hosts, nil
Expand Down

0 comments on commit 4e5cf6d

Please sign in to comment.