CSE544 - Project #2 - CW-Lite LSM Module

Due Date: Th March 1, 2018 at 11:59pm.

In this assignment, you will complete a Linux Security Module that implements CW-Lite integrity over file operations.

Follow these instructions:

  1. Get the module code from here. This code contains three files: (1) sample.c, which contains an incomplete Linux Security Module that includes stubs for a set of authorization hooks (place in directory linux-2.6.23/security) and (2) Makefile, which enables sample.c to be compiled for the kernel (place in linux-2.6.23/security); and (3) p2-user.tgz, which contains user-space code to test your LSM implementation.

  2. The first major task is to compile your Linux kernel (version 2.6.23) in your experimental environment, so that you can develop and test your sample LSM. Instructions for this task follow:

  3. The goal of this project is to add code to the selected LSM authorization hooks (see the variable sample_ops in sample.c) as necessary to enforce CW-Lite integrity (see the CWLite paper) over file operations. Your project tasks are highlighted by the phrase "YOUR CODE" in the sample.c file. In general, the LSM implementation must perform the following two tasks:

  4. Background: To build your LSM, you will need to know the following background.

  5. To Set CW-Lite Filtering: Your LSM must create a file in the debugfs filesystem, which is located at /sys/kernel/debug/ on your VM for processes to tell the kernel their CW-Lite state.

    To create a debugfs file in a kernel module see the Debugfs Guidance. You will add code to sample.c to implement these actions (create the debugfs filesystem and implement file operations). You need to create a debugfs file that supports the operations performed from user space by the cwlite.h code, which turns CW-Lite filtering on and off in the kernel. Each operation writes one-byte string (2 bytes with null termination) to the debugfs file. Please perform the following steps:

  6. To Enforce CW-Lite: Students must complete the code to assign labels to running processes and implement the authorization hooks to enable enforcement of CW-Lite policies. The tasks to be performed are listed below:

  7. I will assign some test programs to run in the future.

  8. A log of the session will be captured in /var/log/messages. The statements identify the files that were authorized and not authorized by has_perm.

  9. NOTE: Currently, the sample LSM only logs authorization decisions, but does not actually block operations. An LSM authorization hook will block an operation if it returns any value other than 0. Be careful that you either return 0 or only block operations you intend to. Otherwise, other processes will stop working (you have the power, so be careful!).

  10. Please submit your sample.c and your log of the run on the test programs. Also, please submit a list of all the files you had to mark as SAMPLE_TRUSTED to run the test programs on your VM. I will also need information to run your LSM in your VM to test it (e.g., if you changed the password).

When you have completed your module, submit it, the output, and the file labeling, and information necessary to access your VM via Canvas by 11:59pm on Th March 1, 2018. Make sure that you have tested your submission prior to uploading. I will test on your VM.

You are to complete this on your own. Any sharing of code or help during the coding of this project is expressly forbidden. Do not discuss this project with anyone.


Trent Jaeger