diff options
author | Bob Long <robertjflong@gmail.com> | 2017-10-17 14:00:37 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-10-17 14:00:37 +0100 |
commit | 7c99874c7a3e7a89716f3ee0cdf696532e35ae35 (patch) | |
tree | c8c47bfb40e6981f4d9f81175512e49703eb985f /server/signer | |
parent | 40c0070d77033c5bc4ab5816e5ffb21517e7603d (diff) |
Support a message to be passed and logged from client to server (#67)
* Support a message to be passed and logged from client to server
Diffstat (limited to 'server/signer')
-rw-r--r-- | server/signer/signer.go | 4 | ||||
-rw-r--r-- | server/signer/signer_test.go | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/server/signer/signer.go b/server/signer/signer.go index 2a8fc98..47ff7c8 100644 --- a/server/signer/signer.go +++ b/server/signer/signer.go @@ -62,6 +62,7 @@ func (s *KeySigner) SignUserKeyFromRPC(req *proto.SignRequest, username string) r := &lib.SignRequest{ Key: string(req.GetKey()), ValidUntil: valid, + Message: string(req.GetMessage()), } return s.SignUserKey(r, username) } @@ -89,6 +90,9 @@ func (s *KeySigner) SignUserKey(req *lib.SignRequest, username string) (*ssh.Cer if err := cert.SignCert(rand.Reader, s.ca); err != nil { return nil, err } + if req.Message != "" { + log.Printf("Message from %s: %s", username, req.Message) + } log.Printf("Issued cert id: %s principals: %s fp: %s valid until: %s\n", cert.KeyId, cert.ValidPrincipals, ssh.FingerprintSHA256(pubkey), time.Unix(int64(cert.ValidBefore), 0).UTC()) return cert, nil } diff --git a/server/signer/signer_test.go b/server/signer/signer_test.go index 726a69b..c07d62b 100644 --- a/server/signer/signer_test.go +++ b/server/signer/signer_test.go @@ -28,6 +28,7 @@ func TestCert(t *testing.T) { r := &lib.SignRequest{ Key: string(testdata.Pub), ValidUntil: time.Now().Add(1 * time.Hour), + Message: "hello world", } cert, err := signer.SignUserKey(r, "gopher1") if err != nil { |