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
2
2
3
3
import (
4
4
"context"
5
+ "encoding/base64"
5
6
"errors"
6
7
"fmt"
7
8
"net"
@@ -29,6 +30,8 @@ var DefaultChannelHandlers = map[string]ChannelHandler{
29
30
"session" : DefaultSessionHandler ,
30
31
}
31
32
33
+ var permissionsPublicKeyExt = "gliderlabs/ssh.PublicKey"
34
+
32
35
// Server defines parameters for running an SSH server. The zero value for
33
36
// Server is a valid configuration. When both PasswordHandler and
34
37
// PublicKeyHandler are nil, no client authentication is performed.
@@ -162,7 +165,10 @@ func (srv *Server) config(ctx Context) *gossh.ServerConfig {
162
165
if ok := srv .PublicKeyHandler (ctx , key ); ! ok {
163
166
return ctx .Permissions ().Permissions , fmt .Errorf ("permission denied" )
164
167
}
165
- ctx .SetValue (ContextKeyPublicKey , key )
168
+
169
+ pkStr := base64 .StdEncoding .EncodeToString (key .Marshal ())
170
+ ctx .Permissions ().Permissions .Extensions [permissionsPublicKeyExt ] = pkStr
171
+
166
172
return ctx .Permissions ().Permissions , nil
167
173
}
168
174
}
You can’t perform that action at this time.
0 commit comments