summaryrefslogtreecommitdiffstats
path: root/ipaclient/remote_plugins/2_114/config.py
blob: b55951602fd8b3c89b33c11fe0102715fff1eae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
#
# Copyright (C) 2016  FreeIPA Contributors see COPYING for license
#

# pylint: disable=unused-import
import six

from . import Command, Method, Object
from ipalib import api, parameters, output
from ipalib.parameters import DefaultFrom
from ipalib.plugable import Registry
from ipalib.text import _
from ipapython.dn import DN
from ipapython.dnsutil import DNSName

if six.PY3:
    unicode = str

__doc__ = _("""
Server configuration

Manage the default values that IPA uses and some of its tuning parameters.

NOTES:

The password notification value (--pwdexpnotify) is stored here so it will
be replicated. It is not currently used to notify users in advance of an
expiring password.

Some attributes are read-only, provided only for information purposes. These
include:

Certificate Subject base: the configured certificate subject base,
  e.g. O=EXAMPLE.COM.  This is configurable only at install time.
Password plug-in features: currently defines additional hashes that the
  password will generate (there may be other conditions).

When setting the order list for mapping SELinux users you may need to
quote the value so it isn't interpreted by the shell.

EXAMPLES:

 Show basic server configuration:
   ipa config-show

 Show all configuration options:
   ipa config-show --all

 Change maximum username length to 99 characters:
   ipa config-mod --maxusername=99

 Increase default time and size limits for maximum IPA server search:
   ipa config-mod --searchtimelimit=10 --searchrecordslimit=2000

 Set default user e-mail domain:
   ipa config-mod --emaildomain=example.com

 Enable migration mode to make "ipa migrate-ds" command operational:
   ipa config-mod --enable-migration=TRUE

 Define SELinux user map order:
   ipa config-mod --ipaselinuxusermaporder='guest_u:s0$xguest_u:s0$user_u:s0-s0:c0.c1023$staff_u:s0-s0:c0.c1023$unconfined_u:s0-s0:c0.c1023'
""")

register = Registry()


@register()
class config(Object):
    takes_params = (
        parameters.Int(
            'ipamaxusernamelength',
            label=_(u'Maximum username length'),
        ),
        parameters.Str(
            'ipahomesrootdir',
            label=_(u'Home directory base'),
            doc=_(u'Default location of home directories'),
        ),
        parameters.Str(
            'ipadefaultloginshell',
            label=_(u'Default shell'),
            doc=_(u'Default shell for new users'),
        ),
        parameters.Str(
            'ipadefaultprimarygroup',
            label=_(u'Default users group'),
            doc=_(u'Default group for new users'),
        ),
        parameters.Str(
            'ipadefaultemaildomain',
            required=False,
            label=_(u'Default e-mail domain'),
        ),
        parameters.Int(
            'ipasearchtimelimit',
            label=_(u'Search time limit'),
            doc=_(u'Maximum amount of time (seconds) for a search (> 0, or -1 for unlimited)'),
        ),
        parameters.Int(
            'ipasearchrecordslimit',
            label=_(u'Search size limit'),
            doc=_(u'Maximum number of records to search (-1 is unlimited)'),
        ),
        parameters.Str(
            'ipausersearchfields',
            label=_(u'User search fields'),
            doc=_(u'A comma-separated list of fields to search in when searching for users'),
        ),
        parameters.Str(
            'ipagroupsearchfields',
            label=_(u'Group search fields'),
            doc=_(u'A comma-separated list of fields to search in when searching for groups'),
        ),
        parameters.Bool(
            'ipamigrationenabled',
            label=_(u'Enable migration mode'),
        ),
        parameters.DNParam(
            'ipacertificatesubjectbase',
            label=_(u'Certificate Subject base'),
            doc=_(u'Base for certificate subjects (OU=Test,O=Example)'),
        ),
        parameters.Str(
            'ipagroupobjectclasses',
            multivalue=True,
            label=_(u'Default group objectclasses'),
            doc=_(u'Default group objectclasses (comma-separated list)'),
        ),
        parameters.Str(
            'ipauserobjectclasses',
            multivalue=True,
            label=_(u'Default user objectclasses'),
            doc=_(u'Default user objectclasses (comma-separated list)'),
        ),
        parameters.Int(
            'ipapwdexpadvnotify',
            label=_(u'Password Expiration Notification (days)'),
            doc=_(u"Number of days's notice of impending password expiration"),
        ),
        parameters.Str(
            'ipaconfigstring',
            required=False,
            multivalue=True,
            label=_(u'Password plugin features'),
            doc=_(u'Extra hashes to generate in password plug-in'),
        ),
        parameters.Str(
            'ipaselinuxusermaporder',
            label=_(u'SELinux user map order'),
            doc=_(u'Order in increasing priority of SELinux users, delimited by $'),
        ),
        parameters.Str(
            'ipaselinuxusermapdefault',
            required=False,
            label=_(u'Default SELinux user'),
            doc=_(u'Default SELinux user when no match is found in SELinux map rule'),
        ),
        parameters.Str(
            'ipakrbauthzdata',
            required=False,
            multivalue=True,
            label=_(u'Default PAC types'),
            doc=_(u'Default types of PAC supported for services'),
        ),
        parameters.Str(
            'ipauserauthtype',
            required=False,
            multivalue=True,
            label=_(u'Default user authentication types'),
            doc=_(u'Default types of supported user authentication'),
        ),
    )


