man-pages/man8/sudoreplay.8.html
2021-03-31 01:06:50 +01:00

884 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SUDOREPLAY</TITLE>
</HEAD><BODY>
<H1>SUDOREPLAY</H1>
Section: Maintenance Commands (8)<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<BR>BSD mandoc<BR>
Sudo 1.8.31
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
<B>sudoreplay</B>
- replay sudo session logs
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>sudoreplay</B>
[-<B>hnRS</B>
]
[-<B>d </B><I>dir</I>
]
[-<B>f </B><I>filter</I>
]
[-<B>m </B><I>num</I>
]
[-<B>s </B><I>num</I>
]
ID
<P>
<BR><B>sudoreplay</B>
[-<B>h</B>
]
[-<B>d </B><I>dir</I>
]
-<B>l</B>
[search expression]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>sudoreplay</B>
plays back or lists the output logs created by
<B>sudo</B>
When replaying,
<B>sudoreplay</B>
can play the session back in real-time, or the playback speed may be
adjusted (faster or slower) based on the command line options.
<P>
The
<I>ID</I>
should either be a six character sequence of digits and
upper case letters, e.g.,
<B>0100A5</B>
a pattern matching the
<I>iolog_file</I>
option in the
<I>sudoers</I>
file, or a path name.
Path names may be relative to the
<I>iolog_dir</I>
option in the
<I>sudoers</I>
file (unless overridden by the
-<B>d</B>
option) or fully qualified, beginning with a
`/'
character.
When a command is run via
<B>sudo</B>
with
<I>log_output</I>
enabled in the
<I>sudoers</I>
file, a
<B>TSID=ID</B>
string is logged via syslog or to the
<B>sudo</B>
log file.
The
<I>ID</I>
may also be determined using
<B>sudoreplay 's</B>
list mode.
<P>
In list mode,
<B>sudoreplay</B>
can be used to find the ID of a session based on a number of criteria
such as the user, tty or command run.
<P>
In replay mode, if the standard input and output are connected to a terminal
and the
-<B>n</B>
option is not specified,
<B>sudoreplay</B>
will operate interactively.
In interactive mode,
<B>sudoreplay</B>
will attempt to adjust the terminal size to match that of the session and
write directly to the terminal (not all terminals support this).
Additionally, it will poll the keyboard and act on the following keys:
<DL COMPACT>
<P>
<DT id="1"><B>So </B><B>\n Sc </B><B>or So </B><B>\r Sc </B>Skip to the next replay event; useful for long pauses.
<DD>
<DT id="2"><B>So </B><B>&nbsp; Sc </B>(space)
<DD>
Pause output; press any key to resume.
<DT id="3"><B>`&lt;'
</B>
<DD>
Reduce the playback speed by one half.
<DT id="4"><B>`&gt;'
</B>
<DD>
Double the playback speed.
</DL>
<P>
<P>
The session can be interrupted via control-C.
When the session has finished, the terminal is restored to its
original size if it was changed during playback.
<P>
The options are as follows:
<DL COMPACT>
<P>
<DT id="5"><B>-d </B><I>dir , -</I><B>-directory = </B><I>dir</I>
<DD>
Store session logs in
<I>dir</I>
instead of the default,
/var/log/sudo-io
<DT id="6"><B>-f </B><I>filter , -</I><B>-filter = </B><I>filter</I>
<DD>
Select which I/O type(s) to display.
By default,
<B>sudoreplay</B>
will display the command's standard output, standard error and tty output.
The
<I>filter</I>
argument is a comma-separated list, consisting of one or more of following:
<I>stdin</I>
<I>stdout</I>
<I>stderr</I>
<I>ttyin</I>
and
<I>ttyout</I>
<DT id="7"><B>-h , -help</B>
<DD>
Display a short help message to the standard output and exit.
<DT id="8"><B>-l , -list </B>[<I>search expression</I>
]
<DD>
Enable
``list mode''
In this mode,
<B>sudoreplay</B>
will list available sessions in a format similar to the
<B>sudo</B>
log file format, sorted by file name (or sequence number).
If a
<I>search expression</I>
is specified, it will be used to restrict the IDs that are displayed.
An expression is composed of the following predicates:
<DL COMPACT>
<P>
<DT id="9"><B>command </B><I>pattern</I>
<DD>
Evaluates to true if the command run matches the POSIX extended
regular expression
<I>pattern</I>
<DT id="10"><B>cwd </B><I>directory</I>
<DD>
Evaluates to true if the command was run with the specified current
working directory.
<DT id="11"><B>fromdate </B><I>date</I>
<DD>
Evaluates to true if the command was run on or after
<I>date</I>
See
Sx Date and time format
for a description of supported date and time formats.
<DT id="12"><B>group </B><I>runas_group</I>
<DD>
Evaluates to true if the command was run with the specified
<I>runas_group</I>
Note that unless a
<I>runas_group</I>
was explicitly specified when
<B>sudo</B>
was run this field will be empty in the log.
<DT id="13"><B>runas </B><I>runas_user</I>
<DD>
Evaluates to true if the command was run as the specified
<I>runas_user</I>
Note that
<B>sudo</B>
runs commands as user
<I>root</I>
by default.
<DT id="14"><B>todate </B><I>date</I>
<DD>
Evaluates to true if the command was run on or prior to
<I>date</I>
See
Sx Date and time format
for a description of supported date and time formats.
<DT id="15"><B>tty </B><I>tty name</I>
<DD>
Evaluates to true if the command was run on the specified terminal device.
The
<I>tty name</I>
should be specified without the
/dev/
prefix, e.g.,
tty01
instead of
/dev/tty01
<DT id="16"><B>user </B><I>user name</I>
<DD>
Evaluates to true if the ID matches a command run by
<I>user name</I>
</DL>
<P>
<P>
Predicates may be abbreviated to the shortest unique string.
<P>
Predicates may be combined using
<I>and</I>
<I>or</I>
and
<I>!</I>
operators as well as
`('
and
`)'
grouping (note that parentheses must generally be escaped from the shell).
The
<I>and</I>
operator is optional, adjacent predicates have an implied
<I>and</I>
unless separated by an
<I>or</I>
<DT id="17"><B>-m , -max-wait </B><I>max_wait</I>
<DD>
Specify an upper bound on how long to wait between key presses or output data.
By default,
<B>sudoreplay</B>
will accurately reproduce the delays between key presses or program output.
However, this can be tedious when the session includes long pauses.
When the
-<B>m</B>
option is specified,
<B>sudoreplay</B>
will limit these pauses to at most
<I>max_wait</I>
seconds.
The value may be specified as a floating point number, e.g.,
<I>2.5</I>
A
<I>max_wait</I>
of zero or less will eliminate the pauses entirely.
<DT id="18"><B>-n , -non-interactive</B>
<DD>
Do not prompt for user input or attempt to re-size the terminal.
The session is written to the standard output, not directly to
the user's terminal.
<DT id="19"><B>-R , -no-resize</B>
<DD>
Do not attempt to re-size the terminal to match the terminal size
of the session.
<DT id="20"><B>-S , -suspend-wait</B>
<DD>
Wait while the command was suspended.
By default,
<B>sudoreplay</B>
will ignore the time interval between when the command was suspended
and when it was resumed.
If the
-<B>S</B>
option is specified,
<B>sudoreplay</B>
will wait instead.
<DT id="21"><B>-s , -speed </B><I>speed_factor</I>
<DD>
This option causes
<B>sudoreplay</B>
to adjust the number of seconds it will wait between key presses or
program output.
This can be used to slow down or speed up the display.
For example, a
<I>speed_factor</I>
of
<I>2</I>
would make the output twice as fast whereas a
<I>speed_factor</I>
of
<I>.5</I>
would make the output twice as slow.
<DT id="22"><B>-V , -version</B>
<DD>
Print the
<B>sudoreplay</B>
versions version number and exit.
</DL>
<P>
<A NAME="lbAE">&nbsp;</A>
<H3>Date and time format</H3>
The time and date may be specified multiple ways, common formats include:
<DL COMPACT>
<P>
<DT id="23"><B>HH:MM:SS am MM/DD/CCYY timezone</B>
<DD>
24 hour time may be used in place of am/pm.
<DT id="24"><B>HH:MM:SS am Month, Day Year timezone</B>
<DD>
24 hour time may be used in place of am/pm, and month and day names
may be abbreviated.
Note that month and day of the week names must be specified in English.
<DT id="25"><B>CCYY-MM-DD HH:MM:SS</B>
<DD>
ISO time format
<DT id="26"><B>DD Month CCYY HH:MM:SS</B>
<DD>
The month name may be abbreviated.
</DL>
<P>
<P>
Either time or date may be omitted, the am/pm and timezone are optional.
If no date is specified, the current day is assumed; if no time is
specified, the first second of the specified date is used.
The less significant parts of both time and date may also be omitted,
in which case zero is assumed.
<P>
The following are all valid time and date specifications:
<DL COMPACT>
<P>
<DT id="27"><B>now</B>
<DD>
The current time and date.
<DT id="28"><B>tomorrow</B>
<DD>
Exactly one day from now.
<DT id="29"><B>yesterday</B>
<DD>
24 hours ago.
<DT id="30"><B>2 hours ago</B>
<DD>
2 hours ago.
<DT id="31"><B>next Friday</B>
<DD>
The first second of the Friday in the next (upcoming) week.
Not to be confused with
``this Friday''
which would match the Friday of the current week.
<DT id="32"><B>last week</B>
<DD>
The current time but 7 days ago.
This is equivalent to
``a week ago''
<DT id="33"><B>a fortnight ago</B>
<DD>
The current time but 14 days ago.
<DT id="34"><B>10:01 am 9/17/2009</B>
<DD>
10:01 am, September 17, 2009.
<DT id="35"><B>10:01 am</B>
<DD>
10:01 am on the current day.
<DT id="36"><B>10</B>
<DD>
10:00 am on the current day.
<DT id="37"><B>9/17/2009</B>
<DD>
00:00 am, September 17, 2009.
<DT id="38"><B>10:01 am Sep 17, 2009</B>
<DD>
10:01 am, September 17, 2009.
</DL>
<P>
<P>
Note that relative time specifications do not always work as expected.
For example, the
``next''
qualifier is intended to be used in conjunction with a day such as
``next Monday''
When used with units of weeks, months, years, etc
the result will be one more than expected.
For example,
``next week''
will result in a time exactly two weeks from now, which is probably
not what was intended.
This will be addressed in a future version of
<B>.</B>
<A NAME="lbAF">&nbsp;</A>
<H3>Debugging sudoreplay</H3>
<B>sudoreplay</B>
versions 1.8.4 and higher support a flexible debugging framework
that is configured via
<B>Debug</B>
lines in the
sudo.conf5
file.
<P>
For more information on configuring
sudo.conf5,
please refer to its manual.
<A NAME="lbAG">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<P>
<DT id="39"><B>/etc/sudo.conf
</B>
<DD>
Debugging framework configuration
<DT id="40"><B>/var/log/sudo-io
</B>
<DD>
The default I/O log directory.
<DT id="41"><B>/var/log/sudo-io/00/00/01/log
</B>
<DD>
Example session log info.
<DT id="42"><B>/var/log/sudo-io/00/00/01/stdin
</B>
<DD>
Example session standard input log.
<DT id="43"><B>/var/log/sudo-io/00/00/01/stdout
</B>
<DD>
Example session standard output log.
<DT id="44"><B>/var/log/sudo-io/00/00/01/stderr
</B>
<DD>
Example session standard error log.
<DT id="45"><B>/var/log/sudo-io/00/00/01/ttyin
</B>
<DD>
Example session tty input file.
<DT id="46"><B>/var/log/sudo-io/00/00/01/ttyout
</B>
<DD>
Example session tty output file.
<DT id="47"><B>/var/log/sudo-io/00/00/01/timing
</B>
<DD>
Example session timing file.
</DL>
<P>
<P>
Note that the
<I>stdin</I>
<I>stdout</I>
and
<I>stderr</I>
files will be empty unless
<B>sudo</B>
was used as part of a pipeline for a particular command.
<A NAME="lbAH">&nbsp;</A>
<H2>EXAMPLES</H2>
List sessions run by user
<I>millert</I>
<BLOCKQUOTE>
<PRE>
# sudoreplay -l user millert
</PRE>
</BLOCKQUOTE>
<P>
List sessions run by user
<I>bob</I>
with a command containing the string vi:
<BLOCKQUOTE>
<PRE>
# sudoreplay -l user bob command vi
</PRE>
</BLOCKQUOTE>
<P>
List sessions run by user
<I>jeff</I>
that match a regular expression:
<BLOCKQUOTE>
<PRE>
# sudoreplay -l user jeff command '/bin/[a-z]*sh'
</PRE>
</BLOCKQUOTE>
<P>
List sessions run by jeff or bob on the console:
<BLOCKQUOTE>
<PRE>
# sudoreplay -l ( user jeff or user bob ) tty console
</PRE>
</BLOCKQUOTE>
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<A HREF="/cgi-bin/man/man2html?1+script">script</A>(1),
sudo.conf5,
<A HREF="/cgi-bin/man/man2html?8+sudo">sudo</A>(8)
<A NAME="lbAJ">&nbsp;</A>
<H2>AUTHORS</H2>
Many people have worked on
<B>sudo</B>
over the years; this version consists of code written primarily by:
<BLOCKQUOTE>
An Todd C. Miller
</BLOCKQUOTE>
<P>
See the CONTRIBUTORS file in the
<B>sudo</B>
distribution (<A HREF="https://www.sudo.ws/contributors.html)">https://www.sudo.ws/contributors.html)</A> for an
exhaustive list of people who have contributed to
<B>sudo</B>
<A NAME="lbAK">&nbsp;</A>
<H2>BUGS</H2>
If you feel you have found a bug in
<B>,</B>
please submit a bug report at <A HREF="https://bugzilla.sudo.ws/">https://bugzilla.sudo.ws/</A>
<A NAME="lbAL">&nbsp;</A>
<H2>SUPPORT</H2>
Limited free support is available via the sudo-users mailing list,
see <A HREF="https://www.sudo.ws/mailman/listinfo/sudo-users">https://www.sudo.ws/mailman/listinfo/sudo-users</A> to subscribe or
search the archives.
<A NAME="lbAM">&nbsp;</A>
<H2>DISCLAIMER</H2>
<B>sudoreplay</B>
is provided
``AS IS''
and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed.
See the LICENSE file distributed with
<B>sudo</B>
or <A HREF="https://www.sudo.ws/license.html">https://www.sudo.ws/license.html</A> for complete details.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="48"><A HREF="#lbAB">NAME</A><DD>
<DT id="49"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="50"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="51"><A HREF="#lbAE">Date and time format</A><DD>
<DT id="52"><A HREF="#lbAF">Debugging sudoreplay</A><DD>
</DL>
<DT id="53"><A HREF="#lbAG">FILES</A><DD>
<DT id="54"><A HREF="#lbAH">EXAMPLES</A><DD>
<DT id="55"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="56"><A HREF="#lbAJ">AUTHORS</A><DD>
<DT id="57"><A HREF="#lbAK">BUGS</A><DD>
<DT id="58"><A HREF="#lbAL">SUPPORT</A><DD>
<DT id="59"><A HREF="#lbAM">DISCLAIMER</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:16 GMT, March 31, 2021
</BODY>
</HTML>