man-pages/man1/cvtsudoers.1.html
2021-03-31 01:06:50 +01:00

988 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CVTSUDOERS</TITLE>
</HEAD><BODY>
<H1>CVTSUDOERS</H1>
Section: User Commands (1)<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>cvtsudoers</B>
- convert between sudoers file formats
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>cvtsudoers</B>
[-<B>ehMpV</B>
]
[-<B>b </B><I>dn</I>
]
[-<B>c </B><I>conf_file</I>
]
[-<B>d </B><I>deftypes</I>
]
[-<B>f </B><I>output_format</I>
]
[-<B>i </B><I>input_format</I>
]
[-<B>I </B><I>increment</I>
]
[-<B>m </B><I>filter</I>
]
[-<B>o </B><I>output_file</I>
]
[-<B>O </B><I>start_point</I>
]
[-<B>P </B><I>padding</I>
]
[-<B>s </B><I>sections</I>
]
[<I>input_file</I>
]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>cvtsudoers</B>
can be used to convert between
<I>sudoers</I>
security policy file formats.
The default input format is sudoers.
The default output format is LDIF.
It is only possible to convert a
<I>sudoers</I>
file that is syntactically correct.
<P>
If no
<I>input_file</I>
is specified, or if it is
`-'
,
the policy is read from the standard input.
By default, the result is written to the standard output.
<P>
The options are as follows:
<DL COMPACT>
<P>
<DT id="1"><B>-b </B><I>dn , -</I><B>-base = </B><I>dn</I>
<DD>
The base DN (distinguished name) that will be used when performing
LDAP queries.
Typically this is of the form
<B>ou=SUDOers,dc=my-domain,dc=com</B>
for the domain
<B>my-domain.com</B>
If this option is not specified, the value of the
<B>SUDOERS_BASE</B>
environment variable will be used instead.
Only necessary when converting to LDIF format.
<DT id="2"><B>-c </B><I>conf_file , -</I><B>-config = </B><I>conf_file</I>
<DD>
Specify the path to the configuration file.
Defaults to
/etc/cvtsudoers.conf
<DT id="3"><B>-d </B><I>deftypes , -</I><B>-defaults = </B><I>deftypes</I>
<DD>
Only convert
<B>Defaults</B>
entries of the specified types.
One or more
<B>Defaults</B>
types may be specified, separated by a comma
(`,'
)
The supported types are:
<DL COMPACT>
<P>
<DT id="4"><B>all</B>
<DD>
All Defaults entries.
<DT id="5"><B>global</B>
<DD>
Global Defaults entries that are applied regardless of
user, runas, host or command.
<DT id="6"><B>user</B>
<DD>
Per-user Defaults entries.
<DT id="7"><B>runas</B>
<DD>
Per-runas user Defaults entries.
<DT id="8"><B>host</B>
<DD>
Per-host Defaults entries.
<DT id="9"><B>command</B>
<DD>
Per-command Defaults entries.
</DL>
<P>
<P>
See the
<B>Defaults</B>
section in
<A HREF="/cgi-bin/man/man2html?5+sudoers">sudoers</A>(5)
for more information.
<P>
If the
-<B>d</B>
option is not specified, all
<B>Defaults</B>
entries will be converted.
<DT id="10"><B>-e , --expand-aliases</B>
<DD>
Expand aliases in
<I>input_file</I>
Aliases are preserved by default when the output
<I>format</I>
is JSON or sudoers.
<DT id="11"><B>-f </B><I>output_format , -</I><B>-output-format = </B><I>output_format</I>
<DD>
Specify the output format (case-insensitive).
The following formats are supported:
<DL COMPACT>
<P>
<DT id="12"><B>JSON</B>
<DD>
JSON (JavaScript Object Notation) files are usually easier for
third-party applications to consume than the traditional
<I>sudoers</I>
format.
The various values have explicit types which removes much of the
ambiguity of the
<I>sudoers</I>
format.
<DT id="13"><B>LDIF</B>
<DD>
LDIF (LDAP Data Interchange Format) files can be imported into an LDAP
server for use with
sudoers.ldap5.
<P>
Conversion to LDIF has the following limitations:
<UL><P>
<LI>
Command, host, runas and user-specific Defaults lines cannot be
translated as they don't have an equivalent in the sudoers LDAP schema.
<LI>
Command, host, runas and user aliases are not supported by the
sudoers LDAP schema so they are expanded during the conversion.
</UL><P>
<DT id="14"><B>sudoers</B>
<DD>
Traditional sudoers format.
A new sudoers file will be reconstructed from the parsed input file.
Comments are not preserved and data from any include files will be
output inline.
</DL>
<P>
<DT id="15"><B>-h , --help</B>
<DD>
Display a short help message to the standard output and exit.
<DT id="16"><B>-i </B><I>input_format , -</I><B>-input-format = </B><I>input_format</I>
<DD>
Specify the input format.
The following formats are supported:
<DL COMPACT>
<P>
<DT id="17"><B>LDIF</B>
<DD>
LDIF (LDAP Data Interchange Format) files can be exported from an LDAP
server to convert security policies used by
sudoers.ldap5.
If a base DN (distinguished name) is specified, only sudoRole objects
that match the base DN will be processed.
Not all sudoOptions specified in a sudoRole can be translated from
LDIF to sudoers format.
<DT id="18"><B>sudoers</B>
<DD>
Traditional sudoers format.
This is the default input format.
</DL>
<P>
<DT id="19"><B>-I </B><I>increment , -</I><B>-increment = </B><I>increment</I>
<DD>
When generating LDIF output, increment each sudoOrder attribute by
the specified number.
Defaults to an increment of 1.
<DT id="20"><B>-m </B><I>filter , -</I><B>-match = </B><I>filter</I>
<DD>
Only output rules that match the specified
<I>filter</I>
A
<I>filter</I>
expression is made up of one or more
<B>key = </B><I>value</I>
pairs, separated by a comma
(`,'
)
The
<B>key</B>
may be
``user''
``group''
or
``host''
For example,
<B>user = </B><I>operator</I>
or
<B>host = </B><I>www</I>
An upper-case User_Alias or Host_Alias may be specified as the
``user''
or
``host''
<P>
A matching
<I>sudoers</I>
rule may also include users, groups and hosts that are not part of the
<I>filter</I>
This can happen when a rule includes multiple users, groups or hosts.
To prune out any non-matching user, group or host from the rules, the
-<B>p</B>
option may be used.
<P>
By default, the password and group databases are not consulted when matching
against the filter so the users and groups do not need to be present
on the local system (see the
-<B>M</B>
option).
Only aliases that are referenced by the filtered policy rules will
be displayed.
<DT id="21"><B>-M , --match-local</B>
<DD>
When the
-<B>m</B>
option is also specified, use password and group database information
when matching users and groups in the filter.
Only users and groups in the filter that exist on the local system will match,
and a user's groups will automatically be added to the filter.
If the
-<B>M</B>
is
<I>not</I>
specified, users and groups in the filter do not need to exist on the
local system, but all groups used for matching must be explicitly listed
in the filter.
<DT id="22"><B>-o </B><I>output_file , -</I><B>-output = </B><I>output_file</I>
<DD>
Write the converted output to
<I>output_file</I>
If no
<I>output_file</I>
is specified, or if it is
`-'
,
the converted
<I>sudoers</I>
policy will be written to the standard output.
<DT id="23"><B>-O </B><I>start_point , -</I><B>-order-start = </B><I>start_point</I>
<DD>
When generating LDIF output, use the number specified by
<I>start_point</I>
in the sudoOrder attribute of the first sudoRole object.
Subsequent sudoRole object use a sudoOrder value generated by adding an
<I>increment</I>
see the
-<B>I</B>
option for details.
Defaults to a starting point of 1.
A starting point of 0 will disable the generation of sudoOrder
attributes in the resulting LDIF file.
<DT id="24"><B>-p , --prune-matches</B>
<DD>
When the
-<B>m</B>
option is also specified,
<B>cvtsudoers</B>
will prune out non-matching users, groups and hosts from
matching entries.
<DT id="25"><B>-P </B><I>padding , -</I><B>-padding = </B><I>padding</I>
<DD>
When generating LDIF output, construct the initial sudoOrder value by
concatenating
<I>order_start</I>
and
<I>increment</I>
padding the
<I>increment</I>
with zeros until it consists of
<I>padding</I>
digits.
For example, if
<I>order_start</I>
is 1027,
<I>padding</I>
is 3, and
<I>increment</I>
is 1, the value of sudoOrder for the first entry will be 1027000,
followed by 1027001, 1027002, etc.
If the number of sudoRole entries is larger than the padding would allow,
<B>cvtsudoers</B>
will exit with an error.
By default, no padding is performed.
<DT id="26"><B>-s </B><I>sections , -</I><B>-suppress = </B><I>sections</I>
<DD>
Suppress the output of specific
<I>sections</I>
of the security policy.
One or more section names may be specified, separated by a comma
(`,'
)
The supported section name are:
<B>defaults</B>
<B>aliases</B>
and
<B>privileges</B>
(which may be shortened to
<B>privs )</B>
<DT id="27"><B>-V , -version</B>
<DD>
Print the
<B>cvtsudoers</B>
and
<I>sudoers</I>
grammar versions and exit.
</DL>
<P>
<P>
Options in the form
``keyword = value''
may also be specified in a configuration file,
/etc/cvtsudoers.conf
by default.
The following keywords are recognized:
<DL COMPACT>
<P>
<DT id="28"><B>defaults = </B><I>deftypes</I>
<DD>
See the description of the
-<B>d</B>
command line option.
<DT id="29"><B>expand_aliases = </B><I>yes | no</I>
<DD>
See the description of the
-<B>e</B>
command line option.
<DT id="30"><B>input_format = </B><I>ldif | sudoers</I>
<DD>
See the description of the
-<B>i</B>
command line option.
<DT id="31"><B>match = </B><I>filter</I>
<DD>
See the description of the
-<B>m</B>
command line option.
<DT id="32"><B>order_increment = </B><I>increment</I>
<DD>
See the description of the
-<B>I</B>
command line option.
<DT id="33"><B>order_start = </B><I>start_point</I>
<DD>
See the description of the
-<B>O</B>
command line option.
<DT id="34"><B>output_format = </B><I>json | ldif | sudoers</I>
<DD>
See the description of the
-<B>f</B>
command line option.
<DT id="35"><B>padding = </B><I>padding</I>
<DD>
See the description of the
-<B>P</B>
command line option.
<DT id="36"><B>prune_matches = </B><I>yes | no</I>
<DD>
See the description of the
-<B>p</B>
command line option.
<DT id="37"><B>sudoers_base = </B><I>dn</I>
<DD>
See the description of the
-<B>b</B>
command line option.
<DT id="38"><B>suppress = </B><I>sections</I>
<DD>
See the description of the
-<B>s</B>
command line option.
</DL>
<P>
<P>
Options on the command line will override values from the
configuration file.
<A NAME="lbAE">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<P>
<DT id="39"><B>/etc/cvtsudoers.conf
</B>
<DD>
default configuration for cvtsudoers
</DL>
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLES</H2>
Convert
/etc/sudoers
to LDIF (LDAP Data Interchange Format) where the
ldap.conf
file uses a
<I>sudoers_base</I>
of my-domain,dc=com, storing the result in
sudoers.ldif
<BLOCKQUOTE>
<PRE>
$ cvtsudoers -b ou=SUDOers,dc=my-domain,dc=com -o sudoers.ldif \
/etc/sudoers
</PRE>
</BLOCKQUOTE>
<P>
Convert
/etc/sudoers
to JSON format, storing the result in
sudoers.json
<BLOCKQUOTE>
<PRE>
$ cvtsudoers -f json -o sudoers.json /etc/sudoers
</PRE>
</BLOCKQUOTE>
<P>
Parse
/etc/sudoers
and display only rules that match user
<I>ambrose</I>
on host
<I>hastur</I>
<BLOCKQUOTE>
<PRE>
$ cvtsudoers -f sudoers -m user=ambrose,host=hastur /etc/sudoers
</PRE>
</BLOCKQUOTE>
<P>
Same as above, but expand aliases and prune out any non-matching
users and hosts from the expanded entries.
<BLOCKQUOTE>
<PRE>
$ cvtsudoers -ep -f sudoers -m user=ambrose,host=hastur /etc/sudoers
</PRE>
</BLOCKQUOTE>
<P>
Convert
sudoers.ldif
from LDIF to traditional
<I>sudoers</I>
format:
<BLOCKQUOTE>
<PRE>
$ cvtsudoers -i ldif -f sudoers -o sudoers.new sudoers.ldif
</PRE>
</BLOCKQUOTE>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<A HREF="/cgi-bin/man/man2html?5+sudoers">sudoers</A>(5),
sudoers.ldap5,
<A HREF="/cgi-bin/man/man2html?8+sudo">sudo</A>(8)
<A NAME="lbAH">&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="lbAI">&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="lbAJ">&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="lbAK">&nbsp;</A>
<H2>DISCLAIMER</H2>
<B>cvtsudoers</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="40"><A HREF="#lbAB">NAME</A><DD>
<DT id="41"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="42"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="43"><A HREF="#lbAE">FILES</A><DD>
<DT id="44"><A HREF="#lbAF">EXAMPLES</A><DD>
<DT id="45"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="46"><A HREF="#lbAH">AUTHORS</A><DD>
<DT id="47"><A HREF="#lbAI">BUGS</A><DD>
<DT id="48"><A HREF="#lbAJ">SUPPORT</A><DD>
<DT id="49"><A HREF="#lbAK">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:05:09 GMT, March 31, 2021
</BODY>
</HTML>