File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package ssh
22
33import (
44 "context"
5+ "encoding/base64"
56 "errors"
67 "fmt"
78 "net"
@@ -29,6 +30,8 @@ var DefaultChannelHandlers = map[string]ChannelHandler{
2930 "session" : DefaultSessionHandler ,
3031}
3132
33+ var permissionsPublicKeyExt = "gliderlabs/ssh.PublicKey"
34+
3235// Server defines parameters for running an SSH server. The zero value for
3336// Server is a valid configuration. When both PasswordHandler and
3437// PublicKeyHandler are nil, no client authentication is performed.
@@ -162,7 +165,10 @@ func (srv *Server) config(ctx Context) *gossh.ServerConfig {
162165 if ok := srv .PublicKeyHandler (ctx , key ); ! ok {
163166 return ctx .Permissions ().Permissions , fmt .Errorf ("permission denied" )
164167 }
165- ctx .SetValue (ContextKeyPublicKey , key )
168+
169+ pkStr := base64 .StdEncoding .EncodeToString (key .Marshal ())
170+ ctx .Permissions ().Permissions .Extensions [permissionsPublicKeyExt ] = pkStr
171+
166172 return ctx .Permissions ().Permissions , nil
167173 }
168174 }
You can’t perform that action at this time.
0 commit comments