diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:44:57 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:44:57 -0500 |
| commit | 83fdbfbfe6e7e8906e3a3f8f6bc074d887e92109 (patch) | |
| tree | 977e10a076d76fdb2622f089211f3d0954ba6873 /security/root_plug.c | |
| parent | d9b2c4d0b03c721808c0d259e43a27f1e80205bc (diff) | |
| parent | c84d6efd363a3948eb32ec40d46bab6338580454 (diff) | |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (30 commits)
TOMOYO: Add recursive directory matching operator support.
remove CONFIG_SECURITY_FILE_CAPABILITIES compile option
SELinux: print denials for buggy kernel with unknown perms
Silence the existing API for capability version compatibility check.
LSM: Move security_path_chmod()/security_path_chown() to after mutex_lock().
SELinux: header generation may hit infinite loop
selinux: Fix warnings
security: report the module name to security_module_request
Config option to set a default LSM
sysctl: require CAP_SYS_RAWIO to set mmap_min_addr
tpm: autoload tpm_tis based on system PnP IDs
tpm_tis: TPM_STS_DATA_EXPECT workaround
define convenient securebits masks for prctl users (v2)
tpm: fix header for modular build
tomoyo: improve hash bucket dispersion
tpm add default function definitions
LSM: imbed ima calls in the security hooks
SELinux: add .gitignore files for dynamic classes
security: remove root_plug
SELinux: fix locking issue introduced with c6d3aaa4e35c71a3
...
Diffstat (limited to 'security/root_plug.c')
| -rw-r--r-- | security/root_plug.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/security/root_plug.c b/security/root_plug.c deleted file mode 100644 index 2f7ffa67c4d2..000000000000 --- a/security/root_plug.c +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Root Plug sample LSM module | ||
| 3 | * | ||
| 4 | * Originally written for a Linux Journal. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2002 Greg Kroah-Hartman <greg@kroah.com> | ||
| 7 | * | ||
| 8 | * Prevents any programs running with egid == 0 if a specific USB device | ||
| 9 | * is not present in the system. Yes, it can be gotten around, but is a | ||
| 10 | * nice starting point for people to play with, and learn the LSM | ||
| 11 | * interface. | ||
| 12 | * | ||
| 13 | * If you want to turn this into something with a semblance of security, | ||
| 14 | * you need to hook the task_* functions also. | ||
| 15 | * | ||
| 16 | * See http://www.linuxjournal.com/article.php?sid=6279 for more information | ||
| 17 | * about this code. | ||
| 18 | * | ||
| 19 | * This program is free software; you can redistribute it and/or | ||
| 20 | * modify it under the terms of the GNU General Public License as | ||
| 21 | * published by the Free Software Foundation, version 2 of the | ||
| 22 | * License. | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include <linux/kernel.h> | ||
| 26 | #include <linux/init.h> | ||
| 27 | #include <linux/security.h> | ||
| 28 | #include <linux/usb.h> | ||
| 29 | #include <linux/moduleparam.h> | ||
| 30 | |||
| 31 | /* default is a generic type of usb to serial converter */ | ||
| 32 | static int vendor_id = 0x0557; | ||
| 33 | static int product_id = 0x2008; | ||
| 34 | |||
| 35 | module_param(vendor_id, uint, 0400); | ||
| 36 | module_param(product_id, uint, 0400); | ||
| 37 | |||
| 38 | /* should we print out debug messages */ | ||
| 39 | static int debug = 0; | ||
| 40 | |||
| 41 | module_param(debug, bool, 0600); | ||
| 42 | |||
| 43 | #define MY_NAME "root_plug" | ||
| 44 | |||
| 45 | #define root_dbg(fmt, arg...) \ | ||
| 46 | do { \ | ||
| 47 | if (debug) \ | ||
| 48 | printk(KERN_DEBUG "%s: %s: " fmt , \ | ||
| 49 | MY_NAME , __func__ , \ | ||
| 50 | ## arg); \ | ||
| 51 | } while (0) | ||
| 52 | |||
| 53 | static int rootplug_bprm_check_security (struct linux_binprm *bprm) | ||
| 54 | { | ||
| 55 | struct usb_device *dev; | ||
| 56 | |||
| 57 | root_dbg("file %s, e_uid = %d, e_gid = %d\n", | ||
| 58 | bprm->filename, bprm->cred->euid, bprm->cred->egid); | ||
| 59 | |||
| 60 | if (bprm->cred->egid == 0) { | ||
| 61 | dev = usb_find_device(vendor_id, product_id); | ||
| 62 | if (!dev) { | ||
| 63 | root_dbg("e_gid = 0, and device not found, " | ||
| 64 | "task not allowed to run...\n"); | ||
| 65 | return -EPERM; | ||
| 66 | } | ||
| 67 | usb_put_dev(dev); | ||
| 68 | } | ||
| 69 | |||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | |||
| 73 | static struct security_operations rootplug_security_ops = { | ||
| 74 | .bprm_check_security = rootplug_bprm_check_security, | ||
| 75 | }; | ||
| 76 | |||
| 77 | static int __init rootplug_init (void) | ||
| 78 | { | ||
| 79 | /* register ourselves with the security framework */ | ||
| 80 | if (register_security (&rootplug_security_ops)) { | ||
| 81 | printk (KERN_INFO | ||
| 82 | "Failure registering Root Plug module with the kernel\n"); | ||
| 83 | return -EINVAL; | ||
| 84 | } | ||
| 85 | printk (KERN_INFO "Root Plug module initialized, " | ||
| 86 | "vendor_id = %4.4x, product id = %4.4x\n", vendor_id, product_id); | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | |||
| 90 | security_initcall (rootplug_init); | ||
