Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
env.sh
vendor/
33 changes: 32 additions & 1 deletion cmd/sneaker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import (
"strings"
"text/tabwriter"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kms"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/codahale/sneaker"
"github.com/docopt/docopt-go"
docopt "github.com/docopt/docopt-go"
"github.com/tydavis/gobundledhttp"
)

const usage = `sneaker manages secrets.
Expand Down Expand Up @@ -219,6 +221,35 @@ func loadManager() *sneaker.Manager {
log.Fatalf("bad SNEAKER_MASTER_CONTEXT: %s", err)
}

profile := os.Getenv("AWS_PROFILE")
if profile != "" {
// Set up a full session
conf := aws.NewConfig()
// Create http client with timeout so aws package does not share default http
// client
conf.WithHTTPClient(gobundledhttp.NewClient())

s, e := session.NewSessionWithOptions(session.Options{
Config: *conf,
SharedConfigState: session.SharedConfigEnable,
Profile: profile,
})
if e != nil {
log.Fatalf("Unable to create session for %s: %v \n", profile, e)
}

// Use an aws profile
return &sneaker.Manager{
Objects: s3.New(s),
Envelope: sneaker.Envelope{
KMS: kms.New(s),
},
Bucket: u.Host,
Prefix: u.Path,
EncryptionContext: ctxt,
KeyId: os.Getenv("SNEAKER_MASTER_KEY"),
}
}
return &sneaker.Manager{
Objects: s3.New(session.New()),
Envelope: sneaker.Envelope{
Expand Down
15 changes: 15 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/codahale/sneaker

require (
github.com/aws/aws-sdk-go v0.0.0-20160824230750-e39222bf4583
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/go-ini/ini v1.41.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
github.com/stretchr/testify v1.3.0 // indirect
github.com/tydavis/gobundledhttp v0.0.0-20181128012025-09f72992a598
gopkg.in/ini.v1 v1.41.0 // indirect
)
27 changes: 27 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
github.com/aws/aws-sdk-go v0.0.0-20160824230750-e39222bf4583 h1:DPf62FOau6pMY4UFoBNku2nxremPcqAQfN0au9dzoKk=
github.com/aws/aws-sdk-go v0.0.0-20160824230750-e39222bf4583/go.mod h1:ZRmQr0FajVIyZ4ZzBYKG5P3ZqPz9IHG41ZoMu1ADI3k=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/go-ini/ini v1.41.0 h1:526aoxDtxRHFQKMZfcX2OG9oOI8TJ5yPLM0Mkno/uTY=
github.com/go-ini/ini v1.41.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tydavis/gobundledhttp v0.0.0-20181128012025-09f72992a598 h1:+ugUN0MCFP34HiS4V6JojfCSL33jWV9jfUha0ARgdtA=
github.com/tydavis/gobundledhttp v0.0.0-20181128012025-09f72992a598/go.mod h1:eeDGjKa8OHqCW/AD/iv9ssysLHH3ckL/YxRvLgXydQg=
gopkg.in/ini.v1 v1.41.0 h1:Ka3ViY6gNYSKiVy71zXBEqKplnV35ImDLVG+8uoIklE=
gopkg.in/ini.v1 v1.41.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
202 changes: 202 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/NOTICE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading