File tree Expand file tree Collapse file tree
packages/pam/handlers/ssh Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,30 +286,27 @@ func (p *SSHProxy) handleChannelRequests(requests <-chan *ssh.Request, targetCha
286286 if len (req .Payload ) >= 4 + cmdLen {
287287 command := string (req .Payload [4 : 4 + cmdLen ])
288288
289- // Determine the type of operation for better logging
290- opType := "exec"
289+ // Determine the type of operation
290+ isSCP := strings . HasPrefix ( command , "scp " )
291291 chState .mutex .Lock ()
292- chState .channelType = session .TerminalChannelExec
293- if strings .HasPrefix (command , "scp " ) {
294- opType = "scp"
292+ if isSCP {
295293 // Mark this channel as binary so we don't log the raw file data
296294 chState .isBinarySession = true
297295 chState .channelType = session .TerminalChannelSFTP // SCP is file transfer
298- } else if strings . Contains ( command , "sftp" ) {
299- opType = "sftp"
296+ } else {
297+ chState . channelType = session . TerminalChannelExec
300298 }
301299 chState .mutex .Unlock ()
302300
303301 log .Info ().
304302 Str ("sessionID" , sessionID ).
305303 Str ("command" , command ).
306- Str ("opType" , opType ).
307304 Msg ("SSH exec command" )
308305
309306 // Log the exec command to the session recording
310307 var logMessage string
311308 var channelType session.TerminalChannelType
312- if opType == "scp" {
309+ if isSCP {
313310 channelType = session .TerminalChannelSFTP
314311 // Parse SCP command for more readable logging
315312 // scp -t /path = receiving file TO server
You can’t perform that action at this time.
0 commit comments