Merge pull request #61800 from rithujohn191/remove-gopass

Automatic merge from submit-queue (batch tested with PRs 61818, 61800). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Replace gopass.GetPasswdMasked() by terminal.ReadPassword()

**What this PR does / why we need it**:
Replace `gopass.GetPasswdMasked()` used for reading passwords from the terminal with [`terminal.ReadPassword()`](https://godoc.org/golang.org/x/crypto/ssh/terminal#ReadPassword). This removes the `gopass` import.

**Special notes for your reviewer**:
Ran the following commands to update `godep` files:
```
./hack/godep-restore.sh -v
./hack/godep-save.sh
./hack/update-staging-godeps.sh
./hack/update-bazel.sh
```

/sig auth
/kind enhancement
/assign @ericchiang

```release-note
NONE
```

Kubernetes-commit: a5133305a9f347c79c20c5785d41cc9400be895e
This commit is contained in:
Kubernetes Publisher
2018-04-03 03:28:03 -07:00
42 changed files with 687 additions and 1288 deletions
+8 -3
View File
@@ -23,7 +23,8 @@ import (
"io/ioutil"
"os"
"github.com/howeyc/gopass"
"golang.org/x/crypto/ssh/terminal"
clientauth "k8s.io/client-go/tools/auth"
)
@@ -89,8 +90,12 @@ func promptForString(field string, r io.Reader, show bool) (result string, err e
_, err = fmt.Fscan(r, &result)
} else {
var data []byte
data, err = gopass.GetPasswdMasked()
result = string(data)
if terminal.IsTerminal(int(os.Stdin.Fd())) {
data, err = terminal.ReadPassword(int(os.Stdin.Fd()))
result = string(data)
} else {
return "", fmt.Errorf("error reading input for %s", field)
}
}
return result, err
}