1SUDOREPLAY(8) BSD System Manager's Manual SUDOREPLAY(8)
2
4 sudoreplay — replay sudo session logs
5
7 sudoreplay [-hnRS] [-d dir] [-f filter] [-m num] [-s num] ID
8
9 sudoreplay [-h] [-d dir] -l [search expression]
10
12 sudoreplay plays back or lists the output logs created by sudo. When
13 replaying, sudoreplay can play the session back in real-time, or the
14 playback speed may be adjusted (faster or slower) based on the command
15 line options.
16
17 The ID should either be a six character sequence of digits and upper case
18 letters, e.g., 0100A5, or a pattern matching the iolog_file option in the
19 sudoers file. When a command is run via sudo with log_output enabled in
20 the sudoers file, a TSID=ID string is logged via syslog or to the sudo
21 log file. The ID may also be determined using sudoreplay's list mode.
22
23 In list mode, sudoreplay can be used to find the ID of a session based on
24 a number of criteria such as the user, tty or command run.
25
26 In replay mode, if the standard input and output are connected to a ter‐
27 minal and the -n option is not specified, sudoreplay will operate inter‐
28 actively. In interactive mode, sudoreplay will attempt to adjust the
29 terminal size to match that of the session and write directly to the ter‐
30 minal (not all terminals support this). Additionally, it will poll the
31 keyboard and act on the following keys:
32
33 ‘\n’ or ‘\r’ Skip to the next replay event; useful for long pauses.
34
35 ‘ ’ (space) Pause output; press any key to resume.
36
37 ‘<’ Reduce the playback speed by one half.
38
39 ‘>’ Double the playback speed.
40
41 The session can be interrupted via control-C. When the session has fin‐
42 ished, the terminal is restored to its original size if it was changed
43 during playback.
44
45 The options are as follows:
46
47 -d dir, --directory=dir
48 Store session logs in dir instead of the default,
49 /var/log/sudo-io.
50
51 -f filter, --filter=filter
52 Select which I/O type(s) to display. By default, sudoreplay
53 will display the command's standard output, standard error
54 and tty output. The filter argument is a comma-separated
55 list, consisting of one or more of following: stdin, stdout,
56 stderr, ttyin, and ttyout.
57
58 -h, --help Display a short help message to the standard output and exit.
59
60 -l, --list [search expression]
61 Enable “list mode”. In this mode, sudoreplay will list
62 available sessions in a format similar to the sudo log file
63 format, sorted by file name (or sequence number). If a
64 search expression is specified, it will be used to restrict
65 the IDs that are displayed. An expression is composed of the
66 following predicates:
67
68 command pattern
69 Evaluates to true if the command run matches the
70 POSIX extended regular expression pattern.
71
72 cwd directory
73 Evaluates to true if the command was run with the
74 specified current working directory.
75
76 fromdate date
77 Evaluates to true if the command was run on or after
78 date. See Date and time format for a description of
79 supported date and time formats.
80
81 group runas_group
82 Evaluates to true if the command was run with the
83 specified runas_group. Note that unless a
84 runas_group was explicitly specified when sudo was
85 run this field will be empty in the log.
86
87 runas runas_user
88 Evaluates to true if the command was run as the spec‐
89 ified runas_user. Note that sudo runs commands as
90 user root by default.
91
92 todate date
93 Evaluates to true if the command was run on or prior
94 to date. See Date and time format for a description
95 of supported date and time formats.
96
97 tty tty name
98 Evaluates to true if the command was run on the spec‐
99 ified terminal device. The tty name should be speci‐
100 fied without the /dev/ prefix, e.g., tty01 instead of
101 /dev/tty01.
102
103 user user name
104 Evaluates to true if the ID matches a command run by
105 user name.
106
107 Predicates may be abbreviated to the shortest unique string.
108
109 Predicates may be combined using and, or and ! operators as
110 well as ‘(’ and ‘)’ grouping (note that parentheses must gen‐
111 erally be escaped from the shell). The and operator is
112 optional, adjacent predicates have an implied and unless sep‐
113 arated by an or.
114
115 -m, --max-wait max_wait
116 Specify an upper bound on how long to wait between key
117 presses or output data. By default, sudoreplay will accu‐
118 rately reproduce the delays between key presses or program
119 output. However, this can be tedious when the session
120 includes long pauses. When the -m option is specified,
121 sudoreplay will limit these pauses to at most max_wait sec‐
122 onds. The value may be specified as a floating point number,
123 e.g., 2.5. A max_wait of zero or less will eliminate the
124 pauses entirely.
125
126 -n, --non-interactive
127 Do not prompt for user input or attempt to re-size the termi‐
128 nal. The session is written to the standard output, not
129 directly to the user's terminal.
130
131 -R, --no-resize
132 Do not attempt to re-size the terminal to match the terminal
133 size of the session.
134
135 -S, --suspend-wait
136 Wait while the command was suspended. By default, sudoreplay
137 will ignore the time interval between when the command was
138 suspended and when it was resumed. If the -S option is spec‐
139 ified, sudoreplay will wait instead.
140
141 -s, --speed speed_factor
142 This option causes sudoreplay to adjust the number of seconds
143 it will wait between key presses or program output. This can
144 be used to slow down or speed up the display. For example, a
145 speed_factor of 2 would make the output twice as fast whereas
146 a speed_factor of .5 would make the output twice as slow.
147
148 -V, --version
149 Print the sudoreplay versions version number and exit.
150
151 Date and time format
152 The time and date may be specified multiple ways, common formats include:
153
154 HH:MM:SS am MM/DD/CCYY timezone
155 24 hour time may be used in place of am/pm.
156
157 HH:MM:SS am Month, Day Year timezone
158 24 hour time may be used in place of am/pm, and month and day
159 names may be abbreviated. Note that month and day of the week
160 names must be specified in English.
161
162 CCYY-MM-DD HH:MM:SS
163 ISO time format
164
165 DD Month CCYY HH:MM:SS
166 The month name may be abbreviated.
167
168 Either time or date may be omitted, the am/pm and timezone are optional.
169 If no date is specified, the current day is assumed; if no time is speci‐
170 fied, the first second of the specified date is used. The less signifi‐
171 cant parts of both time and date may also be omitted, in which case zero
172 is assumed.
173
174 The following are all valid time and date specifications:
175
176 now The current time and date.
177
178 tomorrow
179 Exactly one day from now.
180
181 yesterday
182 24 hours ago.
183
184 2 hours ago
185 2 hours ago.
186
187 next Friday
188 The first second of the Friday in the next (upcoming) week. Not
189 to be confused with “this Friday” which would match the Friday of
190 the current week.
191
192 last week
193 The current time but 7 days ago. This is equivalent to “a week
194 ago”.
195
196 a fortnight ago
197 The current time but 14 days ago.
198
199 10:01 am 9/17/2009
200 10:01 am, September 17, 2009.
201
202 10:01 am
203 10:01 am on the current day.
204
205 10 10:00 am on the current day.
206
207 9/17/2009
208 00:00 am, September 17, 2009.
209
210 10:01 am Sep 17, 2009
211 10:01 am, September 17, 2009.
212
213 Note that relative time specifications do not always work as expected.
214 For example, the “next” qualifier is intended to be used in conjunction
215 with a day such as “next Monday”. When used with units of weeks, months,
216 years, etc the result will be one more than expected. For example, “next
217 week” will result in a time exactly two weeks from now, which is probably
218 not what was intended. This will be addressed in a future version of
219 sudoreplay.
220
221 Debugging sudoreplay
222 sudoreplay versions 1.8.4 and higher support a flexible debugging frame‐
223 work that is configured via Debug lines in the sudo.conf(5) file.
224
225 For more information on configuring sudo.conf(5), please refer to its
226 manual.
227
229 /etc/sudo.conf Debugging framework configuration
230
231 /var/log/sudo-io The default I/O log directory.
232
233 /var/log/sudo-io/00/00/01/log
234 Example session log info.
235
236 /var/log/sudo-io/00/00/01/stdin
237 Example session standard input log.
238
239 /var/log/sudo-io/00/00/01/stdout
240 Example session standard output log.
241
242 /var/log/sudo-io/00/00/01/stderr
243 Example session standard error log.
244
245 /var/log/sudo-io/00/00/01/ttyin
246 Example session tty input file.
247
248 /var/log/sudo-io/00/00/01/ttyout
249 Example session tty output file.
250
251 /var/log/sudo-io/00/00/01/timing
252 Example session timing file.
253
254 Note that the stdin, stdout and stderr files will be empty unless sudo
255 was used as part of a pipeline for a particular command.
256
258 List sessions run by user millert:
259
260 # sudoreplay -l user millert
261
262 List sessions run by user bob with a command containing the string vi:
263
264 # sudoreplay -l user bob command vi
265
266 List sessions run by user jeff that match a regular expression:
267
268 # sudoreplay -l user jeff command '/bin/[a-z]*sh'
269
270 List sessions run by jeff or bob on the console:
271
272 # sudoreplay -l ( user jeff or user bob ) tty console
273
275 script(1), sudo.conf(5), sudo(8)
276
278 Many people have worked on sudo over the years; this version consists of
279 code written primarily by:
280
281 Todd C. Miller
282
283 See the CONTRIBUTORS file in the sudo distribution
284 (https://www.sudo.ws/contributors.html) for an exhaustive list of people
285 who have contributed to sudo.
286
288 If you feel you have found a bug in sudoreplay, please submit a bug
289 report at https://bugzilla.sudo.ws/
290
292 Limited free support is available via the sudo-users mailing list, see
293 https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
294 the archives.
295
297 sudoreplay is provided “AS IS” and any express or implied warranties,
298 including, but not limited to, the implied warranties of merchantability
299 and fitness for a particular purpose are disclaimed. See the LICENSE
300 file distributed with sudo or https://www.sudo.ws/license.html for com‐
301 plete details.
302
303Sudo 1.8.27 October 6, 2018 Sudo 1.8.27