keepass kdbx files change not detected
Debian 9.3 Spotter 0.2 pyinotify-0.9.6 python --version 2.7.13 python3 --version 3.5.3
I'm using spotter to monitor modification on my keepass deb, but strangly enough modifications on this file are not raised by spotter, here is how I repro the issue. The step below done with a .txt file does work ok
- create your .kdbx file
- create your .spotter to monitor your file with this directive,
watch: *.kdbx -> echo "ok ca marche" - Start spotter (spotter &)
- Make any change using any keepass app
- The command is never triggered…
Also the only way I manage to the command trigger was doing this
- create your .kdbx file
- create your .spotter to monitor your file with this directive,
watch: *.kdbx -> echo "ok ca marche" - Start spotter (spotter &)
- cp my.kdbx temp.kdbx
- The echo command is properly trigger
- echo toto > temp.kdbx
- The echo command is properly trigger
Any though why this is happening ?
Thanks for any input. Matth
I've seen some similar problems before, where some applications use complex methods to save files in place resulting in them not triggering the inotify flags spotter listens for.
Currently it listens for pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE. If you want to have a go at debugging this, I'd start with modifying INOTIFY_EVENT_MASK in spotter/spotter.py to try and catch more events, printing the entire event in process_default(), and using that to see what Keepass is doing when it saves the file.
Effectively,I have done some test with pyinotify and I'm getting pyinotify.IN_DELETE_SELF because the soft is basically deleting the previous version of the file and pushing a new one.
With a bit more details when saving the db the masks are in this order:
IN_OPEN
IN_CLOSE_NOWRITE
IN_ATTRIB
IN_DELETE_SELF
IN_IGNORED
So I guess this won't do the trick for my case since spotter doesn't listen any of those masks, probably because this is an encrypted db, the files doesn't get modified be regenerated each time I hit the save button.
Matth