diff --git a/config/config.go b/config/config.go index ab7ad370..98e67be7 100644 --- a/config/config.go +++ b/config/config.go @@ -210,6 +210,9 @@ type SystemConfiguration struct { // ActivitySendCount is the number of activity events to send per batch. ActivitySendCount int `default:"100" yaml:"activity_send_count"` + // Should send sftp.read to activity log + ActivitySendSftpRead bool `default:"false" yaml:"activity_send_sftp_read"` + // If set to true, file permissions for a server will be checked when the process is // booted. This can cause boot delays if the server has a large amount of files. In most // cases disabling this should not have any major impact unless external processes are diff --git a/server/activity.go b/server/activity.go index c1613adb..152db481 100644 --- a/server/activity.go +++ b/server/activity.go @@ -15,6 +15,7 @@ const ActivityPowerPrefix = "server:power." const ( ActivityConsoleCommand = models.Event("server:console.command") ActivitySftpWrite = models.Event("server:sftp.write") + ActivitySftpRead = models.Event("server:sftp.read") ActivitySftpCreate = models.Event("server:sftp.create") ActivitySftpCreateDirectory = models.Event("server:sftp.create-directory") ActivitySftpRename = models.Event("server:sftp.rename") diff --git a/sftp/handler.go b/sftp/handler.go index 74ba9eb6..56eb38c4 100644 --- a/sftp/handler.go +++ b/sftp/handler.go @@ -87,6 +87,10 @@ func (h *Handler) Fileread(request *sftp.Request) (io.ReaderAt, error) { } return nil, sftp.ErrSSHFxNoSuchFile } + + if config.Get().System.ActivitySendSftpRead { + h.events.MustLog(server.ActivitySftpRead, FileAction{Entity: request.Filepath}) + } return f, nil }