mirror of
https://github.com/moul/sshportal.git
synced 2025-09-06 20:54:27 +08:00
Add log for exec request.
This commit is contained in:
parent
980da40988
commit
e141368734
2 changed files with 10 additions and 0 deletions
|
@ -174,6 +174,11 @@ func pipe(lreqs, rreqs <-chan *gossh.Request, lch, rch gossh.Channel, logsLocati
|
|||
return nil
|
||||
}
|
||||
b, err := rch.SendRequest(req.Type, req.WantReply, req.Payload)
|
||||
if req.Type == "exec" {
|
||||
command := append(req.Payload, []byte("\n")...)
|
||||
wrappedlch.LogWrite(command)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
5
vendor/github.com/arkan/bastion/pkg/logchannel/logchannel.go
generated
vendored
5
vendor/github.com/arkan/bastion/pkg/logchannel/logchannel.go
generated
vendored
|
@ -42,6 +42,11 @@ func (l *logChannel) Write(data []byte) (int, error) {
|
|||
return l.channel.Write(data)
|
||||
}
|
||||
|
||||
func (l *logChannel) LogWrite(data []byte) (int, error) {
|
||||
writeTTYRecHeader(l.writer, len(data))
|
||||
return l.writer.Write(data)
|
||||
}
|
||||
|
||||
func (l *logChannel) Close() error {
|
||||
l.writer.Close()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue