]> sourceware.org Git - systemtap.git/blob - README.unprivileged
Allow utrace_syscall_args.stp to accepts arm64 use of syscall.openat
[systemtap.git] / README.unprivileged
1 Unprivileged Mode for Systemtap Users
2 =====================================
3
4 Introduction
5 ------------
6 In order to use the full capabilities of systemtap, one must run it as root or
7 as a member of the groups stapusr and stapdev. For other (unprivileged) users, systemtap
8 does provide support for use of a subset of systemtap's capabilities to perform
9 limited probing. For example, tracing your own applications or
10 polling using timers. The intent is to give unprivileged users capabilities
11 similar to those provided by a debugger.
12
13 Below are instructions for running systemtap scripts in unprivileged mode.
14
15 Systemtap Compile Server
16 ------------------------
17 In order to load the kernel module produced by compiling a systemtap script
18 for an unprivileged user, we must know that the script was compiled correctly
19 and that the script does not do anything dangerous. A systemap compile server
20 provides the trusted compilation environment needed to certify both conditions.
21
22 NOTE: In order to use a compile server, the nss and nspr packages must be
23 installed on the client host and systemtap must have been built with
24 NSS enabled. Run 'stap -V | grep NSS' to find out if NSS is enabled.
25
26 NOTE: In order to detect servers on the local network, the avahi package must be
27 installed on the client host and systemtap must have been built with avahi
28 enabled. Run 'stap -V | grep AVAHI' to find out if avahi is enabled.
29
30 To find out if a suitable server is available on the local network, this
31 command should produce output similar to the following:
32
33 # stap --list-servers --privileged=stapusr
34 Systemtap Compile Server Status for 'online,trusted,compatible,signer'
35 host=somehost ip=10.15.16.156 port=10913 sysinfo="2.6.34.7-66.fc13.x86_64 x86_64" certinfo="00:93:49:be:2a"
36
37 NOTE: In order for servers to be detected, the port for mDNS (5353/udp)
38 must be open on the server and client hosts.
39
40 If no servers are listed, then you must ask your system administrator to
41 make the appropriate compile server available on the local host or on the
42 local network. The server must be trusted as an ssl peer and as a systemtap
43 module signer on the local host.
44
45 See "Setup and Administration of Unprivileged Users for System Administrators"
46 below for more details.
47
48 Trust of Unprivileged Users
49 ---------------------------
50 Even with the appropriate compile server available, each
51 unprivileged user must be explicitly trusted. This is done by adding each
52 unprivileged user to the group stapusr and possibly the group stapsys
53 on each host on which they will
54 run systemtap scripts. To see if you are a member of the group stapusr on the
55 local host, this command should produce output similar to the following:
56
57 # getent group stapusr
58 stapusr:x:483:someuser,anotheruser
59
60 If your userid is listed, then you are already a member of the group stapusr.
61 If it is not, then you must ask your system administrator to add you to this
62 group.
63
64 Once added, Try the command
65
66 newgrp stapusr
67
68 to activate your membership. If all else fails, logging out and back in
69 again should work. See the manual page for newgrp(1) for details.
70
71 Using Systemtap in Unprivileged Mode
72 ------------------------------------
73 Unprivileged users can compile any systemtap script either directly or using
74 a compile server, but systemtap will not load the resulting kernel module
75 for an unprivileged user unless it has been compiled and certified by a
76 trusted compile server. To do this, as an unprivileged user,
77 this command should produce output similar to the following:
78
79 # stap -e 'probe begin { printf ("Hello\n"); exit (); }'
80 Hello
81
82 For unprivileged users, stap will automatically add the options
83 --privilege and --use-server (you could also specify them yourself).
84
85 --use-server tells systemtap to compile the script using a server.
86
87 --privilege tells the server to check the script to maker sure it
88 doesn't do anything 'dangerous', i.e. nothing that a user
89 with the specified privilege credentials shouldn't be able to do.
90
91 If the server approves of your script and is able to compile it, systemtap will then load the
92 resulting module for you even though you are an unprivileged user.
93
94 If you save the resulting module by using the -p4 option of stap, then trusted,
95 unprivileged users can load the module at a later time using staprun:
96
97 # stap -e 'probe begin { printf ("Hello\n"); exit (); }' -p4
98 stap_5330.ko
99 # staprun stap_5330.ko
100 Hello
101
102 Note that the module has already been certified (signed), so no special options
103 are needed.
104
105 Additional Information
106 ----------------------
107 o When specifying path names in your script and compiling using a server,
108 you must use a server which has access to those paths (e.g. via nfs, or a
109 server on the local host) and you must specify the paths in full from the
110 servers's point of view. For example, specify
111
112 probe process("foo").begin()
113
114 as
115
116 probe process("/the/full/path/as/seen/by/the/server/to/foo").begin()
117
118 o You can use '--privilege=[stapusr|stapsys] -pN' (for 1 <= N <= 4) without --use-server to
119 compile and check scripts directly. stap will still check your script for
120 'dangerous' behavior, but will not load it for an unprivileged user.
121
122 o When using --privilege, all compile time and run time restrictions are
123 enforced for all users, including root and members of the group stapdev.
124
125
126
127 Setup and Administration of Unprivileged Users for System Administrators
128 ========================================================================
129
130 Introduction
131 ------------
132 In order to use the full capabilities of systemtap, one must run it as root or
133 as a member of the group stapdev. For other (unprivileged) users, systemtap
134 does provide support for use of a subset of systemtap's capabilities to perform
135 limited probing. For example, tracing your own applications or
136 polling using timers. The intent is to give unprivileged users capabilities
137 similar to those provided by a debugger.
138
139 In order for this to happen, the system administrator must first perform some
140 setup:
141
142 o Systemtap compile server(s) must be made available on the local network.
143 One server is needed for each kernel version and architecture pair for which
144 users will compile scripts.
145
146 o The compile server(s) must be trusted as an SSL peer and as a signer of
147 systemtap modules on hosts on which unprivileged users will compile and
148 run their scripts respectively.
149
150 o Unprivileged users must be added to the group stapusr, and possibly the group stapsys
151 on the host(s) on which they will run their scripts.
152
153 Below are the necessary steps for the system administrator to setup the above
154 infrastructure.
155
156 Systemtap Compile Server
157 ------------------------
158 In order to load the kernel module produced by compiling a systemtap script
159 for an unprivileged user, we must know that the script was compiled correctly
160 and that the script does not do anything dangerous. A systemap compile server
161 provides a trusted environment needed to certify both conditions.
162
163 In order to make a compile server available on the local network the
164 systemtap-server package and its prerequisites must be installed on the server
165 host.
166
167 The system administrator then uses the following command:
168
169 sudo service stap-server start [-r KERNEL-RELEASE] [-a ARCH]
170
171 For example:
172
173 # sudo service stap-server start -r 2.6.34.7-61.fc13.x86_64 -a x86_64
174 Starting stap-server -a "x86_64" -r "2.6.34.7-61.fc13.x86_64" -u "stap-server"
175 [ OK ]
176
177 This starts a compile server for the specified kernel release and hardware
178 architecture. The kernel and kernel-devel package for the specified release and
179 architecture must be installed on the server host. The kernel-debuginfo package
180 for each kernel release and architecture should also be installed, but is not
181 relevant for unprivileged users.
182
183 If either one (or both) the kernel release and/or architecture is not
184 specified, the kernel release and/or architecture of the server host will be
185 used:
186
187 # sudo service stap-server start
188 Starting stap-server -a "x86_64" -r "2.6.34.7-66.fc13.x86_64" -u "stap-server"
189 [ OK ]
190
191 As a short cut, to start a server for each kernel release and architecture
192 installed on the server host, use the command:
193
194 # sudo service stap-server start -i
195 Starting stap-server -a "x86_64" -r "2.6.34.7-61.fc13.x86_64" -u "stap-server"
196 [ OK ]
197 Starting stap-server -a "x86_64" -r "2.6.34.7-63.fc13.x86_64" -u "stap-server"
198 [ OK ]
199 Starting stap-server -a "x86_64" -r "2.6.34.7-66.fc13.x86_64" -u "stap-server"
200 [ OK ]
201
202 NOTE: Only root can start a systemtap server using the service command.
203
204 Trust of Compile Servers
205 ------------------------
206 Once systemtap compile servers have been made available on the local network,
207 the system administrator must certify which ones are trusted as SSL peers,
208 as systemtap kernel module signers or both.
209
210 Certifying a compile server as an SSL peer means what the system administrator
211 trusts that it compiles systemtap scripts correctly.
212
213 Certifying a compile server as a module signer means that the system
214 administrator trusts it to correctly check a systemtap script for
215 behavior which should not be made available to unprivileged users. When a
216 script is compiled using the --privilege option, the server checks the
217 script for such behavior and cryptographically signs the resulting module if it
218 is safe for use by unprivileged users. Verification of the signature certifies
219 that the module was certified as 'safe' by the server and that it has not been
220 altered since it was certified.
221
222 Systemtap compile servers started by using the 'service' command are
223 automatically trusted both as SSL peers and as module signers on the server's
224 host. No further setup of the servers is necessary for users (clients) on
225 that same host.
226
227 Before clients on another host can make use of a server, the system
228 administrator of each client host must certify trust in that server.
229 This is performed in two steps:
230
231 1) Identify the server(s) to be trusted.
232
233 # stap --list-servers=online,compatible
234 Systemtap Compile Server Status for 'online,compatible'
235 host=somehost ip=10.15.16.156 port=26543 sysinfo="2.6.34.7-66.fc13.x86_64 x86_64" certinfo="00:93:49:be:2a"
236
237 Identify the server(s) to be trusted by examining the
238 host name, ip address and sysinfo (kernel release and architecture). Take
239 note of the 'certinfo' field of each server to be trusted.
240
241 NOTE: In order for servers to be detected, the port for mDNS (5353/udp)
242 must be open on the server and client hosts.
243
244 2) For each server to be trusted for use by unprivileged clients, use the
245 command:
246
247 sudo stap --trust-servers=ssl,signer,all-users --use-server=CERTINFO1 [--use-server=CERTINFO2 ...]
248
249 where each CERTINFOn is the value of the 'certinfo' field of a server to be
250 trusted (obtained using the previous command).
251
252 For example:
253
254 # sudo stap --trust-servers=ssl,signer,all-users --use-server=00:93:49:be:2a
255 Add trust in the following servers as an SSL peer for all users and as a module signer for all users?
256 host=somehost ip=10.15.16.156 port=26543 sysinfo="2.6.34.7-66.fc13.x86_64 x86_64" certinfo="00:93:49:be:2a"
257 [y/N] y
258
259 Using the 'certinfo' to specify each server ensures that the exact servers
260 which were intended are the ones which become trusted. Note that only root
261 can certify trust in a server as signer in this way.
262
263 Now verify the result:
264
265 # stap --list-servers --privilege=stapusr
266 Systemtap Compile Server Status for 'online,trusted,compatible,signer'
267 host=somehost ip=10.15.16.156 port=26543 sysinfo="2.6.34.7-66.fc13.x86_64 x86_64" certinfo="00:93:49:be:2a"
268
269 Each of the servers you specified in stap 2 above should be listed.
270
271 Trust of Unprivileged Users
272 ---------------------------
273 Finally, once compile servers have been set up and are trusted, each
274 unprivileged user must be explicitly trusted. This is done by adding each
275 unprivileged user to the group stapusr, and possibly the group stapsys on each host on which they
276 will run systemtap scripts:
277
278 sudo usermod -a -G stapusr[,stapsys] USERID
279
280 If the user is already logged in, they can try using
281
282 newgrp stapusr
283
284 to activate their membership. If all else fails, logging out and back in
285 again should work. See newgrp(1) for details.
This page took 0.048597 seconds and 5 git commands to generate.