11package main
22
33import (
4+ "crypto/tls"
45 "encoding/base64"
56 "encoding/json"
67 "fmt"
@@ -10,6 +11,8 @@ import (
1011 "os"
1112 "strings"
1213 "time"
14+
15+ log "github.com/sirupsen/logrus"
1316)
1417
1518const bearerPrefix = "Bearer "
@@ -127,7 +130,14 @@ func ParseImageReference(ref string) ImageReference {
127130// NewRegistryClient creates a new registry client
128131func NewRegistryClient () * RegistryClient {
129132 return & RegistryClient {
130- httpClient : & http.Client {Timeout : 300 * time .Second },
133+ httpClient : & http.Client {
134+ Timeout : 300 * time .Second ,
135+ Transport : & http.Transport {
136+ TLSClientConfig : & tls.Config {
137+ MinVersion : tls .VersionTLS12 ,
138+ },
139+ },
140+ },
131141 }
132142}
133143
@@ -217,7 +227,8 @@ func (c *RegistryClient) fetchToken(realm, service, scope string, creds Registry
217227
218228 if resp .StatusCode != http .StatusOK {
219229 body , _ := io .ReadAll (io .LimitReader (resp .Body , 4096 ))
220- return "" , fmt .Errorf ("authentication failed: %d - %s" , resp .StatusCode , string (body ))
230+ log .WithField ("response_body" , string (body )).WithField ("status_code" , resp .StatusCode ).Debug ("Authentication request failed" )
231+ return "" , fmt .Errorf ("authentication failed with status %d" , resp .StatusCode )
221232 }
222233
223234 var tokenResp struct {
0 commit comments