desktop icon indicating copy to clipboard operation
desktop copied to clipboard

Veracrypt encrypted container changes not synced

Open GreenArchon opened this issue 6 years ago • 5 comments

Expected behaviour

Mounting a veracrypt container file which is in a folder synced by the client, modifying it's content and unmounting it should cause this file to sync.

Actual behaviour

File is not synced, even if the "force synchronization now" button on the client is clicked.

Steps to reproduce

  1. Install veracrypt
  2. Have the client installed and open with a directory synced from a test user
  3. Create an encrypted container inside the synced directory. 16 MB size, NTFS (though this shouldn't matter).
  4. Wait a bit for that file to sync properly
  5. Mount it in veracrypt
  6. Modify files in the mounted directory
  7. Unmount the container in veracrypt
  8. Notice container file is not synced on the server, even if "force synchronization now" is clicked.
    • Actually, file on the server appears to be from a version where the container is created successfully, but no filesystem is present in it.

Workarounds

  • Using UNIX's touch to boop the file after unmounting causes the sync to occur properly
  • Unticking "Preserve modification timestamp for file containers" causes the file to sync properly
    • Note this flag is ticked by default

Other notes

Obviously this is a corner case, where a program modifies a file voluntarily avoids changing its mtime (for plausible deniability reasons I assume). With that said, I remember the Dropbox client synced it fine a few years ago when I was using that. And it's still a file, in a synced directory, that is modified

A "file container" created using standard Linux tools (eg. dd if=/dev/zero of=test bs=32M; mkfs.ext4 test; mount test /tmp/foo or cryptsetup luksFormat test; cryptsetup luksOpen test test; mkfs.ext4 /dev/mapper/test; etc.) also syncs fine, though these tools do update mtime by default.

Client configuration

Client version: 2.6.4stable-Win64 (build 20200303)(b45f5f), 2.6.2-1build1 (Ubuntu 20.04 repos)

Operating system: Windows 10 and Ubuntu 20.04

Server configuration

Nextcloud version: 18.0.4

GreenArchon avatar May 25 '20 00:05 GreenArchon

Interesting. On my end with a veracrypt container outside of nextcloud, the 'modified' date of the container file does change. Its size however doesn't. I'm also on Win 10 for both veracrypt and the NC client.

I guess NC should at least pick up the date change in your case... strange.

EDIT: my container is usually mounted as a 'removable device' type of container in veracrypt.

RedKage avatar May 29 '20 09:05 RedKage

I assume file modification dates playing a huge role in successfully detecting file changes on NTFS. It would explain why touching the file or letting its mtime be updated automatically works in getting it to sync.

Does completely restarting the sync client also not force a sync of the file?

kescherCode avatar Jun 20 '20 15:06 kescherCode

Yes, this looks like either the mtime not being updated for some reason or a notification to be lost. This needs further research to know what's happening. Could you please investigate further please?

er-vin avatar Jun 22 '20 07:06 er-vin

Yes, this looks like either the mtime not being updated for some reason

To be clearer, yes, this is exactly what's happening, by design. By default verarcrypt doesn't update mtime on containers - though there is an option in the settings to change that (which I personally did as a workaround for this bug).

I assume file modification dates playing a huge role in successfully detecting file changes on NTFS

Note this happens on Linux's btrfs as well.

Does completely restarting the sync client also not force a sync of the file?

No. File in question was a container containing my taxes document. It didn't sync for a bit over a year.

GreenArchon avatar Jun 22 '20 13:06 GreenArchon

OK, then I don't think there's really a bug. If the mtime and the inode of a file didn't change we got no way to know it has been updated... well we could check against hashes but then everyone would complain that it is bloody slow to sync.

The point is: if you use a system concealing from us all the information we can rely on to know a change happened then we can't know that a file changed.

er-vin avatar Jun 23 '20 10:06 er-vin