CS 423: Operating Systems Design
Mohammad Noureddine Spring 2018
CS 423 Operating System Design: MP4 Walkthrough Mohammad - - PowerPoint PPT Presentation
CS 423 Operating System Design: MP4 Walkthrough Mohammad Noureddine Spring 2018 CS 423: Operating Systems Design Goals for Today Learning Objective: Understand Linux Security Modules Go through implementation details of MP4
CS 423: Operating Systems Design
Mohammad Noureddine Spring 2018
CS 423: Operating Systems Design 2
Reminder: Please put away devices at the start of class
CS 423: Operating Systems Design
3
CS 423: Operating Systems Design
4
CS 423: Operating Systems Design
5
CS 423: Operating Systems Design
6
CS 423: Operating Systems Design
7
CS 423: Operating Systems Design
8
CS 423: Operating Systems Design
9
CS 423: Operating Systems Design
10
CS 423: Operating Systems Design
11
CS 423: Operating Systems Design
12
CS 423: Operating Systems Design
13
CS 423: Operating Systems Design
14
CS 423: Operating Systems Design
15
CS 423: Operating Systems Design
16
CS 423: Operating Systems Design
17
CS 423: Operating Systems Design
18
#ifdef CONFIG_SECURITY_MP4_LSM void do_something(void) { printf(“MP4 active\n"); } #else void do_something(void) { } #endif
CS 423: Operating Systems Design
19
CS 423: Operating Systems Design
20
CS 423: Operating Systems Design
21
GRUB_CMDLINE_LINUX_DEFAULT=“security=mp4”
CS 423: Operating Systems Design
22
CS 423: Operating Systems Design
23
static struct security_hook_list mp4_hooks[] = { LSM_HOOK_INIT(inode_init_security, mp4_inode_init_security), LSM_HOOK_INIT(inode_permission, mp4_inode_permission), LSM_HOOK_INIT(bprm_set_creds, mp4_bprm_set_creds), LSM_HOOK_INIT(cred_alloc_blank, mp4_cred_alloc_blank), LSM_HOOK_INIT(cred_free, mp4_cred_free), LSM_HOOK_INIT(cred_prepare, mp4_cred_prepare) };
CS 423: Operating Systems Design
24
CS 423: Operating Systems Design
25
if (strcmp(cred_ctx, "read-only") == 0) return MP4_READ_OBJ; else if (strcmp(cred_ctx, "read-write") == 0) return MP4_READ_WRITE; else if (strcmp(cred_ctx, "exec") == 0) return MP4_EXEC_OBJ; else if (strcmp(cred_ctx, "target") == 0) return MP4_TARGET_SID; else if (strcmp(cred_ctx, "dir") == 0) return MP4_READ_DIR; else if (strcmp(cred_ctx, "dir-write") == 0) return MP4_RW_DIR; else return MP4_NO_ACCESS;
CS 423: Operating Systems Design
26
CS 423: Operating Systems Design
27
dentry *
need to know
allocate
CS 423: Operating Systems Design
28
CS 423: Operating Systems Design
29
Is program labeled with target? YES NO Is program allowed to access the inode? YES NO Is inode a directory? NO YES MAC Policy YES Is program allowed to access the inode? Deny access and log attempt! Allow access Allow access Deny access and log attempt! NO Decision MAC Query
CS 423: Operating Systems Design
30
CS 423: Operating Systems Design
31
CS 423: Operating Systems Design
32
setfattr -n security.mp4 -v target /usr/bin/cat ... setfattr -n security.mp4 -v read-only /home/netid/file.txt
setfattr -x security.mp4 /usr/bin/cat ... setfattr -x security.mp4 /home/netid/file.txt
CS 423: Operating Systems Design
33