Using EncFS with Dropbox and BoxCryptor

Lots of folks like using Dropbox, the ubiquitous store-and-sync cloud storage service; I am among them. However, concerns over the privacy and security of my data have kept me from using Dropbox for some projects. To help address that, I looked around to find an open, interoperable way of adding an extra layer of encryption onto my data. What I found is described in this post, and it involves using the open source EncFS and OSXFUSE projects along with an application from BoxCryptor to provide real-time, client-side AES-256 encryption.

Background

First, some background why I went down this path. Of all the various cloud-based services out there, I’m not sure there is a service that I rely upon more than Dropbox. The Dropbox team has done a great job of creating an almost seamlessly integrated product that makes it much easier to keep your files accessible across locations and devices.

Of course, Dropbox is not without its flaws, and security and privacy are considered among the prime concerns. Dropbox states they use server-side encryption to protect your data on the Amazon S3 infrastructure, but Dropbox also controls those server-side encryption keys. Many individuals, myself among them, would prefer client-side encryption with control over our own encryption keys.

So, a fair number of companies have sprung up offering ways to help fix this. One of these is BoxCryptor, who offers an application for Windows, Mac, iOS, and Android that performs client-side encryption. From the Mac OS X perspective, BoxCryptor’s solution is, as far as I know, built on top of some fundamental building blocks:

  • The open source OSXFUSE project, which is a port of FUSE for Mac OS X
  • A Mac port of the open source EncFS FUSE filesystem

I would imagine that ports of these components for other operating systems are used in their other platforms, but I don’t know this for certain. Regardless, it’s possible to use BoxCryptor’s application to get client-side encryption across a variety of platforms. For those who want a quick, easy, simple solution, my recommendation is to use BoxCryptor. However, if you want a bit more flexibility, then using the individual components can give you the same effect. I chose to use the individual components, more for my own understanding than anything else, and that’s what is described in this post.

What You’ll Need

This post was written from the perspective of getting this solution running on Mac OS X; if you’re using a different operating system, the specifics will quite naturally be different (although the broad concepts are still applicable).

There are four main components you’ll need:

  • OSXFUSE: This is a port of FUSE to OS X, and is one of a couple of successors to the now-defunct MacFUSE project. OSXFUSE is available to download here.
  • Macfusion: Macfusion is a GUI to help simplify and automate the mounting of filesystems. While it’s not strictly necessary, it does make things a lot easier. Macfusion can be downloaded here.
  • EncFS: You’ll need a version of EncFS for Mac OS X. There are a variety of ways to get it; I used an installer actually made available by BoxCryptor here.
  • EncFS plugin for Macfusion: This is what enables Macfusion to mount or unmount EncFS filesystems, and is actually included in the EncFS installer above. You can also download the plugin here.

Setting Things Up

Once you have all the components you need, then you’re ready to start installing.

  1. First, install OSXFUSE. When installing OSXFUSE, be sure to select to install the MacFUSE Compatibility Layer. The OSXFUSE installer recommends rebooting after the installation, but I waited until I’d finished installing all the components.

  2. Once OSXFUSE is installed, install Macfusion. Macfusion is distributed as a ZIP file; simply unzip the file and move it to the location of your choice. I installed it to /Applications.

  3. Next, run the EncFS installer. During the installation, select to install only EncFS and the EncFS plugin for Macfusion. Do not install any of the other components. I rebooted here.

  4. You’ll need both a mount point as well as a directory to store the raw, encrypted data. Since the raw, encrypted data is intended to be synchronized via Dropbox, you’ll want to create the encrypted directory in the Dropbox hierarchy. I chose to use ~/Dropbox/Secure. For the mount point, I chose to use ~/.Secure. You can obviously modify both of these directories to better suit your own needs or preferences.

  5. Once you have all the components installed and the mount point and encrypted directories created, you’re ready to actually create the encrypted filesystem. Run the command encfs ~/Dropbox/Secure ~/.Secure. The encfs program will run through some questions; select “x” for Expert mode and configure it according to the guidelines described in this support article. When prompted for a passphrase, be sure to enter an appropriately complex passphrase—and make sure you remember it (you’ll need it later).

  6. When encfs finishes running, it will mount an encrypted volume on your desktop. It will have an odd name, but you won’t be able to change it. Go ahead and eject (unmount) this volume; we’ll remount it again shortly using Macfusion. Note that you might see some Dropbox activity here.

  7. Launch Macfusion, then re-add the encrypted filesystem created in step 5; you’ll need to supply the same passphrase you entered earlier. Here in Macfusion you’ll be able to specify a name for the encrypted filesystem and supply a custom icon as well. Mount the encrypted filesystem to be sure that everything is working as expected.

