In this exercise you will simulate an encryption of an external memory (such as USB memory stick) using a file as the storage media. Simulation is needed because there is no physical access to the server machines (in addition, the servers are virtual). Two different schemes will be used: encrypted loopback device with dm_crypt and encryption layer for an existing filesystem with encFS. However, we will begin by familiarizing with GPG and encrypting single files.
Check that you have the following packages installed:
Load the dm_crypt and aeskernel modules. Please remove cryptoloop from use, if its attached to the kernel.
For the fourth exercise, ensure that you have encFS installed and FUSE is available. This should be done in similar fashion as the earlier checks.
lsmod(8), modprobe(8)
Begin by creating a GPG keypair on both lab1 and lab2 using the RSA algorithm and 2048 bit keys. Exchange (and verify) the public keys between lab1 and lab2.
Create a plaintext file with some text in it on lab1. Encrypt the file using lab2's public key, and send the encryted file to lab2. Now decrypt the file.
Finally, sign a plaintext file on lab2, send the file with its signature to lab1. Verify on lab1 that it really was the lab2 user that signed the message.
2.1 | Provide the commands you used and explain what they do. | 2 p |
2.2 | Are there any security problems in using GPG like this? | 1 p |
2.3 | How does GPG relate to PGP? | 1 p |
2.4 | What is haveged and why did we install it earlier? What possible problems can usage of haveged have? | 1 p |
Create a file with random bytes to make it harder for the attacker to recognize which parts of device are used to store data, and which are left empty. This can be done with the command:
dd if=/dev/urandom of=loop.img bs=1k count=8k
Create a loopback device for the file using losetup(8). Then using cryptsetup(8), format the loopback device and map it to a pseudo-device. Please use LUKS with aes-cbc-essiv:sha256 cipher (should be default).
Create an ext2 filesystem on the pseudo-device, created in the previous step. The filesystem can be created with mkfs.ext2(8).
After this, you have successfully created an encrypted filesystem into a file. The filesystem is ready, and requires a passphrase to be entered when you luksOpen it.
Now mount your filesystem. Create some files and directories on the encrypted filesystem. Check also what happens if you try to mount the system with a wrong key.
3.1 | Provide the commands you used. | 2 p |
3.2 | Explain the concepts of the pseudo-device and loopback device. | 1 p |
3.3 | What is LUKS? (Knowing the meaning of abbreviation won't bring you a point.) | 1 p |
3.4 | What is this kind of encryption method good for? What strengths and weaknesses does it have? | 3 p |
3.5 | Why did we remove cryptoloop from the assignment and replaced it with dm_crypt? Extending the question a bit, what realities must a sysadmin remember with any to-be-deployed and already deployed security-related software? | 1 p |
Using encFS, mount an encrypted filesystem on a directory of your choice. This gives you the encryption layer. After this, create a few directories, and some files in them. Unmount encFS using Fuse's fusermount.
Check what was written on the file system.
4.1 | Provide the commands you used. | 1 p |
4.2 | Explain how this approach differs from the loopback one. Does this solve any problems or create more? | 3 p |
When finishing your work, please remember to backup your related files from the lab computers to a safe place (e.g. your home directory in Niksula or the Computer Center). The course does not provide any back up service for the virtual machines. If you report problems regarding your machines to the course personnel, note that they may get completely reset with all running configurations cleared.