Skip to content

Commit

Permalink
Enable password read from stdin. Closes 47 (#49)
Browse files Browse the repository at this point in the history
* Enable password read from stdin
* Get bazel to build binary
* update bazel version in .travis.yml
* Update readme, about pipe command shortcoming
  • Loading branch information
vj396 committed Mar 10, 2020
1 parent 91accf8 commit 067bd85
Show file tree
Hide file tree
Showing 308 changed files with 226,649 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ os:
- linux

env:
- V=0.18.0
- V=2.2.0

before_install:
- |
Expand Down
Empty file added BUILD.bazel
Empty file.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ username: blake
password: test
```

**NOTE**: if you do not have the password saved in `~/.collins.yml`, the client will prompt for a password at runtime. But, this will error and fail, if the collins command is being piped from one collins command to next.

### Documentation

All docs can be found in markdown under `collins/docs/`.
20 changes: 16 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"],
sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
],
sha256 = "e6a6c016b0663e06fa5fccf1cd8152eab8aa8180c583ec20c872f4f9953a7ac5",
)

http_archive(
name = "bazel_gazelle",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"],
sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
],
sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10",
)

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
Expand Down Expand Up @@ -135,3 +141,9 @@ go_repository(
importpath = "bou.ke/monkey",
tag = "v1.0.1",
)

go_repository(
name = "org_golang_x_crypto",
importpath = "golang.org/x/crypto",
commit = "78000ba7a073cafc0278790f6bce552a0f25850e",
)
1 change: 1 addition & 0 deletions collins/commands/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go_library(
"@com_github_urfave_cli//:go_default_library",
"@in_gopkg_tumblr_go_collins_v0//collins:go_default_library",
"@in_gopkg_yaml_v2//:go_default_library",
"@org_golang_x_crypto//ssh/terminal:go_default_library",
],
)

Expand Down
11 changes: 11 additions & 0 deletions collins/commands/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (
"math"
"os"
"strconv"
"syscall"

cli "github.com/urfave/cli"
"golang.org/x/crypto/ssh/terminal"
collins "gopkg.in/tumblr/go-collins.v0/collins"
)

Expand Down Expand Up @@ -69,6 +71,15 @@ func getCollinsClient(c *cli.Context) *collins.Client {
}

collins, err := collins.NewClientFromYaml()
if collins.Password == "" {
fmt.Print("Enter Password: ")
bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
fmt.Println("error reading password from terminal")
logAndDie(err.Error())
}
collins.Password = string(bytePassword)
}
if err != nil {
fmt.Println("You can use COLLINS_CLIENT_CONFIG env or --config to set the location of your config")
logAndDie(err.Error())
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e
github.com/stretchr/testify v1.3.0 // indirect
github.com/urfave/cli v1.20.0
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/tumblr/go-collins.v0 v0.0.0-20190208222215-7e5500a55e4d
gopkg.in/yaml.v2 v2.2.2
Expand Down
12 changes: 8 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ github.com/schallert/iso8601 v0.0.0-20151102174922-d51701471974/go.mod h1:AEfUJw
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/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/tumblr/go-collins.v0 v0.0.0-20190208222215-7e5500a55e4d h1:rqSyNl+OH+kbvxtpoO/1McGDS398WlNziBNASj7XH74=
gopkg.in/tumblr/go-collins.v0 v0.0.0-20190208222215-7e5500a55e4d/go.mod h1:AiySIr6v4BI2WdR8/iI5ogsbDTCSG+pviHvwLuuGvog=
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
3 changes: 3 additions & 0 deletions vendor/golang.org/x/crypto/AUTHORS

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

3 changes: 3 additions & 0 deletions vendor/golang.org/x/crypto/CONTRIBUTORS

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

27 changes: 27 additions & 0 deletions vendor/golang.org/x/crypto/LICENSE

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

22 changes: 22 additions & 0 deletions vendor/golang.org/x/crypto/PATENTS

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

Loading

0 comments on commit 067bd85

Please sign in to comment.