aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2020-04-13 23:57:13 -0400
committerBen Burwell <ben@benburwell.com>2020-04-13 23:57:13 -0400
commit2ce3b86e0ff69538935db3149d1ed2f24aea09a3 (patch)
tree1c0329a5c1191690e57e7160bd3150c9a2851866 /client
parent8b1ee3e95010681d98d1b31af98f0ce0832cedd2 (diff)
Simplify
Diffstat (limited to 'client')
-rw-r--r--client/client.go24
1 files changed, 1 insertions, 23 deletions
diff --git a/client/client.go b/client/client.go
index b84e09a..22194d2 100644
--- a/client/client.go
+++ b/client/client.go
@@ -1,7 +1,6 @@
package client
import (
- "bufio"
"bytes"
"crypto/tls"
"encoding/base64"
@@ -11,9 +10,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
- "os"
"path"
- "strings"
"time"
"github.com/nsheridan/cashier/lib"
@@ -22,10 +19,6 @@ import (
"golang.org/x/crypto/ssh/agent"
)
-var (
- errNeedsReason = errors.New("reason required")
-)
-
// SavePublicFiles installs the public part of the cert and key.
func SavePublicFiles(prefix string, cert *ssh.Certificate, pub ssh.PublicKey) error {
if prefix == "" {
@@ -114,9 +107,6 @@ func send(sr *lib.SignRequest, token, ca string, ValidateTLSCertificate bool) (*
defer resp.Body.Close()
signResponse := &lib.SignResponse{}
if resp.StatusCode != http.StatusOK {
- if resp.StatusCode == http.StatusForbidden && strings.HasPrefix(resp.Header.Get("X-Need-Reason"), "required") {
- return signResponse, errNeedsReason
- }
return signResponse, fmt.Errorf("bad response from server: %s", resp.Status)
}
if err := json.NewDecoder(resp.Body).Decode(signResponse); err != nil {
@@ -125,15 +115,6 @@ func send(sr *lib.SignRequest, token, ca string, ValidateTLSCertificate bool) (*
return signResponse, nil
}
-func promptForReason() (message string) {
- fmt.Print("Enter message: ")
- scanner := bufio.NewScanner(os.Stdin)
- if scanner.Scan() {
- message = scanner.Text()
- }
- return message
-}
-
// Sign sends the public key to the CA to be signed.
func Sign(pub ssh.PublicKey, token string, conf *Config) (*ssh.Certificate, error) {
var err error
@@ -152,10 +133,7 @@ func Sign(pub ssh.PublicKey, token string, conf *Config) (*ssh.Certificate, erro
if err == nil {
break
}
- if err != nil && err == errNeedsReason {
- s.Message = promptForReason()
- continue
- } else if err != nil {
+ if err != nil {
return nil, errors.Wrap(err, "error sending request to CA")
}
}