Skip to content

Commit

Permalink
Make --insecure-registry work with TLS registries whose certs we can'…
Browse files Browse the repository at this point in the history
…t verify.
  • Loading branch information
Evan Anderson committed Jul 27, 2021
1 parent c014ec1 commit cf4ed82
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/publish/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package publish

import (
"crypto/tls"
"fmt"
"log"
"net/http"
"path"
Expand Down Expand Up @@ -105,6 +107,17 @@ func WithTagOnly(tagOnly bool) Option {
func Insecure(b bool) Option {
return func(i *defaultOpener) error {
i.insecure = b
t, ok := i.t.(*http.Transport)
if !ok {
return fmt.Errorf("unable to configure insecure roundtripper (not HTTP)")
}
t = t.Clone()
if t.TLSClientConfig == nil {
t.TLSClientConfig = &tls.Config{}
}
t.TLSClientConfig.InsecureSkipVerify = b // #nosec
i.t = t

return nil
}
}

0 comments on commit cf4ed82

Please sign in to comment.