0000-12-31 18:09:24 -05:50
|
|
|
#! /usr/bin/python -E
|
|
|
|
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007 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.
|
0000-12-31 18:09:24 -05:50
|
|
|
#
|
|
|
|
# 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/>.
|
0000-12-31 18:09:24 -05:50
|
|
|
#
|
|
|
|
|
|
|
|
import sys
|
2009-06-26 12:37:49 -05:00
|
|
|
import socket
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2012-05-31 07:34:09 -05:00
|
|
|
import os, pwd, shutil
|
2011-01-28 14:45:19 -06:00
|
|
|
import grp
|
2011-09-05 04:04:17 -05:00
|
|
|
from optparse import OptionGroup
|
2012-09-04 02:47:43 -05:00
|
|
|
from contextlib import contextmanager
|
|
|
|
|
|
|
|
import dns.resolver
|
|
|
|
import dns.reversename
|
|
|
|
import dns.exception
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2009-02-05 14:03:08 -06:00
|
|
|
from ipapython import ipautil
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2010-12-07 17:23:05 -06:00
|
|
|
from ipaserver.install import dsinstance, installutils, krbinstance, service
|
2009-06-26 12:37:49 -05:00
|
|
|
from ipaserver.install import bindinstance, httpinstance, ntpinstance, certs
|
2012-02-16 11:02:36 -06:00
|
|
|
from ipaserver.install import memcacheinstance
|
2012-05-16 17:11:11 -05:00
|
|
|
from ipaserver.install.replication import replica_conn_check, ReplicationManager
|
2011-05-27 10:05:45 -05:00
|
|
|
from ipaserver.install.installutils import HostnameLocalhost, resolve_host
|
2011-06-17 15:47:39 -05:00
|
|
|
from ipaserver.install.installutils import ReplicaConfig, expand_replica_info, read_replica_info
|
2011-10-06 04:26:03 -05:00
|
|
|
from ipaserver.install.installutils import get_host_name, BadHostError
|
2010-03-24 09:51:31 -05:00
|
|
|
from ipaserver.plugins.ldap2 import ldap2
|
2011-06-17 15:47:39 -05:00
|
|
|
from ipaserver.install import cainstance
|
2010-03-24 09:51:31 -05:00
|
|
|
from ipalib import api, errors, util
|
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 import version
|
2010-10-29 13:24:31 -05:00
|
|
|
from ipapython.config import IPAOptionParser
|
2011-01-28 14:45:19 -06:00
|
|
|
from ipapython import sysrestore
|
2011-09-12 16:11:54 -05:00
|
|
|
from ipapython import services as ipaservices
|
2011-11-15 13:39:31 -06:00
|
|
|
from ipapython.ipa_log_manager import *
|
2012-08-23 11:38:45 -05:00
|
|
|
from ipapython import dogtag
|
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
|
2012-12-07 09:44:32 -06:00
|
|
|
import ipaclient.ntpconf
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2012-05-31 07:34:09 -05:00
|
|
|
log_file_name = "/var/log/ipareplica-install.log"
|
|
|
|
CACERT = "/etc/ipa/ca.crt"
|
|
|
|
REPLICA_INFO_TOP_DIR = None
|
2012-09-04 02:47:43 -05:00
|
|
|
DIRMAN_DN = DN(('cn', 'directory manager'))
|
2008-08-11 15:15:30 -05:00
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
def parse_options():
|
2010-10-11 12:06:11 -05:00
|
|
|
usage = "%prog [options] REPLICA_FILE"
|
2010-10-29 13:24:31 -05:00
|
|
|
parser = IPAOptionParser(usage=usage, version=version.VERSION)
|
2011-09-05 04:04:17 -05:00
|
|
|
|
|
|
|
basic_group = OptionGroup(parser, "basic options")
|
|
|
|
basic_group.add_option("--setup-ca", dest="setup_ca", action="store_true",
|
|
|
|
default=False, help="configure a dogtag CA")
|
2012-01-04 13:04:21 -06:00
|
|
|
basic_group.add_option("--ip-address", dest="ip_address",
|
|
|
|
type="ip", ip_local=True,
|
|
|
|
help="Replica server IP Address")
|
2011-09-05 04:04:17 -05:00
|
|
|
basic_group.add_option("-p", "--password", dest="password", sensitive=True,
|
2008-06-04 14:37:12 -05:00
|
|
|
help="Directory Manager (existing master) password")
|
2011-09-05 04:04:17 -05:00
|
|
|
basic_group.add_option("-w", "--admin-password", dest="admin_password", sensitive=True,
|
2011-05-22 12:17:07 -05:00
|
|
|
help="Admin user Kerberos password used for connection check")
|
2013-03-27 07:48:01 -05:00
|
|
|
basic_group.add_option("--mkhomedir",
|
|
|
|
dest="mkhomedir",
|
|
|
|
action="store_true",
|
|
|
|
default=False,
|
|
|
|
help="create home directories for users "
|
|
|
|
"on their first login")
|
2011-09-05 04:04:17 -05:00
|
|
|
basic_group.add_option("-N", "--no-ntp", dest="conf_ntp", action="store_false",
|
|
|
|
help="do not configure ntp", default=True)
|
|
|
|
basic_group.add_option("--no-ui-redirect", dest="ui_redirect", action="store_false",
|
|
|
|
default=True, help="Do not automatically redirect to the Web UI")
|
2011-12-07 02:49:09 -06:00
|
|
|
basic_group.add_option("--ssh-trust-dns", dest="trust_sshfp", default=False, action="store_true",
|
|
|
|
help="configure OpenSSH client to trust DNS SSHFP records")
|
2012-09-12 08:19:26 -05:00
|
|
|
basic_group.add_option("--no-ssh", dest="conf_ssh", default=True, action="store_false",
|
|
|
|
help="do not configure OpenSSH client")
|
2011-12-07 02:49:09 -06:00
|
|
|
basic_group.add_option("--no-sshd", dest="conf_sshd", default=True, action="store_false",
|
|
|
|
help="do not configure OpenSSH server")
|
2011-09-05 04:04:17 -05:00
|
|
|
basic_group.add_option("--skip-conncheck", dest="skip_conncheck", action="store_true",
|
|
|
|
default=False, help="skip connection check to remote master")
|
|
|
|
basic_group.add_option("-d", "--debug", dest="debug", action="store_true",
|
|
|
|
default=False, help="gather extra debugging information")
|
|
|
|
basic_group.add_option("-U", "--unattended", dest="unattended", action="store_true",
|
|
|
|
default=False, help="unattended installation never prompts the user")
|
|
|
|
parser.add_option_group(basic_group)
|
|
|
|
|
|
|
|
cert_group = OptionGroup(parser, "certificate system options")
|
|
|
|
cert_group.add_option("--no-pkinit", dest="setup_pkinit", action="store_false",
|
|
|
|
default=True, help="disables pkinit setup steps")
|
Fix schema replication from old masters
The new merged database will replicate with both the IPA and CA trees, so all
DS instances (IPA and CA on the existing master, and the merged one on the
replica) need to have the same schema.
Dogtag does all its schema modifications online. Those are replicated normally.
The basic IPA schema, however, is delivered in ldif files, which are not
replicated. The files are not present on old CA DS instances. Any schema
update that references objects in these files will fail.
The whole 99user.ldif (i.e. changes introduced dynamically over LDAP) is
replicated as a blob. If we updated the old master's CA schema dynamically
during replica install, it would conflict with updates done during the
installation: the one with the lower CSN would get lost.
Dogtag's spawn script recently grew a new flag, 'pki_clone_replicate_schema'.
Turning it off tells Dogtag to create its schema in the clone, where the IPA
modifications are taking place, so that it is not overwritten by the IPA schema
on replication.
The patch solves the problems by:
- In __spawn_instance, turning off the pki_clone_replicate_schema flag.
- Providing a script to copy the IPA schema files to the CA DS instance.
The script needs to be copied to old masters and run there.
- At replica CA install, checking if the schema is updated, and failing if not.
The --skip-schema-check option is added to ipa-{replica,ca}-install to
override the check.
All pre-3.1 CA servers in a domain will have to have the script run on them to
avoid schema replication errors.
https://fedorahosted.org/freeipa/ticket/3213
2012-10-24 03:37:16 -05:00
|
|
|
cert_group.add_option("--skip-schema-check", dest="skip_schema_check", action="store_true",
|
|
|
|
default=False, help="skip check for updated CA DS schema on the remote master")
|
2011-09-05 04:04:17 -05:00
|
|
|
parser.add_option_group(cert_group)
|
|
|
|
|
|
|
|
dns_group = OptionGroup(parser, "DNS options")
|
|
|
|
dns_group.add_option("--setup-dns", dest="setup_dns", action="store_true",
|
2009-06-26 12:37:49 -05:00
|
|
|
default=False, help="configure bind with our zone")
|
2011-09-05 04:04:17 -05:00
|
|
|
dns_group.add_option("--forwarder", dest="forwarders", action="append",
|
2011-06-16 03:47:11 -05:00
|
|
|
type="ip", help="Add a DNS forwarder")
|
2011-09-05 04:04:17 -05:00
|
|
|
dns_group.add_option("--no-forwarders", dest="no_forwarders", action="store_true",
|
2009-09-01 16:28:52 -05:00
|
|
|
default=False, help="Do not add any DNS forwarders, use root servers instead")
|
2011-09-05 04:04:17 -05:00
|
|
|
dns_group.add_option("--reverse-zone", dest="reverse_zone", help="The reverse DNS zone to use")
|
|
|
|
dns_group.add_option("--no-reverse", dest="no_reverse", action="store_true",
|
2012-01-31 08:16:56 -06:00
|
|
|
default=False, help="Do not create new reverse DNS zone")
|
2011-09-05 04:04:17 -05:00
|
|
|
dns_group.add_option("--no-host-dns", dest="no_host_dns", action="store_true",
|
2010-09-10 16:51:08 -05:00
|
|
|
default=False,
|
|
|
|
help="Do not use DNS for hostname lookup during installation")
|
2011-12-07 02:40:51 -06:00
|
|
|
dns_group.add_option("--no-dns-sshfp", dest="create_sshfp", default=True, action="store_false",
|
|
|
|
help="do not automatically create DNS SSHFP records")
|
2011-09-05 04:04:17 -05:00
|
|
|
parser.add_option_group(dns_group)
|
0000-12-31 18:09:24 -05:50
|
|
|
|
|
|
|
options, args = parser.parse_args()
|
2010-10-29 13:24:31 -05:00
|
|
|
safe_options = parser.get_safe_opts(options)
|
0000-12-31 18:09:24 -05:50
|
|
|
|
|
|
|
if len(args) != 1:
|
|
|
|
parser.error("you must provide a file generated by ipa-replica-prepare")
|
|
|
|
|
2009-09-01 16:28:52 -05:00
|
|
|
if not options.setup_dns:
|
|
|
|
if options.forwarders:
|
|
|
|
parser.error("You cannot specify a --forwarder option without the --setup-dns option")
|
|
|
|
if options.no_forwarders:
|
|
|
|
parser.error("You cannot specify a --no-forwarders option without the --setup-dns option")
|
2011-07-11 03:14:53 -05:00
|
|
|
if options.reverse_zone:
|
|
|
|
parser.error("You cannot specify a --reverse-zone option without the --setup-dns option")
|
2011-01-04 07:55:47 -06:00
|
|
|
if options.no_reverse:
|
|
|
|
parser.error("You cannot specify a --no-reverse option without the --setup-dns option")
|
2009-09-01 16:28:52 -05:00
|
|
|
elif options.forwarders and options.no_forwarders:
|
|
|
|
parser.error("You cannot specify a --forwarder option together with --no-forwarders")
|
|
|
|
elif not options.forwarders and not options.no_forwarders:
|
|
|
|
parser.error("You must specify at least one --forwarder option or --no-forwarders option")
|
2011-07-11 03:14:53 -05:00
|
|
|
elif options.reverse_zone and options.no_reverse:
|
|
|
|
parser.error("You cannot specify a --reverse-zone option together with --no-reverse")
|
2009-09-01 16:28:52 -05:00
|
|
|
|
2010-10-29 13:24:31 -05:00
|
|
|
return safe_options, options, args[0]
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2008-05-08 14:17:59 -05:00
|
|
|
def get_dirman_password():
|
2008-04-29 13:12:00 -05:00
|
|
|
return installutils.read_password("Directory Manager (existing master)", confirm=False, validate=False)
|
0000-12-31 18:09:24 -05:50
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
def set_owner(config, dir):
|
2011-01-28 14:45:19 -06:00
|
|
|
pw = pwd.getpwnam(dsinstance.DS_USER)
|
0000-12-31 18:09:24 -05:50
|
|
|
os.chown(dir, pw.pw_uid, pw.pw_gid)
|
|
|
|
|
2010-12-07 17:23:05 -06:00
|
|
|
def install_replica_ds(config):
|
0000-12-31 18:09:24 -05:50
|
|
|
dsinstance.check_ports()
|
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
# if we have a pkcs12 file, create the cert db from
|
|
|
|
# that. Otherwise the ds setup will create the CA
|
|
|
|
# cert
|
|
|
|
pkcs12_info = None
|
2008-02-05 11:23:53 -06:00
|
|
|
if ipautil.file_exists(config.dir + "/dscert.p12"):
|
|
|
|
pkcs12_info = (config.dir + "/dscert.p12",
|
2008-07-11 10:34:29 -05:00
|
|
|
config.dir + "/dirsrv_pin.txt")
|
0000-12-31 18:09:24 -05:50
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
ds = dsinstance.DsInstance()
|
2011-01-28 14:45:19 -06:00
|
|
|
ds.create_replica(config.realm_name,
|
2010-12-07 17:23:05 -06:00
|
|
|
config.master_host_name, config.host_name,
|
|
|
|
config.domain_name, config.dirman_password,
|
2013-03-26 09:31:07 -05:00
|
|
|
pkcs12_info, ca_file = config.dir + "/ca.crt")
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2008-03-27 08:33:01 -05:00
|
|
|
return ds
|
|
|
|
|
2010-11-03 17:17:36 -05:00
|
|
|
def install_krb(config, setup_pkinit=False):
|
0000-12-31 18:09:24 -05:50
|
|
|
krb = krbinstance.KrbInstance()
|
2010-11-03 17:17:36 -05:00
|
|
|
|
|
|
|
#pkinit files
|
|
|
|
pkcs12_info = None
|
|
|
|
if ipautil.file_exists(config.dir + "/pkinitcert.p12"):
|
|
|
|
pkcs12_info = (config.dir + "/pkinitcert.p12",
|
|
|
|
config.dir + "/pkinit_pin.txt")
|
|
|
|
|
2011-01-28 14:45:19 -06:00
|
|
|
krb.create_replica(config.realm_name,
|
2011-01-11 09:27:48 -06:00
|
|
|
config.master_host_name, config.host_name,
|
2008-04-09 15:57:41 -05:00
|
|
|
config.domain_name, config.dirman_password,
|
2010-11-03 17:17:36 -05:00
|
|
|
setup_pkinit, pkcs12_info)
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2012-01-04 12:53:18 -06:00
|
|
|
return krb
|
|
|
|
|
2008-08-11 15:15:30 -05:00
|
|
|
def install_ca_cert(config):
|
2010-12-07 17:23:05 -06:00
|
|
|
cafile = config.dir + "/ca.crt"
|
|
|
|
if not ipautil.file_exists(cafile):
|
|
|
|
raise RuntimeError("Ca cert file is not available")
|
|
|
|
|
|
|
|
try:
|
|
|
|
shutil.copy(cafile, CACERT)
|
|
|
|
os.chmod(CACERT, 0444)
|
|
|
|
except Exception, e:
|
|
|
|
print "error copying files: " + str(e)
|
|
|
|
sys.exit(1)
|
2008-08-11 15:15:30 -05:00
|
|
|
|
2011-08-16 12:34:04 -05:00
|
|
|
def install_http(config, auto_redirect):
|
2008-02-05 11:23:53 -06:00
|
|
|
# if we have a pkcs12 file, create the cert db from
|
|
|
|
# that. Otherwise the ds setup will create the CA
|
|
|
|
# cert
|
|
|
|
pkcs12_info = None
|
|
|
|
if ipautil.file_exists(config.dir + "/httpcert.p12"):
|
|
|
|
pkcs12_info = (config.dir + "/httpcert.p12",
|
2008-07-11 10:34:29 -05:00
|
|
|
config.dir + "/http_pin.txt")
|
2008-02-05 11:23:53 -06:00
|
|
|
|
2012-02-16 11:02:36 -06:00
|
|
|
memcache = memcacheinstance.MemcacheInstance()
|
2012-04-18 10:22:35 -05:00
|
|
|
memcache.create_instance('MEMCACHE', config.host_name, config.dirman_password, ipautil.realm_to_suffix(config.realm_name))
|
2012-02-16 11:02:36 -06:00
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
http = httpinstance.HTTPInstance()
|
2013-03-26 09:31:07 -05:00
|
|
|
http.create_instance(
|
|
|
|
config.realm_name, config.host_name, config.domain_name,
|
|
|
|
config.dirman_password, False, pkcs12_info,
|
|
|
|
auto_redirect=auto_redirect, ca_file = config.dir + "/ca.crt")
|
2008-02-05 11:23:53 -06:00
|
|
|
|
|
|
|
# Now copy the autoconfiguration files
|
2008-07-25 15:56:42 -05:00
|
|
|
if ipautil.file_exists(config.dir + "/preferences.html"):
|
|
|
|
try:
|
|
|
|
shutil.copy(config.dir + "/preferences.html", "/usr/share/ipa/html/preferences.html")
|
|
|
|
shutil.copy(config.dir + "/configure.jar", "/usr/share/ipa/html/configure.jar")
|
2012-10-08 07:02:55 -05:00
|
|
|
if ipautil.file_exists(config.dir + "/krb.js"):
|
|
|
|
shutil.copy(
|
|
|
|
config.dir + "/krb.js", "/usr/share/ipa/html/krb.js")
|
|
|
|
shutil.copy(
|
|
|
|
config.dir + "/kerberosauth.xpi",
|
|
|
|
"/usr/share/ipa/html/kerberosauth.xpi")
|
2008-07-25 15:56:42 -05:00
|
|
|
except Exception, e:
|
|
|
|
print "error copying files: " + str(e)
|
|
|
|
sys.exit(1)
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2012-10-08 06:54:47 -05:00
|
|
|
http.setup_firefox_extension(config.realm_name, config.domain_name)
|
|
|
|
|
2012-01-04 12:53:18 -06:00
|
|
|
return http
|
|
|
|
|
2009-09-01 16:28:52 -05:00
|
|
|
def install_bind(config, options):
|
2012-09-04 02:47:43 -05:00
|
|
|
api.Backend.ldap2.connect(bind_dn=DIRMAN_DN,
|
2011-01-21 13:46:58 -06:00
|
|
|
bind_pw=config.dirman_password)
|
2009-09-01 16:28:52 -05:00
|
|
|
if options.forwarders:
|
|
|
|
forwarders = options.forwarders
|
|
|
|
else:
|
|
|
|
forwarders = ()
|
2009-06-26 12:37:49 -05:00
|
|
|
bind = bindinstance.BindInstance(dm_password=config.dirman_password)
|
2011-01-04 07:55:47 -06:00
|
|
|
|
2011-07-11 03:14:53 -05:00
|
|
|
if options.reverse_zone:
|
2012-01-20 01:30:40 -06:00
|
|
|
if not bindinstance.verify_reverse_zone(options.reverse_zone, config.ip):
|
2011-07-11 03:14:53 -05:00
|
|
|
sys.exit(1)
|
|
|
|
reverse_zone = bindinstance.normalize_zone(options.reverse_zone)
|
2011-05-11 15:49:43 -05:00
|
|
|
else:
|
2012-01-20 01:30:40 -06:00
|
|
|
reverse_zone = bindinstance.find_reverse_zone(config.ip)
|
2011-07-11 03:14:53 -05:00
|
|
|
if reverse_zone is None and not options.no_reverse:
|
2012-09-05 02:56:27 -05:00
|
|
|
reverse_zone = util.get_reverse_zone_default(config.ip)
|
2011-07-11 03:14:53 -05:00
|
|
|
if not options.unattended and bindinstance.create_reverse():
|
2012-01-20 01:30:40 -06:00
|
|
|
reverse_zone = bindinstance.read_reverse_zone(reverse_zone, config.ip)
|
2011-07-11 03:14:53 -05:00
|
|
|
|
|
|
|
if reverse_zone is not None:
|
|
|
|
print "Using reverse zone %s" % reverse_zone
|
|
|
|
|
2012-01-20 01:30:40 -06:00
|
|
|
bind.setup(config.host_name, config.ip_address, config.realm_name,
|
2012-11-19 09:32:28 -06:00
|
|
|
config.domain_name, forwarders, options.conf_ntp, reverse_zone,
|
|
|
|
ca_configured=options.setup_ca)
|
2009-06-26 12:37:49 -05:00
|
|
|
bind.create_instance()
|
|
|
|
|
2012-03-15 07:51:59 -05:00
|
|
|
print ""
|
|
|
|
bind.check_global_configuration()
|
|
|
|
print ""
|
|
|
|
|
2012-09-04 02:47:43 -05:00
|
|
|
|
|
|
|
@contextmanager
|
|
|
|
def temporary_ldap2_connection(host_name, bind_pw, bind_dn=DIRMAN_DN):
|
|
|
|
"""Context in which the ldap2 backend is connected to the given host
|
|
|
|
|
|
|
|
When the context is entered, forcefully change the ldap2's URI and connect
|
|
|
|
with the given password.
|
|
|
|
When it's exited, disconnect and restore ldap2 to previous configuration.
|
|
|
|
|
|
|
|
Needed to use the standard IPA tools on the remote master, before the
|
|
|
|
DS on localhost is installed.
|
|
|
|
"""
|
|
|
|
# TODO: We shouldn't have to resort to such hacks
|
|
|
|
cur_uri = api.Backend.ldap2.ldap_uri
|
|
|
|
# ldap2 is finalized at this point, so use __setattr__ directly
|
|
|
|
object.__setattr__(api.Backend.ldap2, 'ldap_uri',
|
|
|
|
'ldaps://%s' % ipautil.format_netloc(host_name))
|
|
|
|
api.Backend.ldap2.connect(bind_dn=DIRMAN_DN, bind_pw=bind_pw,
|
|
|
|
tls_cacertfile=CACERT)
|
|
|
|
yield
|
|
|
|
|
|
|
|
api.Backend.ldap2.disconnect()
|
|
|
|
#set it back to the default
|
|
|
|
object.__setattr__(api.Backend.ldap2, 'ldap_uri', cur_uri)
|
|
|
|
|
|
|
|
|
2011-01-21 13:46:58 -06:00
|
|
|
def install_dns_records(config, options):
|
|
|
|
|
2011-01-24 10:42:53 -06:00
|
|
|
if not bindinstance.dns_container_exists(config.master_host_name,
|
2012-04-18 10:22:35 -05:00
|
|
|
ipautil.realm_to_suffix(config.realm_name),
|
2011-10-06 01:37:17 -05:00
|
|
|
dm_password=config.dirman_password):
|
2011-01-21 13:46:58 -06:00
|
|
|
return
|
|
|
|
|
2011-01-24 10:42:53 -06:00
|
|
|
# We have to force to connect to the remote master because we do this step
|
|
|
|
# before our DS server is installed.
|
2012-09-04 02:47:43 -05:00
|
|
|
with temporary_ldap2_connection(
|
|
|
|
config.master_host_name, config.dirman_password):
|
2013-03-26 10:09:24 -05:00
|
|
|
try:
|
|
|
|
bind = bindinstance.BindInstance(dm_password=config.dirman_password)
|
|
|
|
reverse_zone = bindinstance.find_reverse_zone(config.ip)
|
|
|
|
|
|
|
|
bind.add_master_dns_records(config.host_name, config.ip_address,
|
|
|
|
config.realm_name, config.domain_name,
|
|
|
|
reverse_zone, options.conf_ntp,
|
|
|
|
options.setup_ca)
|
|
|
|
except errors.NotFound, e:
|
|
|
|
root_logger.debug('Replica DNS records could not be added '
|
|
|
|
'on master: %s', str(e))
|
|
|
|
|
|
|
|
# we should not fail here no matter what
|
|
|
|
except Exception, e:
|
|
|
|
root_logger.info('Replica DNS records could not be added '
|
|
|
|
'on master: %s', str(e))
|
2011-01-21 13:46:58 -06:00
|
|
|
|
2011-01-24 10:42:53 -06:00
|
|
|
|
2008-04-14 18:04:43 -05:00
|
|
|
def check_dirsrv():
|
|
|
|
(ds_unsecure, ds_secure) = dsinstance.check_ports()
|
|
|
|
if not ds_unsecure or not ds_secure:
|
|
|
|
print "IPA requires ports 389 and 636 for the Directory Server."
|
|
|
|
print "These are currently in use:"
|
|
|
|
if not ds_unsecure:
|
|
|
|
print "\t389"
|
|
|
|
if not ds_secure:
|
|
|
|
print "\t636"
|
|
|
|
sys.exit(1)
|
|
|
|
|
2009-06-26 12:37:49 -05:00
|
|
|
def check_bind():
|
2009-11-13 09:57:51 -06:00
|
|
|
if not bindinstance.check_inst(unattended=True):
|
|
|
|
print "Aborting installation"
|
2009-06-26 12:37:49 -05:00
|
|
|
sys.exit(1)
|
|
|
|
|
2012-09-04 02:47:43 -05:00
|
|
|
|
2012-10-19 11:22:33 -05:00
|
|
|
def check_dns_resolution(host_name, dns_servers):
|
|
|
|
"""Check forward and reverse resolution of host_name using dns_servers
|
2012-09-04 02:47:43 -05:00
|
|
|
"""
|
|
|
|
# Point the resolver at specified DNS server
|
2012-10-19 11:22:33 -05:00
|
|
|
server_ips = []
|
|
|
|
for dns_server in dns_servers:
|
|
|
|
try:
|
|
|
|
server_ips = list(
|
|
|
|
a[4][0] for a in socket.getaddrinfo(dns_server, None))
|
|
|
|
except socket.error:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
if not server_ips:
|
|
|
|
root_logger.error(
|
|
|
|
'Could not resolve any DNS server hostname: %s', dns_servers)
|
|
|
|
return False
|
2012-09-04 02:47:43 -05:00
|
|
|
resolver = dns.resolver.Resolver()
|
|
|
|
resolver.nameservers = server_ips
|
|
|
|
|
|
|
|
root_logger.debug('Search DNS server %s (%s) for %s',
|
|
|
|
dns_server, server_ips, host_name)
|
|
|
|
|
|
|
|
# Get IP addresses of host_name
|
|
|
|
addresses = set()
|
|
|
|
for rtype in 'A', 'AAAA':
|
|
|
|
try:
|
|
|
|
result = resolver.query(host_name, rtype)
|
|
|
|
except dns.exception.DNSException:
|
|
|
|
rrset = []
|
|
|
|
else:
|
|
|
|
rrset = result.rrset
|
|
|
|
if rrset:
|
|
|
|
addresses.update(r.address for r in result.rrset)
|
|
|
|
|
|
|
|
if not addresses:
|
|
|
|
root_logger.error(
|
|
|
|
'Could not resolve hostname %s using DNS. '
|
|
|
|
'Clients may not function properly. '
|
|
|
|
'Please check your DNS setup. '
|
|
|
|
'(Note that this check queries IPA DNS directly and '
|
|
|
|
'ignores /etc/hosts.)',
|
|
|
|
host_name)
|
|
|
|
return False
|
|
|
|
|
|
|
|
no_errors = True
|
|
|
|
|
|
|
|
# Check each of the IP addresses
|
|
|
|
checked = set()
|
|
|
|
for address in addresses:
|
|
|
|
if address in checked:
|
|
|
|
continue
|
|
|
|
checked.add(address)
|
|
|
|
try:
|
|
|
|
root_logger.debug('Check reverse address %s (%s)',
|
|
|
|
address, host_name)
|
|
|
|
revname = dns.reversename.from_address(address)
|
|
|
|
rrset = resolver.query(revname, 'PTR').rrset
|
|
|
|
except Exception, e:
|
|
|
|
root_logger.debug('Check failed: %s %s', type(e).__name__, e)
|
|
|
|
root_logger.error(
|
|
|
|
'Reverse DNS resolution of address %s (%s) failed. '
|
|
|
|
'Clients may not function properly. '
|
|
|
|
'Please check your DNS setup. '
|
|
|
|
'(Note that this check queries IPA DNS directly and '
|
|
|
|
'ignores /etc/hosts.)',
|
|
|
|
address, host_name)
|
|
|
|
no_errors = False
|
|
|
|
else:
|
|
|
|
host_name_obj = dns.name.from_text(host_name)
|
|
|
|
if rrset:
|
|
|
|
names = [r.target.to_text() for r in rrset]
|
|
|
|
else:
|
|
|
|
names = []
|
|
|
|
root_logger.debug(
|
|
|
|
'Address %s resolves to: %s. ', address, ', '.join(names))
|
|
|
|
if not rrset or not any(
|
|
|
|
r.target == host_name_obj for r in rrset):
|
|
|
|
root_logger.error(
|
|
|
|
'The IP address %s of host %s resolves to: %s. '
|
|
|
|
'Clients may not function properly. '
|
|
|
|
'Please check your DNS setup. '
|
|
|
|
'(Note that this check queries IPA DNS directly and '
|
|
|
|
'ignores /etc/hosts.)',
|
|
|
|
address, host_name, ', '.join(names))
|
|
|
|
no_errors = False
|
|
|
|
|
|
|
|
return no_errors
|
|
|
|
|
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
def main():
|
2012-05-31 06:59:33 -05:00
|
|
|
ipaservices.check_selinux_status()
|
2010-10-29 13:24:31 -05:00
|
|
|
safe_options, options, filename = parse_options()
|
2012-05-31 07:34:09 -05:00
|
|
|
|
|
|
|
if os.geteuid() != 0:
|
|
|
|
sys.exit("\nYou must be root to run this script.\n")
|
|
|
|
|
|
|
|
standard_logging_setup(log_file_name, debug=options.debug)
|
2011-11-15 13:39:31 -06:00
|
|
|
root_logger.debug('%s was invoked with argument "%s" and options: %s' % (sys.argv[0], filename, safe_options))
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2008-07-11 10:34:29 -05:00
|
|
|
if not ipautil.file_exists(filename):
|
|
|
|
sys.exit("Replica file %s does not exist" % filename)
|
|
|
|
|
2011-02-24 06:02:27 -06:00
|
|
|
client_fstore = sysrestore.FileStore('/var/lib/ipa-client/sysrestore')
|
|
|
|
if client_fstore.has_files():
|
2012-09-10 06:11:40 -05:00
|
|
|
sys.exit("IPA client is already configured on this system.\n" +
|
|
|
|
"Please uninstall it first before configuring the replica, " +
|
|
|
|
"using 'ipa-client-install --uninstall'.")
|
2011-02-24 06:02:27 -06:00
|
|
|
|
2011-01-28 14:45:19 -06:00
|
|
|
global sstore
|
|
|
|
sstore = sysrestore.StateFile('/var/lib/ipa/sysrestore')
|
|
|
|
|
2012-01-04 13:04:21 -06:00
|
|
|
global fstore
|
|
|
|
fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore')
|
|
|
|
|
2010-11-03 17:17:36 -05:00
|
|
|
# check the bind is installed
|
2009-06-26 12:37:49 -05:00
|
|
|
if options.setup_dns:
|
|
|
|
check_bind()
|
2010-11-03 17:17:36 -05:00
|
|
|
|
2008-04-14 18:04:43 -05:00
|
|
|
check_dirsrv()
|
|
|
|
|
2012-12-07 09:44:32 -06:00
|
|
|
if options.conf_ntp:
|
|
|
|
try:
|
|
|
|
ipaclient.ntpconf.check_timedate_services()
|
|
|
|
except ipaclient.ntpconf.NTPConflictingService, e:
|
|
|
|
print "WARNING: conflicting time&date synchronization service '%s'" \
|
|
|
|
" will" % e.conflicting_service
|
|
|
|
print "be disabled in favor of ntpd"
|
|
|
|
print ""
|
|
|
|
except ipaclient.ntpconf.NTPConfigurationError:
|
|
|
|
pass
|
|
|
|
|
2008-08-08 07:53:55 -05:00
|
|
|
# get the directory manager password
|
|
|
|
dirman_password = options.password
|
|
|
|
if not dirman_password:
|
|
|
|
try:
|
|
|
|
dirman_password = get_dirman_password()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
sys.exit(0)
|
2011-10-06 01:22:08 -05:00
|
|
|
if dirman_password is None:
|
|
|
|
sys.exit("\nDirectory Manager password required")
|
2008-08-08 07:53:55 -05:00
|
|
|
|
|
|
|
try:
|
2011-06-17 15:47:39 -05:00
|
|
|
top_dir, dir = expand_replica_info(filename, dirman_password)
|
2011-05-22 12:17:07 -05:00
|
|
|
global REPLICA_INFO_TOP_DIR
|
|
|
|
REPLICA_INFO_TOP_DIR = top_dir
|
2008-08-08 07:53:55 -05:00
|
|
|
except Exception, e:
|
|
|
|
print "ERROR: Failed to decrypt or open the replica file."
|
|
|
|
print "Verify you entered the correct Directory Manager password."
|
|
|
|
sys.exit(1)
|
2008-02-20 09:16:19 -06:00
|
|
|
|
0000-12-31 18:09:24 -05:50
|
|
|
config = ReplicaConfig()
|
2011-06-17 15:47:39 -05:00
|
|
|
read_replica_info(dir, config)
|
2012-08-29 10:32:03 -05:00
|
|
|
root_logger.debug('Installing replica file with version %d (0 means no version in prepared file).' % config.version)
|
|
|
|
if config.version and config.version > version.NUM_VERSION:
|
|
|
|
root_logger.error('A replica file from a newer release (%d) cannot be installed on an older version (%d)' % (config.version, version.NUM_VERSION))
|
|
|
|
sys.exit(1)
|
2008-08-08 07:53:55 -05:00
|
|
|
config.dirman_password = dirman_password
|
2011-06-17 15:47:39 -05:00
|
|
|
try:
|
|
|
|
host = get_host_name(options.no_host_dns)
|
2011-10-06 04:26:03 -05:00
|
|
|
except BadHostError, e:
|
2011-11-15 13:39:31 -06:00
|
|
|
root_logger.error(str(e))
|
2011-06-17 15:47:39 -05:00
|
|
|
sys.exit(1)
|
2008-08-08 07:53:55 -05:00
|
|
|
if config.host_name != host:
|
2008-02-19 09:46:22 -06:00
|
|
|
try:
|
2008-08-08 07:53:55 -05:00
|
|
|
print "This replica was created for '%s' but this machine is named '%s'" % (config.host_name, host)
|
2012-07-18 23:41:01 -05:00
|
|
|
if not ipautil.user_input("This may cause problems. Continue?", False):
|
2008-02-19 09:46:22 -06:00
|
|
|
sys.exit(0)
|
2008-08-08 07:53:55 -05:00
|
|
|
config.host_name = host
|
2008-07-21 05:25:37 -05:00
|
|
|
print ""
|
2008-02-19 09:46:22 -06:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
sys.exit(0)
|
0000-12-31 18:09:24 -05:50
|
|
|
config.dir = dir
|
2011-06-17 15:47:39 -05:00
|
|
|
config.setup_ca = options.setup_ca
|
0000-12-31 18:09:24 -05:50
|
|
|
|
2012-09-04 02:47:43 -05:00
|
|
|
installutils.verify_fqdn(config.master_host_name, options.no_host_dns)
|
2011-05-22 12:17:07 -05:00
|
|
|
|
2012-09-19 22:35:42 -05:00
|
|
|
portfile = config.dir + "/dogtag_directory_port.txt"
|
|
|
|
if not ipautil.file_exists(portfile):
|
|
|
|
dogtag_master_ds_port = str(dogtag.Dogtag9Constants.DS_PORT)
|
|
|
|
else:
|
|
|
|
with open(portfile) as fd:
|
|
|
|
dogtag_master_ds_port = fd.read()
|
|
|
|
|
2011-05-22 12:17:07 -05:00
|
|
|
# check connection
|
|
|
|
if not options.skip_conncheck:
|
2012-09-19 22:35:42 -05:00
|
|
|
replica_conn_check(
|
|
|
|
config.master_host_name, config.host_name, config.realm_name,
|
|
|
|
options.setup_ca, dogtag_master_ds_port, options.admin_password)
|
|
|
|
|
2011-05-22 12:17:07 -05:00
|
|
|
|
2012-01-04 13:04:21 -06:00
|
|
|
# check replica host IP resolution
|
2012-01-20 01:30:40 -06:00
|
|
|
config.ip = installutils.get_server_ip_address(config.host_name, fstore, True, options)
|
|
|
|
config.ip_address = str(config.ip)
|
2012-01-04 13:04:21 -06:00
|
|
|
|
2010-02-08 07:21:46 -06:00
|
|
|
# Create the management framework config file
|
|
|
|
# Note: We must do this before bootstraping and finalizing ipalib.api
|
2011-06-17 07:19:45 -05:00
|
|
|
old_umask = os.umask(022) # must be readable for httpd
|
|
|
|
try:
|
|
|
|
fd = open("/etc/ipa/default.conf", "w")
|
|
|
|
fd.write("[global]\n")
|
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
|
|
|
fd.write("host=%s\n" % config.host_name)
|
|
|
|
fd.write("basedn=%s\n" % str(ipautil.realm_to_suffix(config.realm_name)))
|
|
|
|
fd.write("realm=%s\n" % config.realm_name)
|
|
|
|
fd.write("domain=%s\n" % config.domain_name)
|
2011-09-30 03:09:55 -05:00
|
|
|
fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % ipautil.format_netloc(config.host_name))
|
2011-06-17 07:19:45 -05:00
|
|
|
fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" % dsinstance.realm_to_serverid(config.realm_name))
|
|
|
|
if ipautil.file_exists(config.dir + "/cacert.p12"):
|
|
|
|
fd.write("enable_ra=True\n")
|
|
|
|
fd.write("ra_plugin=dogtag\n")
|
2012-08-23 11:38:45 -05:00
|
|
|
fd.write("dogtag_version=%s\n" %
|
|
|
|
dogtag.install_constants.DOGTAG_VERSION)
|
2013-03-14 07:58:27 -05:00
|
|
|
else:
|
|
|
|
fd.write("enable_ra=False\n")
|
|
|
|
fd.write("ra_plugin=none\n")
|
2011-06-17 07:19:45 -05:00
|
|
|
fd.write("mode=production\n")
|
|
|
|
fd.close()
|
|
|
|
finally:
|
|
|
|
os.umask(old_umask)
|
2009-09-28 22:34:15 -05:00
|
|
|
|
2012-01-04 12:58:33 -06:00
|
|
|
api.bootstrap(in_server=True, context='installer')
|
2009-09-28 22:34:15 -05:00
|
|
|
api.finalize()
|
|
|
|
|
2011-01-28 14:45:19 -06:00
|
|
|
# Create DS group if it doesn't exist yet
|
|
|
|
try:
|
|
|
|
grp.getgrnam(dsinstance.DS_GROUP)
|
2011-11-15 13:39:31 -06:00
|
|
|
root_logger.debug("ds group %s exists" % dsinstance.DS_GROUP)
|
2011-01-28 14:45:19 -06:00
|
|
|
group_exists = True
|
|
|
|
except KeyError:
|
|
|
|
group_exists = False
|
|
|
|
args = ["/usr/sbin/groupadd", "-r", dsinstance.DS_GROUP]
|
|
|
|
try:
|
|
|
|
ipautil.run(args)
|
2011-11-15 13:39:31 -06:00
|
|
|
root_logger.debug("done adding DS group")
|
2011-01-28 14:45:19 -06:00
|
|
|
except ipautil.CalledProcessError, e:
|
2011-11-15 13:39:31 -06:00
|
|
|
root_logger.critical("failed to add DS group: %s" % e)
|
2011-01-28 14:45:19 -06:00
|
|
|
sstore.backup_state("install", "group_exists", group_exists)
|
|
|
|
|
2010-11-22 12:29:56 -06:00
|
|
|
#Automatically disable pkinit w/ dogtag until that is supported
|
2013-03-14 07:58:27 -05:00
|
|
|
options.setup_pkinit = False
|
2010-11-22 12:29:56 -06:00
|
|
|
|
2010-12-07 17:23:05 -06:00
|
|
|
# Install CA cert so that we can do SSL connections with ldap
|
|
|
|
install_ca_cert(config)
|
|
|
|
|
2011-09-30 03:09:55 -05:00
|
|
|
ldapuri = 'ldaps://%s' % ipautil.format_netloc(config.master_host_name)
|
2012-09-04 02:47:43 -05:00
|
|
|
replman = conn = None
|
2010-05-27 16:41:13 -05:00
|
|
|
try:
|
2012-09-04 02:47:43 -05:00
|
|
|
# Try out the password
|
2010-05-27 16:41:13 -05:00
|
|
|
conn = ldap2(shared_instance=False, ldap_uri=ldapuri, base_dn='')
|
2012-09-04 02:47:43 -05:00
|
|
|
conn.connect(bind_dn=DIRMAN_DN, bind_pw=config.dirman_password,
|
2010-12-07 17:23:05 -06:00
|
|
|
tls_cacertfile=CACERT)
|
2012-05-16 17:11:11 -05:00
|
|
|
replman = ReplicationManager(config.realm_name, config.master_host_name,
|
|
|
|
config.dirman_password)
|
|
|
|
found = False
|
2010-05-27 16:41:13 -05:00
|
|
|
try:
|
2013-01-31 04:19:13 -06:00
|
|
|
entry = conn.find_entries(u'fqdn=%s' % host, ['fqdn'], DN(api.env.container_host, api.env.basedn))
|
2012-05-16 17:11:11 -05:00
|
|
|
print "The host %s already exists on the master server.\nYou should remove it before proceeding:" % host
|
2010-05-27 16:41:13 -05:00
|
|
|
print " %% ipa host-del %s" % host
|
2012-05-16 17:11:11 -05:00
|
|
|
found = True
|
|
|
|
except errors.NotFound:
|
|
|
|
pass
|
2012-09-04 02:47:43 -05:00
|
|
|
|
|
|
|
# If remote host has DNS, check forward/reverse resolution
|
|
|
|
with temporary_ldap2_connection(
|
|
|
|
config.master_host_name, config.dirman_password):
|
|
|
|
dns_masters = api.Object['dnsrecord'].get_dns_masters()
|
|
|
|
if dns_masters:
|
|
|
|
if not options.no_host_dns:
|
2012-10-19 11:22:33 -05:00
|
|
|
master = config.master_host_name
|
2012-09-04 02:47:43 -05:00
|
|
|
root_logger.debug('Check forward/reverse DNS resolution')
|
2012-10-19 11:22:33 -05:00
|
|
|
resolution_ok = (
|
|
|
|
check_dns_resolution(master, dns_masters) and
|
|
|
|
check_dns_resolution(config.host_name, dns_masters))
|
2012-09-04 02:47:43 -05:00
|
|
|
if not resolution_ok and not options.unattended:
|
|
|
|
if not ipautil.user_input("Continue?", False):
|
|
|
|
sys.exit(0)
|
2012-10-19 11:22:33 -05:00
|
|
|
else:
|
|
|
|
root_logger.debug('No IPA DNS servers, '
|
|
|
|
'skipping forward/reverse resolution check')
|
2012-09-04 02:47:43 -05:00
|
|
|
|
|
|
|
# Check that we don't already have a replication agreement
|
2012-05-16 17:11:11 -05:00
|
|
|
try:
|
|
|
|
(agreement_cn, agreement_dn) = replman.agreement_dn(host)
|
|
|
|
entry = conn.get_entry(agreement_dn, ['*'])
|
|
|
|
print "A replication agreement for this host already exists. It needs to be removed. Run this on the master that generated the info file:"
|
|
|
|
print " %% ipa-replica-manage del %s --force" % host
|
|
|
|
found = True
|
2010-05-27 16:41:13 -05:00
|
|
|
except errors.NotFound:
|
|
|
|
pass
|
2012-05-16 17:11:11 -05:00
|
|
|
if found:
|
|
|
|
sys.exit(3)
|
2010-05-27 16:41:13 -05:00
|
|
|
except errors.ACIError:
|
|
|
|
sys.exit("\nThe password provided is incorrect for LDAP server %s" % config.master_host_name)
|
|
|
|
except errors.LDAPError:
|
|
|
|
sys.exit("\nUnable to connect to LDAP server %s" % config.master_host_name)
|
2012-05-16 17:11:11 -05:00
|
|
|
finally:
|
|
|
|
if conn and conn.isconnected():
|
|
|
|
conn.disconnect()
|
|
|
|
if replman and replman.conn:
|
2013-01-30 05:46:48 -06:00
|
|
|
replman.conn.unbind()
|
2010-05-27 16:41:13 -05:00
|
|
|
|
Fix schema replication from old masters
The new merged database will replicate with both the IPA and CA trees, so all
DS instances (IPA and CA on the existing master, and the merged one on the
replica) need to have the same schema.
Dogtag does all its schema modifications online. Those are replicated normally.
The basic IPA schema, however, is delivered in ldif files, which are not
replicated. The files are not present on old CA DS instances. Any schema
update that references objects in these files will fail.
The whole 99user.ldif (i.e. changes introduced dynamically over LDAP) is
replicated as a blob. If we updated the old master's CA schema dynamically
during replica install, it would conflict with updates done during the
installation: the one with the lower CSN would get lost.
Dogtag's spawn script recently grew a new flag, 'pki_clone_replicate_schema'.
Turning it off tells Dogtag to create its schema in the clone, where the IPA
modifications are taking place, so that it is not overwritten by the IPA schema
on replication.
The patch solves the problems by:
- In __spawn_instance, turning off the pki_clone_replicate_schema flag.
- Providing a script to copy the IPA schema files to the CA DS instance.
The script needs to be copied to old masters and run there.
- At replica CA install, checking if the schema is updated, and failing if not.
The --skip-schema-check option is added to ipa-{replica,ca}-install to
override the check.
All pre-3.1 CA servers in a domain will have to have the script run on them to
avoid schema replication errors.
https://fedorahosted.org/freeipa/ticket/3213
2012-10-24 03:37:16 -05:00
|
|
|
if options.skip_schema_check:
|
|
|
|
root_logger.info("Skipping CA DS schema check")
|
|
|
|
else:
|
|
|
|
cainstance.replica_ca_install_check(config, dogtag_master_ds_port)
|
|
|
|
|
2008-02-20 10:03:46 -06:00
|
|
|
# Configure ntpd
|
|
|
|
if options.conf_ntp:
|
2012-12-07 09:44:32 -06:00
|
|
|
ipaclient.ntpconf.force_ntpd(sstore)
|
2008-02-20 10:03:46 -06:00
|
|
|
ntp = ntpinstance.NTPInstance()
|
|
|
|
ntp.create_instance()
|
|
|
|
|
2012-09-19 22:35:42 -05:00
|
|
|
# Configure dirsrv
|
|
|
|
ds = install_replica_ds(config)
|
|
|
|
|
2009-07-10 15:18:16 -05:00
|
|
|
# Configure the CA if necessary
|
2012-11-15 08:38:24 -06:00
|
|
|
CA = cainstance.install_replica_ca(config, dogtag_master_ds_port)
|
2009-07-10 15:18:16 -05:00
|
|
|
|
2011-01-24 10:42:53 -06:00
|
|
|
# Always try to install DNS records
|
|
|
|
install_dns_records(config, options)
|
|
|
|
|
2011-03-14 15:27:19 -05:00
|
|
|
# We need to ldap_enable the CA now that DS is up and running
|
2011-06-17 15:47:39 -05:00
|
|
|
if CA and config.setup_ca:
|
2011-01-25 11:46:26 -06:00
|
|
|
CA.ldap_enable('CA', config.host_name, config.dirman_password,
|
2012-04-18 10:22:35 -05:00
|
|
|
ipautil.realm_to_suffix(config.realm_name))
|
2012-11-15 08:38:24 -06:00
|
|
|
CA.enable_client_auth_to_db()
|
|
|
|
CA.restart()
|
2011-03-09 23:06:15 -06:00
|
|
|
|
2012-01-04 12:53:18 -06:00
|
|
|
krb = install_krb(config, setup_pkinit=options.setup_pkinit)
|
|
|
|
http = install_http(config, auto_redirect=options.ui_redirect)
|
2009-07-10 15:18:16 -05:00
|
|
|
if CA:
|
2012-07-11 14:51:01 -05:00
|
|
|
CA.configure_certmonger_renewal()
|
2009-07-10 15:18:16 -05:00
|
|
|
CA.import_ra_cert(dir + "/ra.p12")
|
|
|
|
CA.fix_ra_perms()
|
2011-09-12 16:11:54 -05:00
|
|
|
ipaservices.knownservices.httpd.restart()
|
2008-02-20 09:16:19 -06:00
|
|
|
|
2009-12-07 22:17:00 -06:00
|
|
|
# The DS instance is created before the keytab, add the SSL cert we
|
|
|
|
# generated
|
|
|
|
ds.add_cert_to_service()
|
|
|
|
|
2008-12-01 14:33:15 -06:00
|
|
|
# Apply any LDAP updates. Needs to be done after the replica is synced-up
|
|
|
|
service.print_msg("Applying LDAP updates")
|
|
|
|
ds.apply_updates()
|
|
|
|
|
2012-01-04 12:53:18 -06:00
|
|
|
# Restart ds and krb after configurations have been changed
|
|
|
|
service.print_msg("Restarting the directory server")
|
|
|
|
ds.restart()
|
|
|
|
|
|
|
|
service.print_msg("Restarting the KDC")
|
|
|
|
krb.restart()
|
|
|
|
|
2012-03-06 06:26:45 -06:00
|
|
|
if options.setup_dns:
|
|
|
|
install_bind(config, options)
|
|
|
|
|
2012-01-04 12:53:18 -06:00
|
|
|
# Restart httpd to pick up the new IPA configuration
|
|
|
|
service.print_msg("Restarting the web server")
|
|
|
|
http.restart()
|
2008-02-20 09:16:19 -06:00
|
|
|
|
|
|
|
# Call client install script
|
|
|
|
try:
|
2011-12-07 02:40:51 -06:00
|
|
|
args = ["/usr/sbin/ipa-client-install", "--on-master", "--unattended", "--domain", config.domain_name, "--server", config.host_name, "--realm", config.realm_name]
|
|
|
|
if not options.create_sshfp:
|
|
|
|
args.append("--no-dns-sshfp")
|
2011-12-07 02:49:09 -06:00
|
|
|
if options.trust_sshfp:
|
|
|
|
args.append("--ssh-trust-dns")
|
2012-09-12 08:19:26 -05:00
|
|
|
if not options.conf_ssh:
|
|
|
|
args.append("--no-ssh")
|
2011-12-07 02:49:09 -06:00
|
|
|
if not options.conf_sshd:
|
|
|
|
args.append("--no-sshd")
|
2013-03-27 07:48:01 -05:00
|
|
|
if options.mkhomedir:
|
|
|
|
args.append("--mkhomedir")
|
2011-12-07 02:40:51 -06:00
|
|
|
ipautil.run(args)
|
2008-02-20 09:16:19 -06:00
|
|
|
except Exception, e:
|
|
|
|
print "Configuration of client side components failed!"
|
|
|
|
print "ipa-client-install returned: " + str(e)
|
|
|
|
raise RuntimeError("Failed to configure the client")
|
2008-03-27 08:33:01 -05:00
|
|
|
|
2011-01-21 13:32:55 -06:00
|
|
|
ds.replica_populate()
|
2008-03-27 08:33:01 -05:00
|
|
|
|
2011-04-26 03:39:29 -05:00
|
|
|
#Everything installed properly, activate ipa service.
|
2011-09-12 16:11:54 -05:00
|
|
|
ipaservices.knownservices.ipa.enable()
|
2011-04-26 03:39:29 -05:00
|
|
|
|
2012-05-31 07:34:09 -05:00
|
|
|
fail_message = '''
|
|
|
|
Your system may be partly configured.
|
|
|
|
Run /usr/sbin/ipa-server-install --uninstall to clean up.
|
|
|
|
'''
|
2008-02-05 11:23:53 -06:00
|
|
|
|
2012-05-31 07:34:09 -05:00
|
|
|
if __name__ == '__main__':
|
2011-05-22 12:17:07 -05:00
|
|
|
try:
|
2012-05-31 07:34:09 -05:00
|
|
|
installutils.run_script(main, log_file_name=log_file_name,
|
|
|
|
operation_name='ipa-replica-install',
|
|
|
|
fail_message=fail_message)
|
|
|
|
finally:
|
|
|
|
# always try to remove decrypted replica file
|
|
|
|
try:
|
|
|
|
if REPLICA_INFO_TOP_DIR:
|
|
|
|
shutil.rmtree(REPLICA_INFO_TOP_DIR)
|
|
|
|
except OSError:
|
|
|
|
pass
|