[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how would you do this?



On Wed, Aug 18, 2021 at 08:55:12PM -0400, songbird wrote:
>   let's suppose you have a directory where there are
> various scripts, libraries, programs, data, etc.
> 
>   you want to know exactly which other scripts, libraries,
> etc. use them and to log each caller to know the name so
> it can be tracked down (location would be nice too, but 
> that could be found later if needed).
> 
>   i don't need to keep the information in a database as
> just having the log file will be enough.
> 
>   how would you do this?
> 
>   this isn't a homework assignment i'm just curious how
> easy or hard this would be to accomplish.
> 
It sounds like you want something like like incrond, which gives you
user-space hooks into the inotify kernel subsystem.  I have used it, for
instance, for protecting artifacts published to a develpment archive
server.  I use incron to monitor the directories where artifacts can be
uploaded, and as soon as an upload is completed, then incron invokes a
call to 'chattr +i' to make the new file immutable and thus protect it
from being overwritten by a subsequent upload or deletion.

Because it can also simply log accesses, reads, etc., it will probably
do exactly what you want.

Regards,

-Roberto

-- 
Roberto C. Sánchez


Reply to: