full_audit SAMBA module - how to log "file creation"?

Status
Not open for further replies.

milancesal

Dabbler
Joined
Nov 1, 2017
Messages
12
I mean just the file "creation" which is the "first write" of a file.
Here is my full_audit config:

Code:
full_audit:prefix = %u|%m|%I|%S
full_audit:success = mkdir rmdir link unlink rename
full_audit:failure = none
full_audit:facility = local7
full_audit:priority = notice


mkdir and rmdir work fine - create and delete of directories
link - this is in the documentation, but doesn't log anything
unlink - this logs file delete. works fine.
rename - renaming directories and files. works fine too.

write - no log entry just like link. (outdated documentation)
open - This logs every time when I open a file.

pwrite - This does log file writes, but all writes including modifications and appends. Not just the first write. You just copy one file into share then you get lots of pwrite log entries. One write action for every write of a block.

There are so many other operations in the documentations. Which one should I include?

It doesn't have to actually mean 'creation', but something else as long as it logs filename with path and leaves only 1 log entry when the file gets created.
 
Last edited:

milancesal

Dabbler
Joined
Nov 1, 2017
Messages
12
Not a perfect one, but I found a solution.

Include 'open' operation.

It logs 'open' actions for files and folders. Yes, including folders. And it indicates if it was for 'w' or 'r'. When browsing with Windows Explorer, it logs a lot of unnecessary entries - opening current location, opening current folder, opening parent folder and so on.

What you need is 'open' actions with 'w' only. But it also logs openings for modify or append as well. But at least, this doesn't log every block write like 'pwrite'. Not the best, but close. Only 1 entry for file 'creation' is just not achievable with this module. You can filter out unwanted log entries in syslog config.

I might just write a vfs module for myself.

If FreeNAS team can write a module for this purpose and somehow put it all together nicely, and call it a new feature - "auditing", it would be really great!

Refer to this email thread from samba.org:
https://lists.samba.org/archive/samba/2010-June/156527.html
 
Status
Not open for further replies.
Top