SFTP: log users connections at info level

uniform SFTP and FTP logs

Fixes #626
This commit is contained in:
Nicola Murino 2021-11-29 10:15:46 +01:00
parent bec54ac8ae
commit 3c24cb773f
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB
2 changed files with 4 additions and 5 deletions

View file

@ -201,8 +201,7 @@ func (s *Server) AuthUser(cc ftpserver.ClientContext, username, password string)
if err != nil {
return nil, err
}
connection.Log(logger.LevelInfo, "User id: %d, logged in with FTP, username: %#v, home_dir: %#v remote addr: %#v",
user.ID, user.Username, user.HomeDir, ipAddr)
connection.Log(logger.LevelInfo, "User %#v logged in with %#v from ip %#v", user.Username, loginMethod, ipAddr)
dataprovider.UpdateLastLogin(&user)
return connection, nil
}

View file

@ -406,9 +406,9 @@ func (c *Configuration) AcceptInboundConnection(conn net.Conn, config *ssh.Serve
defer user.CloseFs() //nolint:errcheck
logger.Log(logger.LevelDebug, common.ProtocolSSH, connectionID,
"User %#v, logged in with: %#v, from ip: %#v, client version %#v",
user.Username, loginType, ipAddr, string(sconn.ClientVersion()))
logger.Log(logger.LevelInfo, common.ProtocolSSH, connectionID,
"User %#v logged in with %#v, from ip %#v, client version %#v", user.Username, loginType,
ipAddr, string(sconn.ClientVersion()))
dataprovider.UpdateLastLogin(&user)
sshConnection := common.NewSSHConnection(connectionID, conn)