2008-10-24 16:07:07 -05:00
|
|
|
# Authors:
|
2008-10-24 21:59:11 -05:00
|
|
|
# Martin Nagy <mnagy@redhat.com>
|
2008-10-24 16:07:07 -05:00
|
|
|
# Jason Gerard DeRose <jderose@redhat.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2008 Red Hat
|
|
|
|
# see file 'COPYING' for use and warranty information
|
|
|
|
#
|
2010-12-09 06:59:11 -06:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2008-10-24 16:07:07 -05:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2010-12-09 06:59:11 -06:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-10-24 16:07:07 -05:00
|
|
|
|
|
|
|
"""
|
2008-12-10 22:14:05 -06:00
|
|
|
All constants centralised in one file.
|
2008-10-24 16:07:07 -05:00
|
|
|
"""
|
2017-02-17 04:25:17 -06:00
|
|
|
|
|
|
|
import os
|
2021-10-12 02:57:27 -05:00
|
|
|
import string
|
2020-09-11 07:49:16 -05:00
|
|
|
|
2020-09-11 05:22:02 -05:00
|
|
|
from ipaplatform.constants import constants as _constants
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
from ipapython.dn import DN
|
2020-09-11 07:49:16 -05:00
|
|
|
from ipapython.fqdn import gethostfqdn
|
2014-06-06 07:39:59 -05:00
|
|
|
from ipapython.version import VERSION, API_VERSION
|
|
|
|
|
2020-09-11 07:49:16 -05:00
|
|
|
|
|
|
|
FQDN = gethostfqdn()
|
2008-10-24 16:07:07 -05:00
|
|
|
|
2019-07-01 03:41:23 -05:00
|
|
|
# TLS related constants
|
|
|
|
# * SSL2 and SSL3 are broken.
|
|
|
|
# * TLS1.0 and TLS1.1 are no longer state of the art.
|
2019-11-22 03:42:11 -06:00
|
|
|
# * TLS1.2 and 1.3 are secure and working properly
|
|
|
|
# * Crypto policies restrict TLS range to 1.2 and 1.3. Python 3.6 cannot
|
|
|
|
# override the crypto policy.
|
2019-07-01 03:41:23 -05:00
|
|
|
|
|
|
|
TLS_VERSIONS = [
|
|
|
|
"ssl2",
|
|
|
|
"ssl3",
|
|
|
|
"tls1.0",
|
|
|
|
"tls1.1",
|
|
|
|
"tls1.2",
|
|
|
|
"tls1.3",
|
|
|
|
]
|
2019-11-22 03:42:11 -06:00
|
|
|
TLS_VERSION_MINIMAL = "tls1.2"
|
|
|
|
TLS_VERSION_MAXIMAL = "tls1.3"
|
|
|
|
TLS_VERSION_DEFAULT_MIN = None
|
|
|
|
TLS_VERSION_DEFAULT_MAX = None
|
2019-07-01 03:41:23 -05:00
|
|
|
|
2008-12-30 01:45:48 -06:00
|
|
|
# regular expression NameSpace member names must match:
|
2010-02-12 10:01:23 -06:00
|
|
|
NAME_REGEX = r'^[a-z][_a-z0-9]*[a-z0-9]$|^[a-z]$'
|
2008-12-30 01:45:48 -06:00
|
|
|
|
|
|
|
# Format for ValueError raised when name does not match above regex:
|
2012-11-08 09:06:35 -06:00
|
|
|
NAME_ERROR = "name must match '%s'; got '%s'"
|
2008-12-30 01:45:48 -06:00
|
|
|
|
2008-12-18 15:01:59 -06:00
|
|
|
# Standard format for TypeError message:
|
2008-12-30 01:45:48 -06:00
|
|
|
TYPE_ERROR = '%s: need a %r; got %r (a %r)'
|
2008-12-11 19:07:54 -06:00
|
|
|
|
2008-12-18 15:01:59 -06:00
|
|
|
# Stardard format for TypeError message when a callable is expected:
|
2008-12-18 03:08:41 -06:00
|
|
|
CALLABLE_ERROR = '%s: need a callable; got %r (which is a %r)'
|
2008-12-11 19:07:54 -06:00
|
|
|
|
2015-08-24 05:40:33 -05:00
|
|
|
# Standard format for Exception message when overriding an attribute:
|
2008-12-22 18:29:11 -06:00
|
|
|
OVERRIDE_ERROR = 'cannot override %s.%s value %r with %r'
|
|
|
|
|
|
|
|
# Standard format for AttributeError message when a read-only attribute is
|
|
|
|
# already locked:
|
2008-12-22 22:02:43 -06:00
|
|
|
SET_ERROR = 'locked: cannot set %s.%s to %r'
|
2008-12-30 01:45:48 -06:00
|
|
|
DEL_ERROR = 'locked: cannot delete %s.%s'
|
2008-12-11 19:07:54 -06:00
|
|
|
|
2008-11-12 01:46:04 -06:00
|
|
|
# Used for a tab (or indentation level) when formatting for CLI:
|
|
|
|
CLI_TAB = ' ' # Two spaces
|
2008-10-31 19:55:32 -05:00
|
|
|
|
2008-10-24 21:02:14 -05:00
|
|
|
# The section to read in the config files, i.e. [global]
|
2008-10-24 16:07:07 -05:00
|
|
|
CONFIG_SECTION = 'global'
|
2008-10-24 21:02:14 -05:00
|
|
|
|
|
|
|
# The default configuration for api.env
|
2008-10-24 21:59:11 -05:00
|
|
|
# This is a tuple instead of a dict so that it is immutable.
|
|
|
|
# To create a dict with this config, just "d = dict(DEFAULT_CONFIG)".
|
2008-10-24 21:02:14 -05:00
|
|
|
DEFAULT_CONFIG = (
|
2014-06-06 07:39:59 -05:00
|
|
|
('api_version', API_VERSION),
|
2011-12-20 19:45:57 -06:00
|
|
|
('version', VERSION),
|
|
|
|
|
2008-10-24 21:59:11 -05:00
|
|
|
# Domain, realm, basedn:
|
2016-05-10 07:20:15 -05:00
|
|
|
# Following values do not have any reasonable default.
|
|
|
|
# Do not initialize them so the code which depends on them blows up early
|
|
|
|
# and does not do crazy stuff with default values instead of real ones.
|
|
|
|
# ('domain', 'example.com'),
|
|
|
|
# ('realm', 'EXAMPLE.COM'),
|
|
|
|
# ('basedn', DN(('dc', 'example'), ('dc', 'com'))),
|
2008-10-24 21:59:11 -05:00
|
|
|
|
|
|
|
# LDAP containers:
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
('container_accounts', DN(('cn', 'accounts'))),
|
|
|
|
('container_user', DN(('cn', 'users'), ('cn', 'accounts'))),
|
2015-03-05 07:25:33 -06:00
|
|
|
('container_deleteuser', DN(('cn', 'deleted users'), ('cn', 'accounts'), ('cn', 'provisioning'))),
|
|
|
|
('container_stageuser', DN(('cn', 'staged users'), ('cn', 'accounts'), ('cn', 'provisioning'))),
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
('container_group', DN(('cn', 'groups'), ('cn', 'accounts'))),
|
|
|
|
('container_service', DN(('cn', 'services'), ('cn', 'accounts'))),
|
|
|
|
('container_host', DN(('cn', 'computers'), ('cn', 'accounts'))),
|
|
|
|
('container_hostgroup', DN(('cn', 'hostgroups'), ('cn', 'accounts'))),
|
|
|
|
('container_rolegroup', DN(('cn', 'roles'), ('cn', 'accounts'))),
|
|
|
|
('container_permission', DN(('cn', 'permissions'), ('cn', 'pbac'))),
|
|
|
|
('container_privilege', DN(('cn', 'privileges'), ('cn', 'pbac'))),
|
|
|
|
('container_automount', DN(('cn', 'automount'))),
|
|
|
|
('container_policies', DN(('cn', 'policies'))),
|
|
|
|
('container_configs', DN(('cn', 'configs'), ('cn', 'policies'))),
|
|
|
|
('container_roles', DN(('cn', 'roles'), ('cn', 'policies'))),
|
|
|
|
('container_applications', DN(('cn', 'applications'), ('cn', 'configs'), ('cn', 'policies'))),
|
|
|
|
('container_policygroups', DN(('cn', 'policygroups'), ('cn', 'configs'), ('cn', 'policies'))),
|
|
|
|
('container_policylinks', DN(('cn', 'policylinks'), ('cn', 'configs'), ('cn', 'policies'))),
|
|
|
|
('container_netgroup', DN(('cn', 'ng'), ('cn', 'alt'))),
|
|
|
|
('container_hbac', DN(('cn', 'hbac'))),
|
|
|
|
('container_hbacservice', DN(('cn', 'hbacservices'), ('cn', 'hbac'))),
|
|
|
|
('container_hbacservicegroup', DN(('cn', 'hbacservicegroups'), ('cn', 'hbac'))),
|
|
|
|
('container_dns', DN(('cn', 'dns'))),
|
2015-06-10 05:35:43 -05:00
|
|
|
('container_vault', DN(('cn', 'vaults'), ('cn', 'kra'))),
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
('container_virtual', DN(('cn', 'virtual operations'), ('cn', 'etc'))),
|
|
|
|
('container_sudorule', DN(('cn', 'sudorules'), ('cn', 'sudo'))),
|
|
|
|
('container_sudocmd', DN(('cn', 'sudocmds'), ('cn', 'sudo'))),
|
|
|
|
('container_sudocmdgroup', DN(('cn', 'sudocmdgroups'), ('cn', 'sudo'))),
|
|
|
|
('container_automember', DN(('cn', 'automember'), ('cn', 'etc'))),
|
|
|
|
('container_selinux', DN(('cn', 'usermap'), ('cn', 'selinux'))),
|
|
|
|
('container_s4u2proxy', DN(('cn', 's4u2proxy'), ('cn', 'etc'))),
|
|
|
|
('container_cifsdomains', DN(('cn', 'ad'), ('cn', 'etc'))),
|
|
|
|
('container_trusts', DN(('cn', 'trusts'))),
|
|
|
|
('container_adtrusts', DN(('cn', 'ad'), ('cn', 'trusts'))),
|
|
|
|
('container_ranges', DN(('cn', 'ranges'), ('cn', 'etc'))),
|
|
|
|
('container_dna', DN(('cn', 'dna'), ('cn', 'ipa'), ('cn', 'etc'))),
|
|
|
|
('container_dna_posix_ids', DN(('cn', 'posix-ids'), ('cn', 'dna'), ('cn', 'ipa'), ('cn', 'etc'))),
|
2021-04-14 08:21:18 -05:00
|
|
|
('container_dna_subordinate_ids', DN(
|
|
|
|
('cn', 'subordinate-ids'), ('cn', 'dna'), ('cn', 'ipa'), ('cn', 'etc')
|
|
|
|
)),
|
2013-02-12 09:50:00 -06:00
|
|
|
('container_realm_domains', DN(('cn', 'Realm Domains'), ('cn', 'ipa'), ('cn', 'etc'))),
|
2013-04-11 12:24:46 -05:00
|
|
|
('container_otp', DN(('cn', 'otp'))),
|
2013-11-11 15:58:02 -06:00
|
|
|
('container_radiusproxy', DN(('cn', 'radiusproxy'))),
|
2014-07-31 04:52:04 -05:00
|
|
|
('container_views', DN(('cn', 'views'), ('cn', 'accounts'))),
|
2015-05-26 07:11:04 -05:00
|
|
|
('container_masters', DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'))),
|
2015-04-30 03:55:29 -05:00
|
|
|
('container_certprofile', DN(('cn', 'certprofiles'), ('cn', 'ca'))),
|
2015-05-22 02:50:09 -05:00
|
|
|
('container_topology', DN(('cn', 'topology'), ('cn', 'ipa'), ('cn', 'etc'))),
|
2015-05-25 07:39:07 -05:00
|
|
|
('container_caacl', DN(('cn', 'caacls'), ('cn', 'ca'))),
|
2016-05-12 03:54:20 -05:00
|
|
|
('container_locations', DN(('cn', 'locations'), ('cn', 'etc'))),
|
2015-05-14 00:46:06 -05:00
|
|
|
('container_ca', DN(('cn', 'cas'), ('cn', 'ca'))),
|
2016-06-13 13:02:21 -05:00
|
|
|
('container_dnsservers', DN(('cn', 'servers'), ('cn', 'dns'))),
|
2016-08-08 09:06:08 -05:00
|
|
|
('container_custodia', DN(('cn', 'custodia'), ('cn', 'ipa'), ('cn', 'etc'))),
|
2016-11-11 03:23:49 -06:00
|
|
|
('container_sysaccounts', DN(('cn', 'sysaccounts'), ('cn', 'etc'))),
|
2016-12-20 09:21:58 -06:00
|
|
|
('container_certmap', DN(('cn', 'certmap'))),
|
|
|
|
('container_certmaprules', DN(('cn', 'certmaprules'), ('cn', 'certmap'))),
|
2019-03-26 03:43:25 -05:00
|
|
|
('container_ca_renewal',
|
|
|
|
DN(('cn', 'ca_renewal'), ('cn', 'ipa'), ('cn', 'etc'))),
|
2021-04-14 08:21:18 -05:00
|
|
|
('container_subids', DN(('cn', 'subids'), ('cn', 'accounts'))),
|
2012-06-13 13:58:54 -05:00
|
|
|
|
2008-10-24 21:59:11 -05:00
|
|
|
# Ports, hosts, and URIs:
|
2016-05-10 07:20:15 -05:00
|
|
|
# Following values do not have any reasonable default.
|
|
|
|
# Do not initialize them so the code which depends on them blows up early
|
|
|
|
# and does not do crazy stuff with default values instead of real ones.
|
2017-02-21 07:24:51 -06:00
|
|
|
# ('server', 'localhost'),
|
2016-05-10 07:20:15 -05:00
|
|
|
# ('xmlrpc_uri', 'http://localhost:8888/ipa/xml'),
|
2017-02-21 07:24:51 -06:00
|
|
|
# ('jsonrpc_uri', 'http://localhost:8888/ipa/json'),
|
2016-05-10 07:20:15 -05:00
|
|
|
# ('ldap_uri', 'ldap://localhost:389'),
|
2012-12-19 03:25:24 -06:00
|
|
|
|
|
|
|
('rpc_protocol', 'jsonrpc'),
|
|
|
|
|
2021-03-26 11:39:20 -05:00
|
|
|
('ldap_cache', True),
|
|
|
|
('ldap_cache_size', 100),
|
|
|
|
|
2014-10-30 10:52:14 -05:00
|
|
|
# Define an inclusive range of SSL/TLS version support
|
2019-07-01 03:41:23 -05:00
|
|
|
('tls_version_min', TLS_VERSION_DEFAULT_MIN),
|
|
|
|
('tls_version_max', TLS_VERSION_DEFAULT_MAX),
|
2014-10-30 10:52:14 -05:00
|
|
|
|
2019-04-17 03:32:09 -05:00
|
|
|
# Time to wait for a service to start, in seconds.
|
|
|
|
# Note that systemd has a DefaultTimeoutStartSec of 90 seconds. Higher
|
|
|
|
# values are not effective unless systemd is reconfigured, too.
|
|
|
|
('startup_timeout', 120),
|
2017-05-02 12:52:13 -05:00
|
|
|
# How long http connection should wait for reply [seconds].
|
|
|
|
('http_timeout', 30),
|
2018-06-22 03:00:24 -05:00
|
|
|
# How long to wait for an entry to appear on a replica
|
|
|
|
('replication_wait_timeout', 300),
|
2019-07-05 12:31:32 -05:00
|
|
|
# How long to wait for a certmonger request to finish
|
|
|
|
('certmonger_wait_timeout', 300),
|
2008-10-24 21:02:14 -05:00
|
|
|
|
2021-10-14 16:07:32 -05:00
|
|
|
# Number of seconds before client should check for schema update.
|
|
|
|
('schema_ttl', 3600),
|
|
|
|
|
2009-10-13 12:28:00 -05:00
|
|
|
# Web Application mount points
|
|
|
|
('mount_ipa', '/ipa/'),
|
|
|
|
|
|
|
|
# WebUI stuff:
|
|
|
|
('webui_prod', True),
|
2012-02-19 09:02:38 -06:00
|
|
|
|
|
|
|
# Session stuff:
|
2017-06-05 08:50:22 -05:00
|
|
|
('kinit_lifetime', None),
|
add session manager and cache krb auth
This patch adds a session manager and support for caching
authentication in the session. Major elements of the patch are:
* Add a session manager to support cookie based sessions which
stores session data in a memcached entry.
* Add ipalib/krb_utils.py which contains functions to parse ccache
names, format principals, format KRB timestamps, and a KRB_CCache
class which reads ccache entry and allows one to extract information
such as the principal, credentials, credential timestamps, etc.
* Move krb constants defined in ipalib/rpc.py to ipa_krb_utils.py so
that all kerberos items are co-located.
* Modify javascript in ipa.js so that the IPA.command() RPC call
checks for authentication needed error response and if it receives
it sends a GET request to /ipa/login URL to refresh credentials.
* Add session_auth_duration config item to constants.py, used to
configure how long a session remains valid.
* Add parse_time_duration utility to ipalib/util.py. Used to parse the
session_auth_duration config item.
* Update the default.conf.5 man page to document session_auth_duration
config item (also added documentation for log_manager config items
which had been inadvertantly omitted from a previous commit).
* Add SessionError object to ipalib/errors.py
* Move Kerberos protection in Apache config from /ipa to /ipa/xml and
/ipa/login
* Add SessionCCache class to session.py to manage temporary Kerberos
ccache file in effect for the duration of an RPC command.
* Adds a krblogin plugin used to implement the /ipa/login
handler. login handler sets the session expiration time, currently
60 minutes or the expiration of the TGT, whichever is shorter. It
also copies the ccache provied by mod_auth_kerb into the session
data. The json handler will later extract and validate the ccache
belonging to the session.
* Refactored the WSGI handlers so that json and xlmrpc could have
independent behavior, this also moves where create and destroy
context occurs, now done in the individual handler rather than the
parent class.
* The json handler now looks up the session data, validates the ccache
bound to the session, if it's expired replies with authenicated
needed error.
* Add documentation to session.py. Fully documents the entire process,
got questions, read the doc.
* Add exclusions to make-lint as needed.
2012-02-06 12:29:56 -06:00
|
|
|
|
2008-10-24 21:59:11 -05:00
|
|
|
# Debugging:
|
2010-06-03 16:07:24 -05:00
|
|
|
('verbose', 0),
|
2008-10-24 21:02:14 -05:00
|
|
|
('debug', False),
|
2010-06-25 12:37:27 -05:00
|
|
|
('startup_traceback', False),
|
2008-10-28 00:30:55 -05:00
|
|
|
('mode', 'production'),
|
2015-01-13 03:14:43 -06:00
|
|
|
('wait_for_dns', 0),
|
2008-10-24 21:02:14 -05:00
|
|
|
|
2009-01-22 11:59:46 -06:00
|
|
|
# CA plugin:
|
2011-06-23 01:06:49 -05:00
|
|
|
('ca_host', FQDN), # Set in Env._finalize_core()
|
2011-08-17 14:36:18 -05:00
|
|
|
('ca_port', 80),
|
|
|
|
('ca_agent_port', 443),
|
2012-08-23 11:38:45 -05:00
|
|
|
# For the following ports, None means a default specific to the installed
|
|
|
|
# Dogtag version.
|
|
|
|
('ca_install_port', None),
|
2011-08-17 14:36:18 -05:00
|
|
|
|
2015-06-17 06:50:32 -05:00
|
|
|
# Topology plugin
|
|
|
|
('recommended_max_agmts', 4), # Recommended maximum number of replication
|
|
|
|
# agreements
|
|
|
|
|
2009-01-28 14:05:26 -06:00
|
|
|
# Special CLI:
|
|
|
|
('prompt_all', False),
|
|
|
|
('interactive', True),
|
2010-07-26 16:54:38 -05:00
|
|
|
('fallback', True),
|
2012-02-15 10:06:54 -06:00
|
|
|
('delegate', False),
|
2009-01-28 14:05:26 -06:00
|
|
|
|
2009-02-11 14:07:19 -06:00
|
|
|
# Enable certain optional plugins:
|
|
|
|
('enable_ra', False),
|
2009-09-10 15:15:14 -05:00
|
|
|
('ra_plugin', 'selfsign'),
|
2012-08-23 11:38:45 -05:00
|
|
|
('dogtag_version', 9),
|
2009-02-11 14:07:19 -06:00
|
|
|
|
2011-01-13 13:29:16 -06:00
|
|
|
# Used when verifying that the API hasn't changed. Not for production.
|
|
|
|
('validate_api', False),
|
|
|
|
|
2015-07-03 05:21:09 -05:00
|
|
|
# Skip client vs. server API version checking. Can lead to errors/strange
|
|
|
|
# behavior when newer clients talk to older servers. Use with caution.
|
|
|
|
('skip_version_check', False),
|
|
|
|
|
2016-06-21 07:42:04 -05:00
|
|
|
# Ignore TTL. Perform schema call and download schema if not in cache.
|
|
|
|
('force_schema_check', False),
|
|
|
|
|
2008-10-24 21:59:11 -05:00
|
|
|
# ********************************************************
|
|
|
|
# The remaining keys are never set from the values here!
|
|
|
|
# ********************************************************
|
|
|
|
#
|
2009-05-11 03:34:52 -05:00
|
|
|
# Env._bootstrap() or Env._finalize_core() will have filled in all the keys
|
|
|
|
# below by the time DEFAULT_CONFIG is merged in, so the values below are
|
|
|
|
# never actually used. They are listed both to provide a big picture and
|
|
|
|
# also so DEFAULT_CONFIG contains at least all the keys that should be
|
|
|
|
# present after Env._finalize_core() is called.
|
2008-10-24 21:59:11 -05:00
|
|
|
#
|
2008-12-22 17:16:57 -06:00
|
|
|
# Each environment variable below is sent to ``object``, which just happens
|
|
|
|
# to be an invalid value for an environment variable, so if for some reason
|
|
|
|
# any of these keys were set from the values here, an exception will be
|
|
|
|
# raised.
|
2008-10-24 21:02:14 -05:00
|
|
|
|
2009-05-11 03:34:52 -05:00
|
|
|
# Non-overridable vars set in Env._bootstrap():
|
2011-06-23 01:06:49 -05:00
|
|
|
('host', FQDN),
|
2009-05-11 03:34:52 -05:00
|
|
|
('ipalib', object), # The directory containing ipalib/__init__.py
|
|
|
|
('site_packages', object), # The directory contaning ipalib
|
|
|
|
('script', object), # sys.argv[0]
|
|
|
|
('bin', object), # The directory containing the script
|
2019-01-14 09:16:27 -06:00
|
|
|
('home', object), # os.path.expanduser('~')
|
2009-05-11 03:34:52 -05:00
|
|
|
|
|
|
|
# Vars set in Env._bootstrap():
|
|
|
|
('in_tree', object), # Whether or not running in-tree (bool)
|
|
|
|
('dot_ipa', object), # ~/.ipa directory
|
|
|
|
('context', object), # Name of context, default is 'default'
|
|
|
|
('confdir', object), # Directory containing config files
|
2016-12-05 06:39:42 -06:00
|
|
|
('env_confdir', None), # conf dir specified by IPA_CONFDIR env variable
|
2009-05-11 03:34:52 -05:00
|
|
|
('conf', object), # File containing context specific config
|
|
|
|
('conf_default', object), # File containing context independent config
|
2011-11-03 05:42:17 -05:00
|
|
|
('plugins_on_demand', object), # Whether to finalize plugins on-demand (bool)
|
2016-10-24 02:39:49 -05:00
|
|
|
('nss_dir', object), # Path to nssdb, default {confdir}/nssdb
|
2016-12-20 03:05:36 -06:00
|
|
|
('tls_ca_cert', object), # Path to CA cert file
|
2008-10-24 21:02:14 -05:00
|
|
|
|
|
|
|
# Set in Env._finalize_core():
|
2009-05-11 03:34:52 -05:00
|
|
|
('in_server', object), # Whether or not running in-server (bool)
|
|
|
|
('logdir', object), # Directory containing log files
|
|
|
|
('log', object), # Path to context specific log file
|
2008-10-24 21:02:14 -05:00
|
|
|
|
|
|
|
)
|
2014-01-09 04:14:56 -06:00
|
|
|
|
|
|
|
LDAP_GENERALIZED_TIME_FORMAT = "%Y%m%d%H%M%SZ"
|
2014-08-22 09:11:58 -05:00
|
|
|
|
|
|
|
IPA_ANCHOR_PREFIX = ':IPA:'
|
|
|
|
SID_ANCHOR_PREFIX = ':SID:'
|
2015-05-14 03:49:55 -05:00
|
|
|
|
2015-10-26 11:56:57 -05:00
|
|
|
# domains levels
|
|
|
|
DOMAIN_LEVEL_0 = 0 # compat
|
|
|
|
DOMAIN_LEVEL_1 = 1 # replica promotion, topology plugin
|
|
|
|
|
2018-08-07 04:03:17 -05:00
|
|
|
MIN_DOMAIN_LEVEL = DOMAIN_LEVEL_1
|
2015-10-26 11:56:57 -05:00
|
|
|
MAX_DOMAIN_LEVEL = DOMAIN_LEVEL_1
|
2015-07-31 09:22:13 -05:00
|
|
|
|
|
|
|
# Constants used in generation of replication agreements and as topology
|
|
|
|
# defaults
|
|
|
|
|
|
|
|
# List of attributes that need to be excluded from replication initialization.
|
|
|
|
REPL_AGMT_TOTAL_EXCLUDES = ('entryusn',
|
|
|
|
'krblastsuccessfulauth',
|
|
|
|
'krblastfailedauth',
|
|
|
|
'krbloginfailedcount')
|
|
|
|
|
|
|
|
# List of attributes that need to be excluded from normal replication.
|
|
|
|
REPL_AGMT_EXCLUDES = ('memberof', 'idnssoaserial') + REPL_AGMT_TOTAL_EXCLUDES
|
|
|
|
|
|
|
|
# List of attributes that are not updated on empty replication
|
|
|
|
REPL_AGMT_STRIP_ATTRS = ('modifiersName',
|
|
|
|
'modifyTimestamp',
|
|
|
|
'internalModifiersName',
|
|
|
|
'internalModifyTimestamp')
|
2015-11-27 10:00:23 -06:00
|
|
|
|
|
|
|
DOMAIN_SUFFIX_NAME = 'domain'
|
|
|
|
CA_SUFFIX_NAME = 'ca'
|
2016-05-31 17:07:33 -05:00
|
|
|
PKI_GSSAPI_SERVICE_NAME = 'dogtag'
|
2015-05-14 00:46:06 -05:00
|
|
|
IPA_CA_CN = u'ipa'
|
2016-06-22 05:20:09 -05:00
|
|
|
IPA_CA_RECORD = "ipa-ca"
|
2016-08-23 01:14:30 -05:00
|
|
|
IPA_CA_NICKNAME = 'caSigningCert cert-pki-ca'
|
|
|
|
RENEWAL_CA_NAME = 'dogtag-ipa-ca-renew-agent'
|
2017-09-25 02:30:06 -05:00
|
|
|
RENEWAL_REUSE_CA_NAME = 'dogtag-ipa-ca-renew-agent-reuse'
|
2020-01-21 22:38:25 -06:00
|
|
|
RENEWAL_SELFSIGNED_CA_NAME = 'dogtag-ipa-ca-renew-agent-selfsigned'
|
2019-08-08 00:08:58 -05:00
|
|
|
# The RA agent cert is used for client cert authentication. In the past IPA
|
|
|
|
# used caServerCert profile, which adds clientAuth and serverAuth EKU. The
|
|
|
|
# serverAuth EKU caused trouble with NamedConstraints, see RHBZ#1670239.
|
2019-08-05 09:22:44 -05:00
|
|
|
RA_AGENT_PROFILE = 'caSubsystemCert'
|
2017-09-13 11:27:48 -05:00
|
|
|
# How long dbus clients should wait for CA certificate RPCs [seconds]
|
|
|
|
CA_DBUS_TIMEOUT = 120
|
2016-09-20 06:00:53 -05:00
|
|
|
|
2019-05-01 09:15:37 -05:00
|
|
|
# Maximum hostname length in Linux
|
2020-09-18 06:11:28 -05:00
|
|
|
# It's the max length of uname's nodename and return value of gethostname().
|
2019-05-01 09:15:37 -05:00
|
|
|
MAXHOSTNAMELEN = 64
|
2020-09-18 06:11:28 -05:00
|
|
|
# DNS name is 255 octets, effectively 253 ASCII characters.
|
|
|
|
MAXHOSTFQDNLEN = 253
|
2019-05-01 09:15:37 -05:00
|
|
|
|
2016-09-20 06:00:53 -05:00
|
|
|
# regexp definitions
|
2018-06-25 12:30:24 -05:00
|
|
|
PATTERN_GROUPUSER_NAME = (
|
|
|
|
'(?!^[0-9]+$)^[a-zA-Z0-9_.][a-zA-Z0-9_.-]*[a-zA-Z0-9_.$-]?$'
|
|
|
|
)
|
2016-12-02 05:48:35 -06:00
|
|
|
|
|
|
|
# Kerberos Anonymous principal name
|
|
|
|
ANON_USER = 'WELLKNOWN/ANONYMOUS'
|
2016-08-16 08:03:19 -05:00
|
|
|
|
|
|
|
# IPA API Framework user
|
2020-09-11 05:22:02 -05:00
|
|
|
IPAAPI_USER = _constants.IPAAPI_USER
|
|
|
|
IPAAPI_GROUP = _constants.IPAAPI_GROUP
|
2017-01-13 05:31:29 -06:00
|
|
|
|
2017-02-17 04:25:17 -06:00
|
|
|
# Use cache path
|
|
|
|
USER_CACHE_PATH = (
|
|
|
|
os.environ.get('XDG_CACHE_HOME') or
|
2019-01-14 09:16:27 -06:00
|
|
|
os.path.expanduser('~/.cache')
|
2017-02-17 04:25:17 -06:00
|
|
|
)
|
2017-03-29 11:53:11 -05:00
|
|
|
|
|
|
|
SOFTHSM_DNSSEC_TOKEN_LABEL = u'ipaDNSSEC'
|
2018-05-04 05:16:33 -05:00
|
|
|
# Apache's mod_ssl SSLVerifyDepth value (Maximum depth of CA
|
|
|
|
# Certificates in Client Certificate verification)
|
|
|
|
MOD_SSL_VERIFY_DEPTH = '5'
|
2021-03-19 05:48:38 -05:00
|
|
|
|
|
|
|
# subuid / subgid counts are hard-coded
|
|
|
|
# An interval of 65536 uids/gids is required to map nobody (65534).
|
|
|
|
SUBID_COUNT = 65536
|
|
|
|
|
|
|
|
# upper half of uid_t (uint32_t)
|
|
|
|
SUBID_RANGE_START = 2 ** 31
|
|
|
|
# theoretical max limit is UINT32_MAX-1 ((2 ** 32) - 2)
|
|
|
|
# We use a smaller value to keep the topmost subid interval unused.
|
|
|
|
SUBID_RANGE_MAX = (2 ** 32) - (2 * SUBID_COUNT)
|
|
|
|
SUBID_RANGE_SIZE = SUBID_RANGE_MAX - SUBID_RANGE_START
|
|
|
|
# threshold before DNA plugin requests a new range
|
2021-04-14 08:21:18 -05:00
|
|
|
SUBID_DNA_THRESHOLD = 500
|
2021-05-31 07:43:28 -05:00
|
|
|
|
|
|
|
# moved from ipaserver/install/krainstance.py::KRAInstance to avoid duplication
|
|
|
|
# as per https://pagure.io/freeipa/issue/8795
|
|
|
|
KRA_TRACKING_REQS = {
|
|
|
|
'auditSigningCert cert-pki-kra': 'caAuditSigningCert',
|
|
|
|
'transportCert cert-pki-kra': 'caTransportCert',
|
|
|
|
'storageCert cert-pki-kra': 'caStorageCert',
|
|
|
|
}
|
2021-10-12 02:57:27 -05:00
|
|
|
|
|
|
|
ALLOWED_NETBIOS_CHARS = string.ascii_uppercase + string.digits + '-'
|