From be3b49e670ccb5d10c20202b8161074578f3cd14 Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Tue, 13 Jan 2015 13:55:46 -0800 Subject: [PATCH] fetch/run: use nil keystore w/InsecureSkipVerify The cas decides whether to retrieve the signature based on whether the supplied *keystore.Keystore is non-nil; however, we were not properly passing a nil Keystore through in the case that InsecureSkipVerify is set, so it was still attempting to retrieve a signature in this case. --- rkt/fetch.go | 3 +-- rkt/rkt.go | 9 +++++++++ rkt/run.go | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rkt/fetch.go b/rkt/fetch.go index 9db92a6..00b80d0 100644 --- a/rkt/fetch.go +++ b/rkt/fetch.go @@ -53,8 +53,7 @@ func runFetch(args []string) (exit int) { } ds := cas.NewStore(globalFlags.Dir) - ks := keystore.New(nil) - + ks := getKeystore() for _, img := range args { hash, err := fetchImage(img, ds, ks) if err != nil { diff --git a/rkt/rkt.go b/rkt/rkt.go index e42aa20..20d1a91 100644 --- a/rkt/rkt.go +++ b/rkt/rkt.go @@ -20,6 +20,8 @@ import ( "os" "path/filepath" "text/tabwriter" + + "github.com/coreos/rocket/pkg/keystore" ) const ( @@ -113,3 +115,10 @@ func containersDir() string { func garbageDir() string { return filepath.Join(globalFlags.Dir, "garbage") } + +func getKeystore() *keystore.Keystore { + if globalFlags.InsecureSkipVerify { + return nil + } + return keystore.New(nil) +} diff --git a/rkt/run.go b/rkt/run.go index 62bd54e..d692f7f 100644 --- a/rkt/run.go +++ b/rkt/run.go @@ -121,7 +121,7 @@ func runRun(args []string) (exit int) { } ds := cas.NewStore(globalFlags.Dir) - ks := keystore.New(nil) + ks := getKeystore() imgs, err := findImages(args, ds, ks) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err)