]> sourceware.org Git - systemtap.git/blame - README.security
stapbpf PR22330 fixes :: identify format types of pe_unknown arguments
[systemtap.git] / README.security
CommitLineData
98aab489
DS
1Systemtap builds kernel modules. To insert a kernel module on a
2system, root access is needed.
3
4SECURITY MODEL
5==============
6
4a99c075 7Originally sudo(8) was used to grant root access. After compiling a
98aab489
DS
8new kernel module, stap ran "sudo staprun module_path". This worked,
9but required all systemtap users to have root access. Many sysadmins
10on enterprise systems do not have root access.
11
12So, a new security model was developed. To run the staprun program
efc4bf9a 13(which installs systemtap kernel modules), a user must be one of the
98aab489
DS
14following:
15
16 * the root user;
17
b7565b41 18 * a member of both 'stapdev' and 'stapusr' groups; or
98aab489
DS
19
20 * a member of the 'stapusr' group. Members of the stapusr group can
21 only use modules located in the /lib/modules/VERSION/systemtap
22 directory (where VERSION is the output of "uname -r"). This
23 directory must be owned by root and not be world writable.
24
4a99c075 25So, there are two classes of users: systemtap developers (the root user
b7565b41
FCE
26and members of the stapdev/stapusr groups) and systemtap users (members of
27only the stapusr group). Systemtap developers can compile and run any
98aab489
DS
28systemtap script. Systemtap users can only run "approved"
29pre-compiled modules located in /lib/modules/VERSION/systemtap.
30
31USAGE
32=====
33
34Here's the usage case. A systemtap developer hears of a problem on a
35production machine (which doesn't have a compiler or kernel debuginfo
36installed). So, he write a systemtap script to probe certain areas of
37the kernel that will give him a better idea of what is going on. He
38develops the script on a development machine (that has the compiler
39and kernel debuginfo installed). Once he is satisfied with the
40systemtap script, he creates the systemtap kernel module and copies it
41to /lib/modules/VERSION/systemtap on the target production machine.
42He then asks a systemtap user on that machine to run the module and
43report the results.
44
45The above usage case would look something like this:
46
47On the development machine:
48# vi pmod.stp
49(The systemtap developer writes the systemtap script.)
50
51# stap -m pmod pmod.stp
52(The systemtap developer compiles and runs the script. If necessary,
53the script may need to be edited to fix any errors.)
54
55# scp pmod.ko prod_machine:/lib/modules/`uname -r`/systemtap
4a99c075 56(The systemtap developer copies the compiled kernel module to the proper
98aab489
DS
57directory on the production machine. Of course other methods - ftp,
58nfs, etc. could be used to transfer the module.)
59
60On the production machine:
61$ staprun pmod
62(The systemtap user runs the newly developed systemtap kernel module.)
63
64There are (at least) 2 different usage scenarios for the
65/lib/modules/VERSION/systemtap directory.
66
e27dbba8
JL
671) Most restrictive usage. If only root should be able to add
68"approved" systemtap modules to /lib/modules/VERSION/systemtap, the
69permissions should be 755, like this:
98aab489
DS
70
71drwxr-xr-x 2 root root 4096 2007-08-07 13:54 systemtap/
72
732) More permissive usage. If all systemtap developers should be able
b515db67 74to add "approved" systemtap modules to /lib/modules/VERSION/systemtap,
98aab489
DS
75its permissions should be 775 (and be owned by root, group stapdev),
76like this:
77
78drwxrwxr-x 2 root stapdev 4096 2007-08-07 13:54 systemtap/
79
80INTERNALS
81=========
82
83To accomplish the new security model, staprun has been split into two
84programs: staprun and stapio.
85
86Here is a description of a typical systemtap session. The staprun
87program is a setuid program that does some system setup, loads the
88kernel module, then runs stapio (and waits for it to finish). The
89stapio program runs as the invoking user and is responsible for all
90communication with the kernel module. After the script runs to
08173df8
FCE
91completion, stapio fork/execs staprun -d to unload the kernel module.
92
c5bbe373 93staprun is a setuid program. It holds on to the root privileges only
08173df8
FCE
94for the least amount of time (as required to verify/load compiled
95kernel module files). It invokes only stapio, and only as the
96original (unprivileged) user.
97
This page took 0.111886 seconds and 5 git commands to generate.