Mysql – DB encryption for Django web app without storing key on server

djangoencryptionMySQLsqlitevps

We are setting up a virtual private server (not hosted by us), on which we will be user testing our Django-based web application. The user-generated content produced in these tests will be very sensitive. We would like to keep this content encrypted, for example in case back-up media goes missing. The content will be stored in a MySQL or SQLite database.

As I understand it, we cannot encrypt the file system of the VPS. If we encrypt the database, using something like SQLcipher (http://sqlcipher.net/), is there a way of passing the key to Django without storing it on the server? We will be booting up the server for each test, so that part is not a concern.

Best Answer

As you said you can't encrypt the filesystem of the VPS. I don't know which feature offers your VPS but you can try to create a second filesystem mounted on /var/lib/mysql (in the case of mysql Server) and encrypt it (for example using the software LUKS).

Another alternative is create a encrypted loop-device filesystem using a file of your VPS and mount it on /var/lib/mysql; here there is some references of this solution https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_a_non-root_file_system

Related Topic