2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Sudo manuals formatted in mdoc, to replace the pod versions.

This commit is contained in:
Todd C. Miller 2012-07-18 09:56:53 -04:00
parent c5b374fac6
commit 0d8aa46bb1
6 changed files with 8663 additions and 0 deletions

1211
doc/sudo.mdoc.in Normal file

File diff suppressed because it is too large Load Diff

2155
doc/sudo_plugin.mdoc.in Normal file

File diff suppressed because it is too large Load Diff

1103
doc/sudoers.ldap.mdoc.in Normal file

File diff suppressed because it is too large Load Diff

3501
doc/sudoers.mdoc.in Normal file

File diff suppressed because it is too large Load Diff

374
doc/sudoreplay.mdoc.in Normal file
View File

@ -0,0 +1,374 @@
.\"
.\" Copyright (c) 2009-2012 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 12, 2012
.Dt SUDOREPLAY 8
.Os
.Sh NAME
.Nm sudoreplay
.Nd replay sudo session logs
.Sh SYNOPSIS
.Nm sudoreplay
.Op Fl h
.Bk -words
.Op Fl d Ar directory
.Ek
.Bk -words
.Op Fl f Ar filter
.Ek
.Bk -words
.Op Fl m Ar max_wait
.Ek
.Bk -words
.Op Fl s Ar speed_factor
.Ek
ID
.Pp
.Nm sudoreplay
.Op Fl h
.Bk -words
.Op Fl d Ar directory
.Ek
.Fl l
.Op search expression
.Sh DESCRIPTION
.Nm sudoreplay
plays back or lists the output logs created by
.Nm sudo .
When replaying,
.Nm sudoreplay
can play the session back in real-time, or the playback speed may be
adjusted (faster or slower) based on the command line options.
.Pp
The
.Em ID
should either be a six character sequence of digits and
upper case letters, e.g.\&
.Li 0100A5 ,
or a pattern matching the
.Em iolog_file
option in the
.Em sudoers
file.
When a command is run via
.Nm sudo
with
.Em log_output
enabled in the
.Em sudoers
file, a
.Li TSID=ID
string is logged via syslog or to the
.Nm sudo
log file.
The
.Em ID
may also be determined using
.Nm sudoreplay Ns No 's
list mode.
.Pp
In list mode,
.Nm sudoreplay
can be used to find the ID of a session based on a number of criteria
such as the user, tty or command run.
.Pp
In replay mode, if the standard output has not been redirected,
.Nm sudoreplay
will act on the following keys:
.Bl -tag -width 12n
.It So Li \ Sc No (space)
Pause output; press any key to resume.
.It Ql <
Reduce the playback speed by one half.
.It Ql >
Double the playback speed.
.El
.Sh OPTIONS
.Nm sudoreplay
accepts the following command line options:
.Bl -tag -width 12n
.It Fl d Ar directory
Use
.Ar directory
to for the session logs instead of the default,
.Pa @iolog_dir@ .
.It Fl f Ar filter
By default,
.Nm sudoreplay
will play back the command's standard output, standard error and tty output.
The
.Fl f
option can be used to select which of these to output.
The
.Ar filter
argument is a comma-separated list, consisting of one or more of following:
.Em stdout ,
.Em stderr ,
and
.Em ttyout .
.It Fl h
The
.Fl h No ( Em help Ns No )
option causes
.Nm sudoreplay
to print a short help message to the standard output and exit.
.It Fl l Op Ar search expression
Enable
.Dq list mode .
In this mode,
.Nm sudoreplay
will list available sessions in a format similar to the
.Nm sudo
log file format, sorted by file name (or sequence number).
If a
.Ar search expression
is specified, it will be used to restrict the IDs that are displayed.
An expression is composed of the following predicates:
.Bl -tag -width 6n
.It command Ar pattern
Evaluates to true if the command run matches
.Ar pattern .
On systems with POSIX regular expression support, the pattern may
be an extended regular expression.
On systems without POSIX regular expression support, a simple substring
match is performed instead.
.It cwd Ar directory
Evaluates to true if the command was run with the specified current
working directory.
.It fromdate Ar date
Evaluates to true if the command was run on or after
.Ar date .
See
.Sx Date and time format
for a description of supported date and time formats.
.It group Ar runas_group
Evaluates to true if the command was run with the specified
.Ar runas_group .
Note that unless a
.Ar runas_group
was explicitly specified when
.Nm sudo
was run this field will be empty in the log.
.It runas Ar runas_user
Evaluates to true if the command was run as the specified
.Ar runas_user .
Note that
.Nm sudo
runs commands as user
.Em root
by default.
.It todate Ar date
Evaluates to true if the command was run on or prior to
.Ar date .
See
.Sx Date and time format
for a description of supported date and time formats.
.It tty Ar tty name
Evaluates to true if the command was run on the specified terminal device.
The
.Ar tty name
should be specified without the
.Pa /dev/
prefix, e.g.\&
.Pa tty01
instead of
.Pa /dev/tty01 .
.It user Ar user name
Evaluates to true if the ID matches a command run by
.Ar user name .
.El
.Pp
Predicates may be abbreviated to the shortest unique string (currently
all predicates may be shortened to a single character).
.Pp
Predicates may be combined using
.Em and ,
.Em or
and
.Em \&!
operators as well as
.Ql \&(
and
.Ql \&)
grouping (note that parentheses must generally be escaped from the shell).
The
.Em and
operator is optional, adjacent predicates have an implied
.Em and
unless separated by an
.Em or .
.It Fl m Ar max_wait
Specify an upper bound on how long to wait between key presses or output data.
By default,
.Nm sudoreplay
will accurately reproduce the delays between key presses or program output.
However, this can be tedious when the session includes long pauses.
When the
.Fl m
option is specified,
.Nm sudoreplay
will limit these pauses to at most
.Em max_wait
seconds.
The value may be specified as a floating point number, e.g.\&
.Em 2.5 .
.It Fl s Ar speed_factor
This option causes
.Nm sudoreplay
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
.Ar speed_factor
of
.Em 2
would make the output twice as fast whereas a
.Ar speed_factor
of
.Em .5
would make the output twice as slow.
.It Fl V
The
.Fl V No ( Em version Ns No )
option causes
.Nm sudoreplay
to print its version number
and exit.
.El
.Ss Date and time format
The time and date may be specified multiple ways, common formats include:
.Bl -tag -width 6n
.It HH:MM:SS am MM/DD/CCYY timezone
24 hour time may be used in place of am/pm.
.It HH:MM:SS am Month, Day Year timezone
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.
.It CCYY-MM-DD HH:MM:SS
ISO time format
.It DD Month CCYY HH:MM:SS
The month name may be abbreviated.
.El
.Pp
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.
.Pp
The following are all valid time and date specifications:
.Bl -tag -width 6n
.It now
The current time and date.
.It tomorrow
Exactly one day from now.
.It yesterday
24 hours ago.
.It 2 hours ago
2 hours ago.
.It next Friday
The first second of the next Friday.
.It this week
The current time but the first day of the coming week.
.It a fortnight ago
The current time but 14 days ago.
.It 10:01 am 9/17/2009
10:01 am, September 17, 2009.
.It 10:01 am
10:01 am on the current day.
.It 10
10:00 am on the current day.
.It 9/17/2009
00:00 am, September 17, 2009.
.It 10:01 am Sep 17, 2009
10:01 am, September 17, 2009.
.El
.Sh FILES
.Bl -tag -width 24n
.It Pa @iolog_dir@
The default I/O log directory.
.It Pa @iolog_dir@/00/00/01/log
Example session log info.
.It Pa @iolog_dir@/00/00/01/stdin
Example session standard input log.
.It Pa @iolog_dir@/00/00/01/stdout
Example session standard output log.
.It Pa @iolog_dir@/00/00/01/stderr
Example session standard error log.
.It Pa @iolog_dir@/00/00/01/ttyin
Example session tty input file.
.It Pa @iolog_dir@/00/00/01/ttyout
Example session tty output file.
.It Pa @iolog_dir@/00/00/01/timing
Example session timing file.
.El
.Pp
Note that the
.Em stdin ,
.Em stdout
and
.Em stderr
files will be empty unless
.Nm sudo
was used as part of a pipeline for a particular command.
.Sh EXAMPLES
List sessions run by user
.Em millert :
.Bd -literal -offset indent
# sudoreplay -l user millert
.Ed
.Pp
List sessions run by user
.Em bob
with a command containing the string vi:
.Bd -literal -offset indent
# sudoreplay -l user bob command vi
.Ed
.Pp
List sessions run by user
.Em jeff
that match a regular expression:
.Bd -literal -offset indent
# sudoreplay -l user jeff command '/bin/[a-z]*sh'
.Ed
.Pp
List sessions run by jeff or bob on the console:
.Bd -literal -offset indent
# sudoreplay -l ( user jeff or user bob ) tty console
.Ed
.Sh SEE ALSO
.Xr sudo 8 ,
.Xr script 1
.Sh AUTHORS
Todd C. Miller
.Sh BUGS
If you feel you have found a bug in
.Nm sudoreplay ,
please submit a bug report at http://www.sudo.ws/sudo/bugs/
.Sh SUPPORT
Limited free support is available via the sudo-users mailing list,
see http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or
search the archives.
.Sh DISCLAIMER
.Nm sudoreplay
is provided
.Dq 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
.Nm sudo
or http://www.sudo.ws/sudo/license.html for complete details.

