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 26, 2024
1 parent 725e55d commit 5abfc63
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.NewHTTPFallback(hosts[i].Client.Transport)
}
t.TLSClientConfig.InsecureSkipVerify = true
} else {
hosts[i].Scheme = "http"
t.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
}

hosts[i].Client.Transport = docker.NewHTTPFallback(hosts[i].Client.Transport)
}
}
return hosts, nil
Expand Down

0 comments on commit 5abfc63

Please sign in to comment.