Fixed #56 - x509: certificate signed by unknown authority (macOS)

This commit is contained in:
Stanley Shyiko
2017-02-27 21:43:32 -08:00
parent 4bebc92e83
commit bb50334dac
3 changed files with 20 additions and 3 deletions
Generated
+5 -3
View File
@@ -1,6 +1,8 @@
hash: e1986c4228684b36aa21e7d2dc1847d2df8a617d68b05e5963d08f934eeabd5b
updated: 2016-10-02T19:48:08.191307746-07:00
hash: a43628af8a74048156fb6184a2065f2ee2445810e0c6f06c647b66c9a960fb4b
updated: 2017-02-27T18:10:41.882588613-08:00
imports:
- name: github.com/hashicorp/go-rootcerts
version: 6bb64b370b90e7ef1fa532be9e591a81c3493e00
- name: github.com/inconshreveable/mousetrap
version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
- name: github.com/mitchellh/go-homedir
@@ -21,4 +23,4 @@ imports:
- unix
- name: gopkg.in/yaml.v2
version: a5b47d31c556af34a302ce5d659e6fea44d90de0
devImports: []
testImports: []
+1
View File
@@ -7,3 +7,4 @@ import:
- package: github.com/mitchellh/go-homedir
- package: github.com/mitchellh/ioprogress
- package: gopkg.in/yaml.v2
- package: github.com/hashicorp/go-rootcerts
+14
View File
@@ -2,8 +2,10 @@ package main
import (
"bytes"
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
"os"
"sort"
"strings"
@@ -11,6 +13,7 @@ import (
yaml "gopkg.in/yaml.v2"
log "github.com/Sirupsen/logrus"
rootcerts "github.com/hashicorp/go-rootcerts"
"github.com/shyiko/jabba/command"
"github.com/shyiko/jabba/semver"
"github.com/spf13/cobra"
@@ -24,6 +27,17 @@ func init() {
log.SetFormatter(&simpleFormatter{})
// todo: make it configurable through the command line
log.SetLevel(log.InfoLevel)
tlsConfig := &tls.Config{}
err := rootcerts.ConfigureTLS(tlsConfig, &rootcerts.Config{
CAFile: os.Getenv("JABBA_CAFILE"),
CAPath: os.Getenv("JABBA_CAPATH"),
})
if err != nil {
log.Fatal(err)
}
defTransport := http.DefaultTransport.(*http.Transport)
defTransport.TLSClientConfig = tlsConfig
}
type simpleFormatter struct{}