I have this user that has limited sudo privileges, yet he manages to screw up from time to time. I would like to keep an eye on his adventures, so that I can reverse any damage with less digging. Ideally, I'd want a service with the following functionality being well integrated and presentable
- Tracks shell input and output like
ttyrec
(orscript
orsudo
if logging is set up) and can replay the session like ttyplay (orscriptreplay
orsudoreplay
) Compatibility with ncurses programs would be nice, but not necessary,ttyrec
can do it apparently. - Tracks file access, creation and modification. Ideally, it could also backup a file each time it is changed or deleted.
So far I have found several tools that I would have to set up to get most of the requested functionality, but I haven't come across an OSS product that would integrate them nicely (Lynis community edition isn't really clear on the functionality).
- I could put
ttyrec $(mktemp)
,script $(mktemp)
orsudo -u $USER -i
(with sudo logging set up) in his.bashrc
to log the shell IO. - Set up auditing to track file access in some dirs, like
/usr
,/etc
,/var
. - Create a LVM snapshot when he logs in, but that is a bit of an overkill and might degrade system performance.
EDIT: ttyrec
seems to be a better alternative to script
, it would satisfy all my IO logging requirements. Now I need to find a good way to log file manipulation.
I'll be grateful for any suggestions or recommendations of best practices.
script
session. It's not about spying on him, but about giving him assurance that his mistakes can be back-tracked.