1SUDOREPLAY(8) BSD System Manager's Manual SUDOREPLAY(8)
2
4 sudoreplay — replay sudo session logs
5
7 sudoreplay [-h] [-d directory] [-f filter] [-m max_wait]
8 [-s speed_factor] ID
9
10 sudoreplay [-h] [-d directory] -l [search expression]
11
13 sudoreplay plays back or lists the output logs created by sudo. When
14 replaying, sudoreplay can play the session back in real-time, or the
15 playback speed may be adjusted (faster or slower) based on the command
16 line options.
17
18 The ID should either be a six character sequence of digits and upper case
19 letters, e.g. 0100A5, or a pattern matching the iolog_file option in the
20 sudoers file. When a command is run via sudo with log_output enabled in
21 the sudoers file, a TSID=ID string is logged via syslog or to the sudo
22 log file. The ID may also be determined using sudoreplay's list mode.
23
24 In list mode, sudoreplay can be used to find the ID of a session based on
25 a number of criteria such as the user, tty or command run.
26
27 In replay mode, if the standard output has not been redirected,
28 sudoreplay will act on the following keys:
29
30 ‘ ’ (space) Pause output; press any key to resume.
31
32 ‘<’ Reduce the playback speed by one half.
33
34 ‘>’ Double the playback speed.
35
36 The options are as follows:
37
38 -d directory Use directory to for the session logs instead of the
39 default, /var/log/sudo-io.
40
41 -f filter By default, sudoreplay will play back the command's stan‐
42 dard output, standard error and tty output. The -f option
43 can be used to select which of these to output. The filter
44 argument is a comma-separated list, consisting of one or
45 more of following: stdout, stderr, and ttyout.
46
47 -h The -h (help) option causes sudoreplay to print a short
48 help message to the standard output and exit.
49
50 -l [search expression]
51 Enable “list mode”. In this mode, sudoreplay will list
52 available sessions in a format similar to the sudo log file
53 format, sorted by file name (or sequence number). If a
54 search expression is specified, it will be used to restrict
55 the IDs that are displayed. An expression is composed of
56 the following predicates:
57
58 command pattern
59 Evaluates to true if the command run matches
60 pattern. On systems with POSIX regular expression
61 support, the pattern may be an extended regular
62 expression. On systems without POSIX regular
63 expression support, a simple substring match is
64 performed instead.
65
66 cwd directory
67 Evaluates to true if the command was run with the
68 specified current working directory.
69
70 fromdate date
71 Evaluates to true if the command was run on or
72 after date. See Date and time format for a
73 description of supported date and time formats.
74
75 group runas_group
76 Evaluates to true if the command was run with the
77 specified runas_group. Note that unless a
78 runas_group was explicitly specified when sudo was
79 run this field will be empty in the log.
80
81 runas runas_user
82 Evaluates to true if the command was run as the
83 specified runas_user. Note that sudo runs commands
84 as user root by default.
85
86 todate date
87 Evaluates to true if the command was run on or
88 prior to date. See Date and time format for a
89 description of supported date and time formats.
90
91 tty tty name
92 Evaluates to true if the command was run on the
93 specified terminal device. The tty name should be
94 specified without the /dev/ prefix, e.g. tty01
95 instead of /dev/tty01.
96
97 user user name
98 Evaluates to true if the ID matches a command run
99 by user name.
100
101 Predicates may be abbreviated to the shortest unique string
102 (currently all predicates may be shortened to a single
103 character).
104
105 Predicates may be combined using and, or and ! operators as
106 well as ‘(’ and ‘)’ grouping (note that parentheses must
107 generally be escaped from the shell). The and operator is
108 optional, adjacent predicates have an implied and unless
109 separated by an or.
110
111 -m max_wait Specify an upper bound on how long to wait between key
112 presses or output data. By default, sudoreplay will accu‐
113 rately reproduce the delays between key presses or program
114 output. However, this can be tedious when the session
115 includes long pauses. When the -m option is specified,
116 sudoreplay will limit these pauses to at most max_wait sec‐
117 onds. The value may be specified as a floating point num‐
118 ber, e.g. 2.5.
119
120 -s speed_factor
121 This option causes sudoreplay to adjust the number of sec‐
122 onds it will wait between key presses or program output.
123 This can be used to slow down or speed up the display. For
124 example, a speed_factor of 2 would make the output twice as
125 fast whereas a speed_factor of .5 would make the output
126 twice as slow.
127
128 -V The -V (version) option causes sudoreplay to print its ver‐
129 sion number and exit.
130
131 Date and time format
132 The time and date may be specified multiple ways, common formats include:
133
134 HH:MM:SS am MM/DD/CCYY timezone
135 24 hour time may be used in place of am/pm.
136
137 HH:MM:SS am Month, Day Year timezone
138 24 hour time may be used in place of am/pm, and month and day
139 names may be abbreviated. Note that month and day of the week
140 names must be specified in English.
141
142 CCYY-MM-DD HH:MM:SS
143 ISO time format
144
145 DD Month CCYY HH:MM:SS
146 The month name may be abbreviated.
147
148 Either time or date may be omitted, the am/pm and timezone are optional.
149 If no date is specified, the current day is assumed; if no time is speci‐
150 fied, the first second of the specified date is used. The less signifi‐
151 cant parts of both time and date may also be omitted, in which case zero
152 is assumed.
153
154 The following are all valid time and date specifications:
155
156 now The current time and date.
157
158 tomorrow
159 Exactly one day from now.
160
161 yesterday
162 24 hours ago.
163
164 2 hours ago
165 2 hours ago.
166
167 next Friday
168 The first second of the next Friday.
169
170 this week
171 The current time but the first day of the coming week.
172
173 a fortnight ago
174 The current time but 14 days ago.
175
176 10:01 am 9/17/2009
177 10:01 am, September 17, 2009.
178
179 10:01 am
180 10:01 am on the current day.
181
182 10 10:00 am on the current day.
183
184 9/17/2009
185 00:00 am, September 17, 2009.
186
187 10:01 am Sep 17, 2009
188 10:01 am, September 17, 2009.
189
191 /var/log/sudo-io The default I/O log directory.
192
193 /var/log/sudo-io/00/00/01/log
194 Example session log info.
195
196 /var/log/sudo-io/00/00/01/stdin
197 Example session standard input log.
198
199 /var/log/sudo-io/00/00/01/stdout
200 Example session standard output log.
201
202 /var/log/sudo-io/00/00/01/stderr
203 Example session standard error log.
204
205 /var/log/sudo-io/00/00/01/ttyin
206 Example session tty input file.
207
208 /var/log/sudo-io/00/00/01/ttyout
209 Example session tty output file.
210
211 /var/log/sudo-io/00/00/01/timing
212 Example session timing file.
213
214 Note that the stdin, stdout and stderr files will be empty unless sudo
215 was used as part of a pipeline for a particular command.
216
218 List sessions run by user millert:
219
220 # sudoreplay -l user millert
221
222 List sessions run by user bob with a command containing the string vi:
223
224 # sudoreplay -l user bob command vi
225
226 List sessions run by user jeff that match a regular expression:
227
228 # sudoreplay -l user jeff command '/bin/[a-z]*sh'
229
230 List sessions run by jeff or bob on the console:
231
232 # sudoreplay -l ( user jeff or user bob ) tty console
233
235 sudo(8), script(1)
236
238 Todd C. Miller
239
241 If you feel you have found a bug in sudoreplay, please submit a bug
242 report at http://www.sudo.ws/sudo/bugs/
243
245 Limited free support is available via the sudo-users mailing list, see
246 http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the
247 archives.
248
250 sudoreplay is provided “AS IS” and any express or implied warranties,
251 including, but not limited to, the implied warranties of merchantability
252 and fitness for a particular purpose are disclaimed. See the LICENSE
253 file distributed with sudo or http://www.sudo.ws/sudo/license.html for
254 complete details.
255
256Sudo 1.8.6p3 July 12, 2012 Sudo 1.8.6p3