319
doc/visudo.mdoc.in Normal file
View File

@ -0,0 +1,319 @@
.\"
.\" Copyright (c) 1996,1998-2005, 2007-2012
.\" Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" Sponsored in part by the Defense Advanced Research Projects
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
.Dd July 12, 2012
.Dt VISUDO 8
.Os
.Sh NAME
.Nm visudo
.Nd edit the sudoers file
.Sh SYNOPSIS
.Nm visudo
.Op Fl chqsV
.Bk -words
.Op Fl f Ar sudoers
.Ek
.Sh DESCRIPTION
.Nm visudo
edits the
.Em sudoers
file in a safe fashion, analogous to
.Xr vipw 8 .
.Nm visudo
locks the
.Em sudoers
file against multiple simultaneous edits, provides basic sanity checks,
and checks for parse errors.
If the
.Em sudoers
file is currently being edited you will receive a message to try again later.
.Pp
There is a hard-coded list of one or more editors that
.Nm visudo
will use set at compile-time that may be overridden via the
.Em editor
.Em sudoers
.Li Default
variable.
This list defaults to
.Li "@editor@" .
Normally,
.Nm visudo
does not honor the
.Ev VISUAL
or
.Ev EDITOR
environment variables unless they contain an editor in the aforementioned
editors list.
However, if
.Nm visudo
is configured with the
.Li --with-env-editor
option or the
.Em env_editor
.Li Default
variable is set in
.Em sudoers ,
.Nm visudo
will use any the editor defines by
.Ev VISUAL
or
.Ev EDITOR .
Note that this can be a security hole since it allows the user to
execute any program they wish simply by setting
.Ev VISUAL
or
.Ev EDITOR .
.Pp
.Nm visudo
parses the
.Em sudoers
file after the edit and will
not save the changes if there is a syntax error.
Upon finding an error,
.Nm visudo
will print a message stating the line number(s)
where the error occurred and the user will receive the
.Dq What now?
prompt.
At this point the user may enter
.Ql e
to re-edit the
.Em sudoers
file,
.Ql x
to exit without saving the changes, or
.Ql Q
to quit and save changes.
The
.Ql Q
option should be used with extreme care because if
.Nm visudo
believes there to be a parse error, so will
.Nm sudo
and no one
will be able to
.Nm sudo
again until the error is fixed.
If
.Ql e
is typed to edit the
.Em sudoers
file after a parse error has been detected, the cursor will be placed on
the line where the error occurred (if the editor supports this feature).
.Sh OPTIONS
.Nm visudo
accepts the following command line options:
accepts the following command line options:
.Bl -tag -width Fl
.It Fl c
Enable
.Em check-only
mode.
The existing
.Em sudoers
file will be
checked for syntax errors, owner and mode.
A message will be printed to the standard output describing the status of
.Em sudoers
unless the
.Fl q
option was specified.
If the check completes successfully,
.Nm visudo
will exit with a value of 0.
If an error is encountered,
.Nm visudo
will exit with a value of 1.
.It Fl f Ar sudoers
Specify and alternate
.Em sudoers
file location.
With this option
.Nm visudo
will edit (or check) the
.Em sudoers
file of your choice,
instead of the default,
.Pa @sysconfdir@/sudoers .
The lock file used is the specified
.Em sudoers
file with
.Dq \.tmp
appended to it.
In
.Em check-only
mode only, the argument to
.Fl f
may be
.Ql - ,
indicating that
.Em sudoers
will be read from the standard input.
.It Fl h
The
.Fl h No ( Em help Ns No )
option causes
.Nm visudo
to print a short help message
to the standard output and exit.
.It Fl q
Enable
.Em quiet
mode.
In this mode details about syntax errors are not printed.
This option is only useful when combined with
the
.Fl c
option.
.It Fl s
Enable
.Em strict
checking of the
.Em sudoers
file.
If an alias is used before it is defined,
.Nm visudo
will consider this a parse error.
Note that it is not possible to differentiate between an
alias and a host name or user name that consists solely of uppercase
letters, digits, and the underscore
.Pq Ql _
character.
.It Fl V
The
.Fl V ( Em version Ns No )
option causes
.Nm visudo
to print its version number
and exit.
.El
.Sh ENVIRONMENT
The following environment variables may be consulted depending on
the value of the
.Em editor
and
.Em env_editor
.Em sudoers
settings:
.Bl -tag -width 15n
.It Ev VISUAL
Invoked by
.Nm visudo
as the editor to use
.It Ev EDITOR
Used by
.Nm visudo
if
.Ev VISUAL
is not set
.El
.Sh FILES
.Bl -tag -width 24n
.It Pa @sysconfdir@/sudoers
List of who can run what
.It Pa @sysconfdir@/sudoers.tmp
Lock file for visudo
.El
.Sh DIAGNOSTICS
.Bl -tag -width 4n
.It Li sudoers file busy, try again later.
Someone else is currently editing the
.Em sudoers
file.
.It Li @sysconfdir@/sudoers.tmp: Permission denied
You didn't run
.Nm visudo
as root.
.It Li Can't find you in the passwd database
Your user ID does not appear in the system passwd file.
.It Li Warning: {User,Runas,Host,Cmnd}_Alias referenced but not defined
Either you are trying to use an undeclared {User,Runas,Host,Cmnd}_Alias
or you have a user or host name listed that consists solely of
uppercase letters, digits, and the underscore
.Pq Ql _
character.
In the latter case, you can ignore the warnings
.Po
.Nm sudo
will not complain
.Pc .
In
.Fl s
(strict) mode these are errors, not warnings.
.It Li Warning: unused {User,Runas,Host,Cmnd}_Alias
The specified {User,Runas,Host,Cmnd}_Alias was defined but never
used.
You may wish to comment out or remove the unused alias.
In
.Fl s
(strict) mode this is an error, not a warning.
.It Li Warning: cycle in {User,Runas,Host,Cmnd}_Alias
The specified {User,Runas,Host,Cmnd}_Alias includes a reference to
itself, either directly or through an alias it includes.
This is only a warning by default as
.Nm sudo
will ignore cycles when parsing
the
.Em sudoers
file.
.El
.Sh SEE ALSO
.Xr vi 1 ,
.Xr sudoers 5 ,
.Xr sudo 8 ,
.Xr vipw 8
.Sh AUTHORS
Many people have worked on
.Nm sudo
over the years; this version consists of code written primarily by:
.Bd -ragged -offset indent
Todd C. Miller
.Ed
.Pp
See the CONTRIBUTORS file in the
.Nm sudo
distribution (http://www.sudo.ws/sudo/contributors.html) for an
exhaustive list of people who have contributed to
.Nm sudo .
.Sh CAVEATS
There is no easy way to prevent a user from gaining a root shell if
the editor used by
.Nm visudo
allows shell escapes.
.Sh BUGS
If you feel you have found a bug in
.Nm visudo ,
please submit a bug report at http://www.sudo.ws/sudo/bugs/
.Sh SUPPORT
Limited free support is available via the sudo-users mailing list,
see http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or
search the archives.
.Sh DISCLAIMER
.Nm visudo
is provided
.Dq 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
.Nm sudo
or http://www.sudo.ws/sudo/license.html for complete details.