That’s it—any files you now copy into the encrypted filesystem—which is represented by an external drive on your Desktop—will be encrypted using AES-256 and then synchronized to Dropbox. Cool, huh?

Adding Another Computer

I have two Macs in my office (my 13″ MacBook Pro and my Mac Pro), so I had to repeat the process on the second Mac so that it could read the encrypted files. If you have more than one computer, you’ll need to do the same. Simply go through steps 1 through 5. In step 5, though, it will only prompt for the passphrase. You can even skip steps 5 and 6 to go straight to 7. As long as you have the passphrase for the encrypted filesystem, adding access for additional Dropbox-linked computers should be a piece of cake.

Adding Access from iOS

This is where BoxCryptor comes back into play again. Install the BoxCryptor app onto your device, then link it to your Dropbox account and select the directory within Dropbox where the raw, encrypted data is found. As long as you followed the configuration guidelines here, BoxCryptor should be able to decrypt the encrypted filesystem created with EncFS.

Following these instructions, you’ll gain a way to add AES-256 encryption to your Dropbox files (or a subset of your Dropbox files) while still maintaining access to those files from just about any location across a variety of devices.

If anyone has any questions or clarifications about what I’ve posted here, please speak up in the comments below. All courteous comments are welcome!

Tags: , , ,

  1. former dropbox user’s avatar

    …. or just switch to wuala which encrypts your data in flight with strong encryption

  2. Dmitri Kalintsev’s avatar

    Hi Scott,

    Won’t Dropbox have to re-upload (and re-download on all linked machines) the whole encrypted container every time you change anything on your encrypted volume?

    Cheers,

    – Dmitri

  3. Dennis Faucher’s avatar

    Creative solution to a very broad issue. Thank you for the article.

  4. slowe’s avatar

    Dmitri, there is no container. This is file-level encryption, and will not affect how Dropbox operates. That’s the beauty of this solution as compared to using encrypted disk images.

  5. slowe’s avatar

    Former Dropbox User, who controls the encryption keys? Dropbox uses SSL for encryption during transport, and encrypts data server-side; however, the encryption keys are under their control. This solution puts the encryption keys under YOUR control. Oh, and by the way: it works with *any* cloud storage offering, not just Dropbox.

  6. Dmitri Kalintsev’s avatar

    Scott,

    Thanks for clarifying. I would imagine the issue still applies to individual files larger than Dropbox’s built-in sub-file de-dupe block size?

  7. John-Luc’s avatar

    Great article, thanks for posting this. How did you create the mount point? I’m not much of a Linux/Unix person and I’m getting confusing results looking for how to do this in OS X. Thank you again.

  8. slowe’s avatar

    John-Luc, you can create the mount point either in Finder or via the terminal using the mkdir command. I chose to create mine with the terminal, but either method should work.

  9. Kenneth Ristau’s avatar

    I use a TrueCrypt volume on my Dropbox account, and it has worked well for me. Once concern I have, however, is how changes to the blocks might be used to perform cryptanalysis against the encrypted files. When changes are made to any encrypted file or image over Dropbox, it appears that only the changed blocks are updated. If you make frequent, predictable changes to encrypted files, then I wonder if there might be a way to discover the key itself or use that information to significantly reduce the search space for a brute force attack against the key?

    Those concerns aside, I still think it is well worth the effort to use encryption which you control with these sorts of services.

  10. Mia’s avatar

    Thank you for the article!
    I thought this might interest you. This is brand new Dropbox encryption service and it works very tight with Dropbox and offers permission control and audit log dashboard.
    https://www.digitalquick.com/
    https://www.digitalquick.com/blog?page=3

  11. Keith’s avatar

    Thru has an enterprise dropbox that can replace unsecure consumer Dropbox accounts with something that the end users will love and find very convenient.

    You should check it out.

    http://www.thruinc.com/solutions/secure-dropbox/

  12. Jeremy’s avatar

    Scott, thanks for the detailed instructions. Very helpful. I went and looked at Wuala to see if they control encryption from their end. This is what their FAQ says: “Wuala is completely private and secure. When you store a file in Wuala, the file and its metadata (e.g. name, description, tags, etc.) gets encrypted before it leaves your computer. Every file is encrypted with a different key. The list of these keys is encrypted with your password and stored on our server. Your own password is very important here: it never leaves your computer, so we do not know it. Hence, not even we can access your data.” — Which just raises another question for me: Is me having my own password the same as me controlling the encryption keys from my end?

  13. slowe’s avatar

    Jeremy, it’s hard to say for certain, but my guess is that by controlling your password you are controlling the encryption keys.

  14. Lars’s avatar

    Hi, isn’t it a problem that Dropbox is not case sensitive? encfs seems to generate file names case sensitive (upper+lower case).. I know chances are low for a collision here, but it is still a problem, isn’t it? What do you think?

  15. ZappBrannigan’s avatar

    How is Boxcryptor any better than using encFS alone?

    As I understand it, encFS provides on-the-fly filename and block/stream (AES/Blowfish) encryption on the files directly. Since it acts as a File System layer, it’s not even taking up extra RAM or disk space for these contents, since it’s writing the encrypted data directly to the disk through the source folder’s file system handlers.

    So if that’s correct, what is Boxcryptor buying me?

  16. slowe’s avatar

    Zapp, my use of BoxCryptor was for their iOS client, which allows me to access EncFS-encrypted files from my iPad or iPhone. The primary value of BoxCryptor on OS X/Windows would be to simplify the setup for those who are uncomfortable using EncFS directly, IMHO.

  17. ZappBrannigan’s avatar

    Thanks Scott. I tend to agree.
    I’ve played w/ encfs more over the last week.
    The Mac solution is pretty optimal, since it allows you to mount as many encfs pairs as you wish. (great for multiple cloud services or multiple shared folders within a single cloud service)

    Boxcryptor is nice for free, but limits you only to one pair. Fine for most newbs, since it offers encryption when you had none. But on Mac, the encfs/Macfusion option beats it!

    Boxcryptor’s best attribute is that’s it’s consistent across platform, with similar behavior and setup. The same isn’t true of encfs. The Windows experience feels like an incomplete Linux port, w/ a handful of kludgy library requirements. Not bad, but…

    I’m an Android user, so the landscape was a bit different than iOS.
    In addition to the Boxcryptor app, there were also 3 other encfs apps.
    The most popular, Cryptonite, seems to be very good: it allows you to setup multiple pairs, auto-link to Dropbox (to a fixed folder), or even setup pairs (with all 4 pre-built configurations).

  18. ZappBrannigan’s avatar

    I forgot to mention… Boxcryptor has taken down the encfs package since the original posting. But you can use one of the repositories available to install it.
    I used Homebrew, but I think it’s available on MacPorts and Fink also.

  19. Steffen’s avatar

    Hi, encfs is installed also brew works fine for me. When i try to create a new encfs folder or trying to mount an existing one i get the error:

    dyld: lazy symbol binding failed: Symbol not found: __ZN5boost7archive17xml_oarchive_implINS0_12xml_oarchiveEEC2ERSoj
    Referenced from: /usr/local/Cellar/encfsmacosxfuse/1.7.4p2/lib/libencfs.6.dylib
    Expected in: flat namespace

    dyld: Symbol not found: __ZN5boost7archive17xml_oarchive_implINS0_12xml_oarchiveEEC2ERSoj
    Referenced from: /usr/local/Cellar/encfsmacosxfuse/1.7.4p2/lib/libencfs.6.dylib
    Expected in: flat namespace

    Trace/BPT trap: 5

    Any ideas?

    PS: using mavericks / apple