Log shell

This commit is contained in:
Viktor Liu
2025-10-28 18:15:53 +01:00
parent e6854dfd99
commit 576b4a779c
3 changed files with 16 additions and 5 deletions

View File

@@ -98,9 +98,6 @@ func (pm *ptyManager) File() *os.File {
}
func (s *Server) handlePty(logger *log.Entry, session ssh.Session, privilegeResult PrivilegeCheckResult, ptyReq ssh.Pty, winCh <-chan ssh.Window) bool {
cmd := session.Command()
logger.Infof("executing Pty command: %s", safeLogCommand(cmd))
execCmd, err := s.createPtyCommand(privilegeResult, ptyReq, session)
if err != nil {
logger.Errorf("Pty command creation failed: %v", err)
@@ -114,6 +111,14 @@ func (s *Server) handlePty(logger *log.Entry, session ssh.Session, privilegeResu
return false
}
shell := execCmd.Path
cmd := session.Command()
if len(cmd) == 0 {
logger.Infof("starting interactive shell: %s", shell)
} else {
logger.Infof("executing command: %s", safeLogCommand(cmd))
}
ptmx, err := s.startPtyCommandWithSize(execCmd, ptyReq)
if err != nil {
logger.Errorf("Pty start failed: %v", err)