@register()
class config_mod(Method):
    __doc__ = _("Modify configuration options.")

    takes_options = (
        parameters.Int(
            'ipamaxusernamelength',
            required=False,
            cli_name='maxusername',
            label=_(u'Maximum username length'),
        ),
        parameters.Str(
            'ipahomesrootdir',
            required=False,
            cli_name='homedirectory',
            label=_(u'Home directory base'),
            doc=_(u'Default location of home directories'),
        ),
        parameters.Str(
            'ipadefaultloginshell',
            required=False,
            cli_name='defaultshell',
            label=_(u'Default shell'),
            doc=_(u'Default shell for new users'),
        ),
        parameters.Str(
            'ipadefaultprimarygroup',
            required=False,
            cli_name='defaultgroup',
            label=_(u'Default users group'),
            doc=_(u'Default group for new users'),
        ),
        parameters.Str(
            'ipadefaultemaildomain',
            required=False,
            cli_name='emaildomain',
            label=_(u'Default e-mail domain'),
        ),
        parameters.Int(
            'ipasearchtimelimit',
            required=False,
            cli_name='searchtimelimit',
            label=_(u'Search time limit'),
            doc=_(u'Maximum amount of time (seconds) for a search (> 0, or -1 for unlimited)'),
        ),
        parameters.Int(
            'ipasearchrecordslimit',
            required=False,
            cli_name='searchrecordslimit',
            label=_(u'Search size limit'),
            doc=_(u'Maximum number of records to search (-1 is unlimited)'),
        ),
        parameters.Str(
            'ipausersearchfields',
            required=False,
            cli_name='usersearch',
            label=_(u'User search fields'),
            doc=_(u'A comma-separated list of fields to search in when searching for users'),
        ),
        parameters.Str(
            'ipagroupsearchfields',
            required=False,
            cli_name='groupsearch',
            label=_(u'Group search fields'),
            doc=_(u'A comma-separated list of fields to search in when searching for groups'),
        ),
        parameters.Bool(
            'ipamigrationenabled',
            required=False,
            cli_name='enable_migration',
            label=_(u'Enable migration mode'),
        ),
        parameters.Str(
            'ipagroupobjectclasses',
            required=False,
            multivalue=True,
            cli_name='groupobjectclasses',
            label=_(u'Default group objectclasses'),
            doc=_(u'Default group objectclasses (comma-separated list)'),
        ),
        parameters.Str(
            'ipauserobjectclasses',
            required=False,
            multivalue=True,
            cli_name='userobjectclasses',
            label=_(u'Default user objectclasses'),
            doc=_(u'Default user objectclasses (comma-separated list)'),
        ),
        parameters.Int(
            'ipapwdexpadvnotify',
            required=False,
            cli_name='pwdexpnotify',
            label=_(u'Password Expiration Notification (days)'),
            doc=_(u"Number of days's notice of impending password expiration"),
        ),
        parameters.Str(
            'ipaconfigstring',
            required=False,
            multivalue=True,
            cli_metavar="['AllowNThash', 'KDC:Disable Last Success', 'KDC:Disable Lockout']",
            label=_(u'Password plugin features'),
            doc=_(u'Extra hashes to generate in password plug-in'),
        ),
        parameters.Str(
            'ipaselinuxusermaporder',
            required=False,
            label=_(u'SELinux user map order'),
            doc=_(u'Order in increasing priority of SELinux users, delimited by $'),
        ),
        parameters.Str(
            'ipaselinuxusermapdefault',
            required=False,
            label=_(u'Default SELinux user'),
            doc=_(u'Default SELinux user when no match is found in SELinux map rule'),
        ),
        parameters.Str(
            'ipakrbauthzdata',
            required=False,
            multivalue=True,
            cli_name='pac_type',
            cli_metavar="['MS-PAC', 'PAD', 'nfs:NONE']",
            label=_(u'Default PAC types'),
            doc=_(u'Default types of PAC supported for services'),
        ),
        parameters.Str(
            'ipauserauthtype',
            required=False,
            multivalue=True,
            cli_name='user_auth_type',
            cli_metavar="['password', 'radius', 'otp']",
            label=_(u'Default user authentication types'),
            doc=_(u'Default types of supported user authentication'),
        ),
        parameters.Str(
            'setattr',
            required=False,
            multivalue=True,
            doc=_(u'Set an attribute to a name/value pair. Format is attr=value.\nFor multi-valued attributes, the command replaces the values already present.'),
            exclude=('webui',),
        ),
        parameters.Str(
            'addattr',
            required=False,
            multivalue=True,
            doc=_(u'Add an attribute/value pair. Format is attr=value. The attribute\nmust be part of the schema.'),
            exclude=('webui',),
        ),
        parameters.Str(
            'delattr',
            required=False,
            multivalue=True,
            doc=_(u'Delete an attribute/value pair. The option will be evaluated\nlast, after all sets and adds.'),
            exclude=('webui',),
        ),
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=_(u'Display the access rights of this entry (requires --all). See ipa man page for details.'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )


@register()
class config_show(Method):
    __doc__ = _("Show the current configuration.")

    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=_(u'Display the access rights of this entry (requires --all). See ipa man page for details.'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )