I'm a newbie to encryption issues and I'm trying to sort out a few questions.

For a distributed application we need to deploy a server outside of our company with sensitives PDF files on it. That because those files need to be accessed through another system (tablets fleet), and the huge amount of those files discard the accessing through the network from our servers.

I've been digging into dm-crypt/LUKS solution which seems to answer my problems, though I've a few questions:

  • Will a java app, deployed through tomcat, be able to seamlessly access those files ? My guess is yes if I start tomcat with sudo, but again, newbie...
  • Can I consider mounting the volume through the webapp ? I'm considering retrieving the password to the encrypted partition through a web service and store the password on one of our servers.
  • How bad is the overhead to decrypting those files on the fly? The
    encrypted data will be accessed by a simultaneously by 4-5 users
    retrieving around 50MB (decrypted size) of data.

Thx in advance for your help

1 Answer 1

> Will a java app be able to seamlessly access those files?

Yes, and you don't need sudo for that (NEVER RUN A WEBSERVICE AS ROOT). Once the luks partition is opened and mounted, application software just sees a normal filesystem.

> Can I consider mounting the volumen through a webapp?

Mounting requires root permissions, so you must be very careful when writing the webapp. Ideally, write a small suid executable that just does the mounting with a given password, and call that from the webapp, giving the webapp no special privileges whatsoever. Be very careful on passphrase handling - if you're not careful, the passphrase might end up in a log on the server or be viewable on the running system unter /proc.

> How bad is the overhead for decrypting on the fly?

For just 4 to 5 users decrypting only 50MB of data each, you won't notice the additional cpu usage caused by the decryption.

Note: As long as your server runs with the luks partition opened, anyone with access to the server will obviously be able to read all the encrypted files. Luks only protects data at rest (e.g. when someone yanks the hard drives from your server and runs away with them).

  • when you say normal filesystem, it means any user can access the newly mounted volume? Others users will have access to this server, which happens to be a PC server. I don't want them to have access to it. If so, is there a way the restrict access to the volume (create user group or something)? "Luks only protects data at rest", I thought data was always encrypted so that if it was stolen there were no risks.
    – Nikolai
    Nov 7, 2016 at 10:23
  • Yes, other users will see the partition too. If you don't want that, you must make sure that tomcat / your java app is running under a specific user and then set up the access permissions of the directories and files on the encrypted partition so only the tomcat user can read them. This is basic unix stuff, any introductionary unix/linux book will cover it. And yes, Luks does encrypt the data, but once you've opened the Luks volume, all the files are accessible to any process on the system with read permissions, until you close it or cut power. Nov 7, 2016 at 13:48
  • Ok then, yeah I know it's basic stuff, I'm aware of that. Thank you for your very kind help and time, I think I know where I'm heading now :)
    – Nikolai
    Nov 8, 2016 at 6:46
  • That came over wrong, sorry. I just meant to say you can find detailed help on how to set up your user permissions in any book covering unix administration. Nov 8, 2016 at 7:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .