1CVTSUDOERS(1)             BSD General Commands Manual            CVTSUDOERS(1)
2

NAME

4     cvtsudoers — convert between sudoers file formats
5

SYNOPSIS

7     cvtsudoers [-ehMpV] [-b dn] [-c conf_file] [-d deftypes]
8                [-f output_format] [-i input_format] [-I increment]
9                [-m filter] [-o output_file] [-O start_point] [-s sections]
10                [input_file]
11

DESCRIPTION

13     cvtsudoers can be used to convert between sudoers security policy file
14     formats.  The default input format is sudoers.  The default output format
15     is LDIF.  It is only possible to convert a sudoers file that is syntacti‐
16     cally correct.
17
18     If no input_file is specified, or if it is ‘-’, the policy is read from
19     the standard input.  By default, the result is written to the standard
20     output.
21
22     The options are as follows:
23
24     -b dn, --base=dn
25                 The base DN (distinguished name) that will be used when per‐
26                 forming LDAP queries.  Typically this is of the form
27                 ou=SUDOers,dc=-mydomain,dc=com for the domain my-domain.com.
28                 If this option is not specified, the value of the
29                 SUDOERS_BASE environment variable will be used instead.  Only
30                 necessary when converting to LDIF format.
31
32     -c, --config
33                 Specify the path to a configuration file.  Defaults to
34                 /etc/cvtsudoers.conf.
35
36     -d deftypes, --defaults=deftypes
37                 Only convert Defaults entries of the specified types.  One or
38                 more Defaults types may be specified, separated by a comma
39                 (‘,’).  The supported types are:
40
41                 all       All Defaults entries.
42
43                 global    Global Defaults entries that are applied regardless
44                           of user, runas, host or command.
45
46                 user      Per-user Defaults entries.
47
48                 runas     Per-runas user Defaults entries.
49
50                 host      Per-host Defaults entries.
51
52                 command   Per-command Defaults entries.
53
54                 See the Defaults section in sudoers(5) for more information.
55
56                 If the -d option is not specified, all Defaults entries will
57                 be converted.
58
59     -e, --expand-aliases
60                 Expand aliases in input_file.  Aliases are preserved by
61                 default when the output format is JSON or sudoers.
62
63     -f output_format, --format=output_format
64                 Specify the output format (case-insensitive).  The following
65                 formats are supported:
66
67                 JSON      JSON (JavaScript Object Notation) files are usually
68                           easier for third-party applications to consume than
69                           the traditional sudoers format.  The various values
70                           have explicit types which removes much of the ambi‐
71                           guity of the sudoers format.
72
73                 LDIF      LDIF (LDAP Data Interchange Format) files can be
74                           imported into an LDAP server for use with
75                           sudoers.ldap(5).
76
77                           Conversion to LDIF has the following limitations:
78
79                           ·  Command, host, runas and user-specific Defaults
80                              lines cannot be translated as they don't have an
81                              equivalent in the sudoers LDAP schema.
82
83                           ·  Command, host, runas and user aliases are not
84                              supported by the sudoers LDAP schema so they are
85                              expanded during the conversion.
86
87                 sudoers   Traditional sudoers format.  A new sudoers file
88                           will be reconstructed from the parsed input file.
89                           Comments are not preserved and data from any
90                           include files will be output inline.
91
92     -h, --help  Display a short help message to the standard output and exit.
93
94     -i input_format, --input-format=input_format
95                 Specify the input format.  The following formats are sup‐
96                 ported:
97
98                 LDIF      LDIF (LDAP Data Interchange Format) files can be
99                           exported from an LDAP server to convert security
100                           policies used by sudoers.ldap(5).  If a base DN
101                           (distinguished name) is specified, only sudoRole
102                           objects that match the base DN will be processed.
103                           Not all sudoOptions specified in a sudoRole can be
104                           translated from LDIF to sudoers format.
105
106                 sudoers   Traditional sudoers format.  This is the default
107                           input format.
108
109     -I increment, --increment=increment
110                 When generating LDIF output, increment each sudoOrder
111                 attribute by the specified number.  Defaults to an increment
112                 of 1.
113
114     -m filter, --match=filter
115                 Only output rules that match the specified filter.  A filter
116                 expression is made up of one or more key = value pairs, sepa‐
117                 rated by a comma (‘,’).  The key may be “user”, “group” or
118                 “host”.  For example, user = operator or host = www.  An
119                 upper-case User_Alias or Host_Alias may be specified as the
120                 “user” or “host”.
121
122                 A matching sudoers rule may also include users, groups and
123                 hosts that are not part of the filter.  This can happen when
124                 a rule includes multiple users, groups or hosts.  To prune
125                 out any non-matching user, group or host from the rules, the
126                 -p option may be used.
127
128                 By default, the password and group databases are not con‐
129                 sulted when matching against the filter so the users and
130                 groups do not need to be present on the local system (see the
131                 -M option).  Only aliases that are referenced by the filtered
132                 policy rules will be displayed.
133
134     -M, --match-local
135                 When the -m option is also specified, use password and group
136                 database information when matching users and groups in the
137                 filter.  Only users and groups in the filter that exist on
138                 the local system will match, and a user's groups will auto‐
139                 matically be added to the filter.  If the -M is not speci‐
140                 fied, users and groups in the filter do not need to exist on
141                 the local system, but all groups used for matching must be
142                 explicitly listed in the filter.
143
144     -o output_file, --output=output_file
145                 Write the converted output to output_file.  If no output_file
146                 is specified, or if it is ‘-’, the converted sudoers policy
147                 will be written to the standard output.
148
149     -O start_point, --order-start=start_point
150                 When generating LDIF output, use the number specified by
151                 start_point in the sudoOrder attribute of the first sudoRole
152                 object.  Subsequent sudoRole object use a sudoOrder value
153                 generated by adding an increment, see the -I option for
154                 details.  Defaults to a starting point of 1.  A starting
155                 point of 0 will disable the generation of sudoOrder
156                 attributes in the resulting LDIF file.
157
158     -p, --prune-matches
159                 When the -m option is also specified, cvtsudoers will prune
160                 out non-matching users, groups and hosts from matching
161                 entries.
162
163     -s sections, --suppress=sections
164                 Suppress the output of specific sections of the security pol‐
165                 icy.  One or more section names may be specified, separated
166                 by a comma (‘,’).  The supported section name are: defaults,
167                 aliases and privileges (which may be shortened to privs).
168
169     -V, --version
170                 Print the cvtsudoers and sudoers grammar versions and exit.
171
172     Options in the form “keyword = value” may also be specified in a configu‐
173     ration file, /etc/cvtsudoers.conf by default.  The following keywords are
174     recognized:
175
176     defaults = deftypes
177           See the description of the -d command line option.
178
179     expand_aliases = yes | no
180           See the description of the -e command line option.
181
182     input_format = ldif | sudoers
183           See the description of the -i command line option.
184
185     match = filter
186           See the description of the -m command line option.
187
188     order_increment = increment
189           See the description of the -I command line option.
190
191     order_start = start_point
192           See the description of the -O command line option.
193
194     output_format = json | ldif | sudoers
195           See the description of the -f command line option.
196
197     prune_matches = yes | no
198           See the description of the -p command line option.
199
200     sudoers_base = dn
201           See the description of the -b command line option.
202
203     suppress = sections
204           See the description of the -s command line option.
205
206     Options on the command line will override values from the configuration
207     file.
208

FILES

210     /etc/cvtsudoers.conf      default configuration for cvtsudoers
211

EXAMPLES

213     Convert /etc/sudoers to LDIF (LDAP Data Interchange Format) where the
214     ldap.conf file uses a sudoers_base of my-domain,dc=com, storing the
215     result in sudoers.ldif:
216
217           $ cvtsudoers -b ou=SUDOers,dc=my-domain,dc=com -o sudoers.ldif \
218                        /etc/sudoers
219
220     Convert /etc/sudoers to JSON format, storing the result in sudoers.json:
221
222           $ cvtsudoers -f json -o sudoers.json /etc/sudoers
223
224     Parse /etc/sudoers and display only rules that match user ambrose on host
225     hastur:
226
227           $ cvtsudoers -f sudoers -m user=ambrose,host=hastur /etc/sudoers
228
229     Same as above, but expand aliases and prune out any non-matching users
230     and hosts from the expanded entries.
231
232           $ cvtsudoers -ep -f sudoers -m user=ambrose,host=hastur /etc/sudoers
233
234     Convert sudoers.ldif from LDIF to traditional sudoers format:
235
236           $ cvtsudoers -i ldif -f sudoers -o sudoers.new sudoers.ldif
237

SEE ALSO

239     sudoers(5), sudoers.ldap(5), sudo(8)
240

AUTHORS

242     Many people have worked on sudo over the years; this version consists of
243     code written primarily by:
244
245           Todd C. Miller
246
247     See the CONTRIBUTORS file in the sudo distribution
248     (https://www.sudo.ws/contributors.html) for an exhaustive list of people
249     who have contributed to sudo.
250

BUGS

252     If you feel you have found a bug in cvtsudoers, please submit a bug
253     report at https://bugzilla.sudo.ws/
254

SUPPORT

256     Limited free support is available via the sudo-users mailing list, see
257     https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
258     the archives.
259

DISCLAIMER

261     cvtsudoers is provided “AS IS” and any express or implied warranties,
262     including, but not limited to, the implied warranties of merchantability
263     and fitness for a particular purpose are disclaimed.  See the LICENSE
264     file distributed with sudo or https://www.sudo.ws/license.html for com‐
265     plete details.
266
267Sudo 1.8.23                     April 14, 2018                     Sudo 1.8.23
Impressum