Skip to content

Find a way to enable VeraCrypt support by default #589

Description

@intrigeri

Hi!

in the review process of the new VeraCrypt support @segfault has added (#495) on behalf of Tails, concerns were raised about the potentially problematic performance impact of testing all devices for "does it look like random data", which this code uses as a way to try and identify VeraCrypt volumes.

For the record & the curious, this discussion started at #495 (comment)

Back then, the simplest way we've found to unblock the review and merge process was to add a flag file: the entire VeraCrypt code path is enabled if, and only if, /etc/udisks2/tcrypt.conf exists. And by default it does not exist. This was a great first step.

Building on top of this, VeraCrypt support is being pushed higher in the stack: GNOME Disks 3.30 supports this, we got plenty of code merged already in GLib and GTK+, and segfault submitted merge requests for user-friendly integration with the rest of GNOME so that any GNOME user can unlock VeraCrypt volumes. And at this point, the need to create /etc/udisks2/tcrypt.conf as root obviously becomes a serious UX problem.

The idea behind the /etc/udisks2/tcrypt.conf flag file was that it would be shipped by an extra package, so enabling VeraCrypt support would boil down to installing that package, which feels acceptable from a UX point of view. But in practice, this is going to be a pain (at best) or simply won't work at all: first, one would need to create and maintain such a package for all major distros, which seems to be lots of busywork; second, some distros such as Debian frown upon a package that ships only one file (let alone an empty one).

So at this point, I'd like us to go back to the drawing board and find a way to enable VeraCrypt support by default in udisks.

First, a question: @vojtechtrefny, who raised the performance impact concerns initially, wrote "Maybe I'm just too paranoid or scared of breaking something". Indeed, we never checked whether there was an actual performance problem with enabling the VeraCrypt code path by default. What kind of data would we need to assess whether there's an actual problem? I'm happy to get some measurements once I'm told what data you folks would like to see :) I assume we need benchmarks with real-world hardware.

Second, if the previous topic does not reach the "actually we can enable this code path by default" conclusion, my proposal would be to enable this code path in more cases than just "iff. the flag file exists" (if (udisks_daemon_get_enable_tcrypt (daemon))). I've spent some time thinking about it and it looks like this could work fine: we could guard that code with these conditions: if the flag file exists (i.e. its meaning becomes "inconditionally do the check on all block devices") OR the block device is on a removable drive (the main use case and a pretty efficient filter) OR (ID_FS_USAGE is empty AND the device has no partition table). Then, for those without the flag file, i.e. most users:

  • Performance cost is close to zero in the majority of cases, i.e. no removable drive is plugged and ID_FS_USAGE is non-empty for all devices except drives that have a partition table.
  • The "udisks will not be able to unlock a given TCRYPT volume with a chance of n / 65536, where n = number of filesystems with a 2 byte magic number that are supported by udev" problem only exists for non-removable drives, which is a minority case already.

Would this be a reasonable trade-off?

segfault tells me that all of these properties should be easily accessible in udisks_linux_block_update so implementing this looks doable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions