mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
SFTP: log users connections at info level
uniform SFTP and FTP logs Fixes #626
This commit is contained in:
@@ -201,8 +201,7 @@ func (s *Server) AuthUser(cc ftpserver.ClientContext, username, password string)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
connection.Log(logger.LevelInfo, "User id: %d, logged in with FTP, username: %#v, home_dir: %#v remote addr: %#v",
|
connection.Log(logger.LevelInfo, "User %#v logged in with %#v from ip %#v", user.Username, loginMethod, ipAddr)
|
||||||
user.ID, user.Username, user.HomeDir, ipAddr)
|
|
||||||
dataprovider.UpdateLastLogin(&user)
|
dataprovider.UpdateLastLogin(&user)
|
||||||
return connection, nil
|
return connection, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,9 +406,9 @@ func (c *Configuration) AcceptInboundConnection(conn net.Conn, config *ssh.Serve
|
|||||||
|
|
||||||
defer user.CloseFs() //nolint:errcheck
|
defer user.CloseFs() //nolint:errcheck
|
||||||
|
|
||||||
logger.Log(logger.LevelDebug, common.ProtocolSSH, connectionID,
|
logger.Log(logger.LevelInfo, common.ProtocolSSH, connectionID,
|
||||||
"User %#v, logged in with: %#v, from ip: %#v, client version %#v",
|
"User %#v logged in with %#v, from ip %#v, client version %#v", user.Username, loginType,
|
||||||
user.Username, loginType, ipAddr, string(sconn.ClientVersion()))
|
ipAddr, string(sconn.ClientVersion()))
|
||||||
dataprovider.UpdateLastLogin(&user)
|
dataprovider.UpdateLastLogin(&user)
|
||||||
|
|
||||||
sshConnection := common.NewSSHConnection(connectionID, conn)
|
sshConnection := common.NewSSHConnection(connectionID, conn)
|
||||||
|
|||||||
Reference in New Issue
Block a user