diff --git a/configure.go b/configure.go index 5e651a4b..ed251d90 100644 --- a/configure.go +++ b/configure.go @@ -29,17 +29,17 @@ func doMinioConfigure(c *cli.Context) { log.Fatal("Invalid hostname") } - certFile := c.String("cert") - if certFile == "" { - log.Fatal("invalid certificate") - } - - keyFile := c.String("key") - if keyFile == "" { - log.Fatal("invalid key") - } - /* + certFile := c.String("cert") + if certFile == "" { + log.Fatal("invalid certificate") + } + + keyFile := c.String("key") + if keyFile == "" { + log.Fatal("invalid key") + } + var accessKey, secretKey string var err error accessKey, secretKey, err = parseConfigureInput(c) @@ -51,8 +51,8 @@ func doMinioConfigure(c *cli.Context) { // AccessKey: accessKey, // SecretAccessKey: secretKey, Hostname: hostname, - CertPEM: certFile, - KeyPEM: keyFile, + // CertPEM: certFile, + // KeyPEM: keyFile, } jAuth, err := json.Marshal(auth) diff --git a/minio-api-options.go b/minio-api-options.go index 3fd95c46..822d6404 100644 --- a/minio-api-options.go +++ b/minio-api-options.go @@ -105,7 +105,7 @@ var MinioConfigure = cli.Command{ Name: "configure", Usage: "", Description: `Configure minio client configuration data. If your config - file does not exist (the default location is ~/.s3auth), it will be + file does not exist (the default location is ~/.auth), it will be automatically created for you. Note that the configure command only writes values to the config file. It does not use any configuration values from the environment variables.`, diff --git a/pkg/minio/auth.go b/pkg/minio/auth.go index 0bed26ca..626e3f20 100644 --- a/pkg/minio/auth.go +++ b/pkg/minio/auth.go @@ -3,7 +3,9 @@ package minio import ( "crypto/tls" "io/ioutil" + "net" "net/http" + "time" ) type Auth struct { @@ -35,6 +37,16 @@ func (a *Auth) loadKeys(cert string, key string) (*TlsConfig, error) { } func (a *Auth) getTlsTransport() (*http.Transport, error) { + if a.CertPEM == "" || a.KeyPEM == "" { + return &http.Transport{ + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + }, nil + } + tlsconfig, err := a.loadKeys(a.CertPEM, a.KeyPEM) if err != nil { return nil, err diff --git a/pkg/minio/client.go b/pkg/minio/client.go index f03a81d7..bf1499b7 100644 --- a/pkg/minio/client.go +++ b/pkg/minio/client.go @@ -67,7 +67,7 @@ func (c *Client) hostname() string { // bucketURL returns the URL prefix of the bucket, with trailing slash func (c *Client) bucketURL(bucket string) string { - return fmt.Sprintf("https://%s/%s/", c.hostname(), bucket) + return fmt.Sprintf("http://%s/%s/", c.hostname(), bucket) } func (c *Client) keyURL(bucket, key string) string { @@ -84,7 +84,7 @@ func newReq(url_ string) *http.Request { } func (c *Client) Buckets() ([]*Bucket, error) { - req := newReq("https://" + c.hostname() + "/") + req := newReq("http://" + c.hostname() + "/") res, err := c.transport().RoundTrip(req) if err != nil { return nil, err