iCIS Intra Wiki
categories: Info - Support - Software - Hardware | AllPages - uncategorized
Difference between revisions of "Encryption"
Line 121: | Line 121: | ||
dm-crypt is the Linux kernel's device mapper crypto target. From Wikipedia:dm-crypt, it is: | dm-crypt is the Linux kernel's device mapper crypto target. From Wikipedia:dm-crypt, it is: | ||
− | A transparent disk encryption subsystem in [the] Linux kernel... [It is] implemented as a device mapper target and may be stacked on top of other device mapper transformations. | + | A transparent disk encryption subsystem in [the] Linux kernel... [It is] implemented as a device mapper target |
− | + | and may be stacked on top of other device mapper transformations. It can thus encrypt whole disks (including | |
− | + | removable media), partitions, software RAID volumes, logical volumes, as well as files. It appears as a block device, | |
+ | which can be used to back file systems, swap or as an LVM physical volume. | ||
==== Fscrypt ==== | ==== Fscrypt ==== |
Revision as of 12:16, 17 December 2019
Personal Data Protection Act requires you sometimes to encrypt your data. In this page we describe methods how to easily encrypt a file, a set of files or even your whole operating system on your laptop. The RU policy is that all portable devices should be encrypted. For support you can contact the C&CZ helpdesk.
Below we discuss possible solutions to encrypt your data. Look for an overview of encryption software at wikipedia page Comparison_of_disk_encryption_software.
Encryption of files
Generally, people encrypt files for the purpose of sending a file securely via e-mail or copying it to a portable storage device that is more susceptible to loss. There are many programs available to let you encrypt files. Below we mention several which are advised:
- use 7zip compression program to compress and encrypt a set of files into a single .7z archive.
- use AES Crypt to encrypt a single file. AES Crypt integrates with your operating system's file explorer to easily let you encrypt/decrypt files.
For more informations see this page.
Encryption of your devices
laptop/pc
IMPORTANT:
- make sure you save your encryption/recovery key well so you can always decrypt your disk
- make good backups
Below we explain how to encrypt your laptop. These instructions are also available at the Privacy & Security website of the Radboud University.
Overview encryption software per operating system
BitLocker | VeraCrypt | Filevault | |
---|---|---|---|
Windows | x | x | |
Mac | x | x | |
Linux | x |
Windows
To encrypt your entire system you have a choice between two methods:
- use Bitlocker from microsoft which is integrated in windows pro/enterprise (not in home edition, though we have a campus upgrade license to enterprise)
- use VeraCrypt open source software
It is adviced to use Bitlocker, unless you have a problem with the possibility that Microsoft has made a backdoor in bitlocker you should use VeraCrypt instead.
Bitlocker
- To enable Bitlocker encryption follow these instructions HERE.
Basicly it are the following three steps:- in explorer right click the C:/ drive and select "turn on bitlocker".
- then configure automatic unlocking at startup (where your computer grabs the encryption keys from the TPM-chip and automatically decrypts the drive).
With automatic unlocking you still need to logon to windows with your username and password after windows is started up! - finally you get a Recovery Key that you can use to access your encrypted files if the PC with TPM dies and you have to access the drive from another system. Store this key safely!! E.g. you could print it and store the paper in a safe drawer.
- After you have enabled bitlocker you can verify its working correctly and has encrypted everything by running on a windows command prompt with administrator rights the following command: "manage-bde -status". See check bitlocker status
Notes:
- If the C:/ drive is encrypted Windows can still boot using an hidden System Reserved Partition which contains the boot manager which is used during boot and de-encrypts the C:/ drive using the bitlocker tools installed on this hidden partition.
- Instead of automatic unlocking you can set a password or a PIN code for unlocking the encryption at startup. In latter case you must at boot supply your password/PIN to unlock the drive, and then when the system is booted you still need to logon with your username and password. Note: the password for unlocking the drive can be chosen different from your logon password. If you forget the password/pin for unlocking the drive you can always use the Recovery Key to retain access to your files.
Comparison Bitlocker and Veracrypt
Advantages Bitlocker over Veracrypt
- automatic unlocking at startup using TPM chip => user only needs to login as it is a none-encrypted laptop ; Veracrypt doesn't use the TPM chip and you need to supply a password manually.
- windows recovery/repair supports bitlocker => for veraCrypt you must make special repair disk which is unique for the laptop!
Advantages Veracrypt over Bitlocker
- open source -> more likely that there is no backdoor
- more possibilities eg. stronger encryption, external drive encryption etc.
- supported on Linux and OS X, however full system encryption only supported on Windows!!
OS X
FileVault is a disk encryption program in Mac OS X 10.3 and later. It performs on-the-fly encryption with volumes on Mac computers.
FileVault uses the user's login password as the encryption pass phrase. It uses the AES-XTS mode of AES with 128 bit blocks and a 256 bit key to encrypt the disk. Only unlock-enabled users can start or unlock the drive. Once unlocked, other users may also use the computer until it is shut down. (source)
In OS X more users are likely to enable FileVault than ever before—as at installation you have to consciously opt-out of having your hard drive encrypted, rather than opt-in. (source)
For instructions how to enable and use FileVault read apple's documentation at: https://support.apple.com/en-us/HT204837
Linux
Ubuntu Linux offers to encrypt your home folder during installation. If you decline the encryption and change your mind later, you don’t have to reinstall Ubuntu. You can activate the encryption with a few terminal commands using eCryptfs.
In a benchmark comparison of encryption tools within linux it follows that "LUKS dm-crypt" has the best performance, followed by "EXT4 fscrypt", and "eCryptfs" has the worse performance.
The "eCryptfs" is deprecated in favor of "EXT4 fscrypt".
With "LUKS dm-crypt" encryption you must at boot supply a password which decrypts your partitions.
Because on a laptop you are often the only user, and the "LUKS dm-crypt" encryption has the best performance, we can best use encryption of the home directory with "LUKS dm-crypt".
LUKS dm-crypt
https://wiki.archlinux.org/index.php/Dm-crypt
dm-crypt is the Linux kernel's device mapper crypto target. From Wikipedia:dm-crypt, it is:
A transparent disk encryption subsystem in [the] Linux kernel... [It is] implemented as a device mapper target and may be stacked on top of other device mapper transformations. It can thus encrypt whole disks (including removable media), partitions, software RAID volumes, logical volumes, as well as files. It appears as a block device, which can be used to back file systems, swap or as an LVM physical volume.
Fscrypt
https://wiki.archlinux.org/index.php/Fscrypt
The ext4, F2FS, and UBIFS file systems natively support file encryption via a common API called fscrypt (originally called "ext4 encryption"). With fscrypt, encryption is applied at the directory level. Different directories can use different encryption keys. In an encrypted directory, all file contents, filenames, and symlinks are encrypted. All subdirectories are encrypted too. Non-filename metadata, such as timestamps, the sizes and number of files, and extended attributes, is not encrypted.
If you want to protect an entire file system with one password, then block device encryption with dm-crypt is generally a better option, as it ensures that all file system metadata is encrypted. fscrypt is most useful if you only want to encrypt specific directories, or if you want different encrypted directories to be unlockable independently—for example, per-user encrypted home directories.
Better then eCryptfs
src: https://www.kernel.org/doc/html/latest/filesystems/fscrypt.html
Unlike eCryptfs, which is a stacked filesystem, fscrypt is integrated directly into supported filesystems — currently ext4, F2FS, and UBIFS. This allows encrypted files to be read and written without caching both the decrypted and encrypted pages in the pagecache, thereby nearly halving the memory used and bringing it in line with unencrypted files. Similarly, half as many dentries and inodes are needed. eCryptfs also limits encrypted filenames to 143 bytes, causing application compatibility issues; fscrypt allows the full 255 bytes (NAME_MAX). Finally, unlike eCryptfs, the fscrypt API can be used by unprivileged users, with no need to mount anything.
eCryptfs (deprecated!!)
update: Ubuntu 18.04 LTS and newer Ubuntu versions no longer include an option in the installer to encrypt the home directory. This option was removed from the Ubuntu installer because it uses eCryptfs, which is considered "buggy, under-maintained", and the recommended alternative is a full disk encryption using LUKS.
see https://www.linuxuprising.com/2018/04/how-to-encrypt-home-folder-in-ubuntu.html
Ubuntu 14.04 uses eCryptfs as the standard for folder encryption. When you log in, your home directory is automatically decrypted with your password. While there is a performance penalty to encryption, it can keep private data confidential, particularly on laptops that may be stolen.
For instructions how to encrypt your home folder with ubuntu read the following webpage:
https://www.howtogeek.com/116032/how-to-encrypt-your-home-folder-after-installing-ubuntu/(before 18.04) or https://www.linuxuprising.com/2018/04/how-to-encrypt-home-folder-in-ubuntu.html(for 18.04 and later)
VeraCrypt (cross platform solution)
The VeraCrypt GUI lends itself for the encryption tasks:
- encrypt containers for particularly security-critical files
- encrypt usb-sticks
VeraCrypt impresses in three scenarios:
- Access to VeraCrypt-encrypted objects is possible across platforms with Linux, Mac OS X, and Windows;
- the GUI is ideal for volumes unlocked only when needed, whereas the Linux on-board tools play to their strengths with system-integrated, permanently mounted filesystems;
- hidden VeraCrypt containers cannot be demonstrated to exist "by design," which adds security that you might need depending on the political situation in your country.
USB-stick or external hard disk
Besides your laptop, you can also encrypt your USB-stick or external hard disk.
Use VeraCrypt if you want a cross-platform solution, because VeraCrypt is supported on all OS's.
For Windows only you can use BitLocker to encrypt an USB-stick or external hard disk.
For a Mac computer only you can use FileVault to encrypt an USB-stick or external hard disk through the Finder:
- Connect the device to your computer
- Right click on the device in the Finder
- Click on [Encode 'disk name']
- Give up a password
- Click [Encode disk]
On Linux you can use VeraCrypt to encrypt an USB-stick or external hard disk.
Instead of encrypting the whole USB-stick or external hard disk with VeraCrypt you could instead create an encrypted volume file and store that on the USB-stick or external hard disk.
- Answer: File containers are normal files so you can work with them as with any normal files (file containers can be, for example, moved, renamed, and deleted the same way as normal files). Partitions/drives may be better as regards performance. Note that reading and writing to/from a file container may take significantly longer when the container is heavily fragmented. To solve this problem, defragment the file system in which the container is stored (when the VeraCrypt volume is dismounted).
Personally I prefer the simple approach of encrypting the whole device so its clear that files you put on that device are encrypted. Then when you want to access it you have to decrypt it immmediately and can use it easily as a normal none-encrypted device, but the files are backed up in the background automatically!
For usb-sticks I prefer using encrypting the wholed device with VeraCrypt and formatting it with the exFAT filesystem. Then you can easily access this usb-stick on any system, windows, linux or os x, and where VeraCrypt is installed!
Encrypted volume file
A volume file is a container of files and folders.
You can use VeraCrypt to make an encrypted file container. Using the password of the encrypted volume you can mount this container with VeraCrypt. When mounted you can put as many files and folders in this container which then automatically encrypted. Unencrypted data is stored in RAM and never on disk and when you log out or restart your computer this container gets automatically unmounted. For a quickstart see the VeraCrypt Beginner's Tutorial. Also look at the clear howtogeek documentation about VeraCrypt.
TrueCrypt is the predecessor of Veracrypt. TrueCrypt is now discontinued, but the project has been continued by a new team under a new name: VeraCrypt.
Encrypt Your Data in the Cloud
Most cloud services provide encryption to both protect files at rest and data in motion. Encryption of data in rest means server side encryption of your files. This means that the encryption key is also stored by the cloud store provider. So you must trust the provider. For example read Dropbox Encryption vs. Google Drive Encryption: Which is More Secure?
Radboud employees shouldn't use third party cloud services but should use SURFdrive: cloud storage from SURF
Important: in the case of SURFdrive all data transmitted over the networks is encrypted. But it doesn't support server side encryption! The Data Protection Policy therefore states that you must encrypt sensitive files when stored on SURFdrive. Critical files aren't allowed to be stored at SURFdrive even when they are encrypted!
In case you want to keep full control of your data you could apply client side encryption on the data stored in the cloud. Below we discuss different approaches to automate client side encryption in cloud storage.
From all solutions below I prefer Cryptomator because it gives you efficient per file encryption to cloud storage with file versioning and it's open source which lets you inspect whether there are no back-doors. If you don't care about file versioning you could also use DropBox with a VeraCrypt encrypted volume file.
encrypted volume file
A good tutorial how to use an encrypted volume file in your cloud storage read the good howtogeek tutorial "Protect Your Data in the Cloud with VeraCrypt".
limitations
A side-effect of storing your files in a VeraCrypt volume, where your cloud storage software does not have direct access to it, is that you will need to sync the entire VeraCrypt volume whenever you want to update even a single file in the volume. Depending on how your cloud provider does synchronization, this may mean that you need to do a full re-upload of the whole volume. Some cloud providers do block-level updates instead, eg. Dropbox does delta updates, which will only sync the portions of the volume which have actually changed. Even then however, the nature of encryption may still necessitate a data transfer that is larger than the individual file(s) being updated.
This can be mitigated by keeping your VeraCrypt volumes relatively small. Make them just large enough to store the files you want in them, with relatively little padding for growth.
However the combination VeraCrypt and DropBox seems to work fine:
VeraCrypt DOES in fact use a format that is delta-change friendly. This means that you can use it perfectly well with DropBox and similar cloud storage. I know this because I do! I have some large volumes that are synchronised to the cloud.
Note that this holds specifically for DropBox because DropBox supports delta synchronisation of data. Many other cloud storages don't support delta synchronisation.
Other limitations mentioned by the good tutorial The Ultimate Guide to Using TrueCrypt For Dropbox
- Once the file is encrypted, you will lose some of the best Dropbox features: file versioning, sharing and so on.
- If you’re not technically minded, TrueCrypt’s user interface might be confusing.
- It’s still a workaround to Dropbox’s shortcomings, and it’s not a perfect workaround either.
There is another solution which doesn't has this limitations is by using individual file encryption in your cloud storage. Tool which supports this are Boxcryptor and Cryptomator.
file-by-file encryption
By file-by-file encryption we mean that for a set of files in a container the encryption is done per file. If you have a container of encrypted files and you change a single file, then only that file needs to be reencrypted and saved. The storage of the container is then basicly a folder in which the encrypted files are stored. Users can access the container unencrypted by mounting a virtual drive. When you save a file to this virtual drive it will be encrypted in the background and saved encrypted in the container folder. If the storage folder is on a network share then the file will never be stored on your local computer but directly stored encrypted on your network share.
This is an improvement over solutions as VeraCrypt which encrypt and stores the whole container into a single image file. If you change a single file in VeraCrypt container you have to reencrypt and save a new version of the large image file.
Tools which support file-by-file encryption are Boxcryptor and Cryptomator. Although these tools are primarily meant to encrypt data efficiently on cloud storage you can also use them to store data encrypted on any other location you choice. E.g. network shares.
Personally I prefer Cryptomator because its open source which lets you inspect whether there are no back-doors.
BoxCryptor
Boxcryptor encrypts your sensitive files and folders in Dropbox, Google Drive, OneDrive and many other cloud storages. For good tutorial see How To Encrypt Your Cloud-Based Drive with Boxcryptor.
BoxCryptor is a Windows-based solution for file-by-file encryption using AES-256 bit encryption. It is compatible with the Encrypted Filesystem (EncFS) and thus your BoxCryptor encrypted files can be accessed on Mac OS X and Linux computers.
BoxCryptor is a commercial tool; for prices look at its pricing page. A basic version for individual usage is for free.
By default BoxCryptor encrypts the filenames. This filename encryption is a nice security boost but it breaks the file versioning system in Dropbox. If this will be an issue for your workflow make sure to check Advanced Mode and turn off the file name encryption. However for the free version of BoxCryptor filename encryption is not supported, and therefore not enabled. You need to buy a licence to get filename encryption enabled.
Cryptomator
Since 2016 there is an open source alternative for BoxCryptor called Cryptomator.
Features:
- Free client-side encryption for your cloud files.
- Open source software: No backdoors, no registration.
- Transparent encryption
While the vault containing your encrypted data resides somewhere in your cloud folder, Cryptomator provides a virtual hard drive through which you can access your files. - Files get encrypted individually
Compared to other disk encryption utilities, Cryptomator encrypts each file individually. So if you edit just a small text file, only the corresponding encrypted file is changed.
This way the synchronization client of your cloud storage provider knows exactly what needs to be uploaded and what doesn't.
Cryptomator integrates with
- Cyberduck: remote file browser
- Cyberduck is a libre FTP, SFTP, WebDAV, Amazon S3, OpenStack Swift, Backblaze B2, Microsoft Azure & OneDrive, Google Drive and Dropbox browser for Mac and Windows.
- Cyberduck has builtin support for Cryptomator letting you do client side encryption of files on any previous mentioned file storages.
- Cyberduck is libre
- Mountain Duck: remote file share mounter
- Mountain Duck lets you mount server and cloud storage as a local disk in the Finder.app on Mac and the File Explorer on Windows. Open remote files with any application and work like on a local volume.
- To use it you need to buy a license.
Cryptomator always encrypts the filenames. This filename encryption is a nice security boost but it breaks the file versioning system in Dropbox or any other cloud storage provider. If this will be an issue for your workflow use BoxCryptor instead which has an option to disable it. For now Cryptomator doesn't has this option.