|
|
95ea96 |
From d169b6fc759a7586c6b3372db7e81c7862b2f96e Mon Sep 17 00:00:00 2001
|
|
|
95ea96 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
95ea96 |
Date: Wed, 5 Sep 2018 17:36:16 +0200
|
|
|
95ea96 |
Subject: [PATCH] ipa-replica-install: properly use the file store
|
|
|
95ea96 |
|
|
|
95ea96 |
In ipa-replica-install, many components use their own instance
|
|
|
95ea96 |
of the FileStore to backup configuration files to the pre-install
|
|
|
95ea96 |
state. This causes issues when the calls are mixed, like for
|
|
|
95ea96 |
instance:
|
|
|
95ea96 |
ds.do_task1_that_backups_file (using ds.filestore)
|
|
|
95ea96 |
http.do_task2_that_backups_file (using http.filestore)
|
|
|
95ea96 |
ds.do_task3_that_backups_file (using ds.filestore)
|
|
|
95ea96 |
|
|
|
95ea96 |
because the list of files managed by ds.filestore does not include
|
|
|
95ea96 |
the files managed by http.filestore, and the 3rd call would remove
|
|
|
95ea96 |
any file added on 2nd call.
|
|
|
95ea96 |
|
|
|
95ea96 |
The symptom of this bug is that ipa-replica-install does not save
|
|
|
95ea96 |
/etc/httpd/conf.d/ssl.conf and subsequent uninstallation does not
|
|
|
95ea96 |
restore the file, leading to a line referring to ipa-rewrite.conf
|
|
|
95ea96 |
that prevents httpd startup.
|
|
|
95ea96 |
|
|
|
95ea96 |
The installer should consistently use the same filestore.
|
|
|
95ea96 |
|
|
|
95ea96 |
Fixes https://pagure.io/freeipa/issue/7684
|
|
|
95ea96 |
|
|
|
95ea96 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
95ea96 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
95ea96 |
---
|
|
|
95ea96 |
ipaserver/install/server/replicainstall.py | 31 +++++++++++++---------
|
|
|
95ea96 |
1 file changed, 18 insertions(+), 13 deletions(-)
|
|
|
95ea96 |
|
|
|
95ea96 |
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
|
|
|
95ea96 |
index 396d6089449225cc83aa28552a2009b9057e65ab..525a62c474c7429b7efee4853eb71e487e656bba 100644
|
|
|
95ea96 |
--- a/ipaserver/install/server/replicainstall.py
|
|
|
95ea96 |
+++ b/ipaserver/install/server/replicainstall.py
|
|
|
95ea96 |
@@ -79,7 +79,7 @@ def make_pkcs12_info(directory, cert_name, password_name):
|
|
|
95ea96 |
|
|
|
95ea96 |
|
|
|
95ea96 |
def install_replica_ds(config, options, ca_is_configured, remote_api,
|
|
|
95ea96 |
- ca_file, promote=False, pkcs12_info=None):
|
|
|
95ea96 |
+ ca_file, promote=False, pkcs12_info=None, fstore=None):
|
|
|
95ea96 |
dsinstance.check_ports()
|
|
|
95ea96 |
|
|
|
95ea96 |
# if we have a pkcs12 file, create the cert db from
|
|
|
95ea96 |
@@ -95,7 +95,8 @@ def install_replica_ds(config, options, ca_is_configured, remote_api,
|
|
|
95ea96 |
ca_subject = installutils.default_ca_subject_dn(config.subject_base)
|
|
|
95ea96 |
|
|
|
95ea96 |
ds = dsinstance.DsInstance(
|
|
|
95ea96 |
- config_ldif=options.dirsrv_config_file)
|
|
|
95ea96 |
+ config_ldif=options.dirsrv_config_file,
|
|
|
95ea96 |
+ fstore=fstore)
|
|
|
95ea96 |
ds.create_replica(
|
|
|
95ea96 |
realm_name=config.realm_name,
|
|
|
95ea96 |
master_fqdn=config.master_host_name,
|
|
|
95ea96 |
@@ -115,8 +116,9 @@ def install_replica_ds(config, options, ca_is_configured, remote_api,
|
|
|
95ea96 |
return ds
|
|
|
95ea96 |
|
|
|
95ea96 |
|
|
|
95ea96 |
-def install_krb(config, setup_pkinit=False, pkcs12_info=None, promote=False):
|
|
|
95ea96 |
- krb = krbinstance.KrbInstance()
|
|
|
95ea96 |
+def install_krb(config, setup_pkinit=False, pkcs12_info=None, promote=False,
|
|
|
95ea96 |
+ fstore=None):
|
|
|
95ea96 |
+ krb = krbinstance.KrbInstance(fstore=fstore)
|
|
|
95ea96 |
|
|
|
95ea96 |
# pkinit files
|
|
|
95ea96 |
if pkcs12_info is None:
|
|
|
95ea96 |
@@ -153,7 +155,8 @@ def install_ca_cert(ldap, base_dn, realm, cafile, destfile=paths.IPA_CA_CRT):
|
|
|
95ea96 |
|
|
|
95ea96 |
def install_http(config, auto_redirect, ca_is_configured, ca_file,
|
|
|
95ea96 |
promote=False,
|
|
|
95ea96 |
- pkcs12_info=None):
|
|
|
95ea96 |
+ pkcs12_info=None,
|
|
|
95ea96 |
+ fstore=None):
|
|
|
95ea96 |
# if we have a pkcs12 file, create the cert db from
|
|
|
95ea96 |
# that. Otherwise the ds setup will create the CA
|
|
|
95ea96 |
# cert
|
|
|
95ea96 |
@@ -161,8 +164,7 @@ def install_http(config, auto_redirect, ca_is_configured, ca_file,
|
|
|
95ea96 |
pkcs12_info = make_pkcs12_info(config.dir, "httpcert.p12",
|
|
|
95ea96 |
"http_pin.txt")
|
|
|
95ea96 |
|
|
|
95ea96 |
-
|
|
|
95ea96 |
- http = httpinstance.HTTPInstance()
|
|
|
95ea96 |
+ http = httpinstance.HTTPInstance(fstore=fstore)
|
|
|
95ea96 |
http.create_instance(
|
|
|
95ea96 |
config.realm_name, config.host_name, config.domain_name,
|
|
|
95ea96 |
config.dirman_password, pkcs12_info,
|
|
|
95ea96 |
@@ -173,14 +175,14 @@ def install_http(config, auto_redirect, ca_is_configured, ca_file,
|
|
|
95ea96 |
return http
|
|
|
95ea96 |
|
|
|
95ea96 |
|
|
|
95ea96 |
-def install_dns_records(config, options, remote_api):
|
|
|
95ea96 |
+def install_dns_records(config, options, remote_api, fstore=None):
|
|
|
95ea96 |
|
|
|
95ea96 |
if not bindinstance.dns_container_exists(
|
|
|
95ea96 |
ipautil.realm_to_suffix(config.realm_name)):
|
|
|
95ea96 |
return
|
|
|
95ea96 |
|
|
|
95ea96 |
try:
|
|
|
95ea96 |
- bind = bindinstance.BindInstance(api=remote_api)
|
|
|
95ea96 |
+ bind = bindinstance.BindInstance(api=remote_api, fstore=fstore)
|
|
|
95ea96 |
for ip in config.ips:
|
|
|
95ea96 |
reverse_zone = bindinstance.find_reverse_zone(ip, remote_api)
|
|
|
95ea96 |
|
|
|
95ea96 |
@@ -1425,10 +1427,11 @@ def install(installer):
|
|
|
95ea96 |
remote_api,
|
|
|
95ea96 |
ca_file=cafile,
|
|
|
95ea96 |
promote=promote,
|
|
|
95ea96 |
- pkcs12_info=dirsrv_pkcs12_info)
|
|
|
95ea96 |
+ pkcs12_info=dirsrv_pkcs12_info,
|
|
|
95ea96 |
+ fstore=fstore)
|
|
|
95ea96 |
|
|
|
95ea96 |
# Always try to install DNS records
|
|
|
95ea96 |
- install_dns_records(config, options, remote_api)
|
|
|
95ea96 |
+ install_dns_records(config, options, remote_api, fstore=fstore)
|
|
|
95ea96 |
|
|
|
95ea96 |
ntpinstance.ntp_ldap_enable(config.host_name, ds.suffix,
|
|
|
95ea96 |
remote_api.env.realm)
|
|
|
95ea96 |
@@ -1449,7 +1452,8 @@ def install(installer):
|
|
|
95ea96 |
config,
|
|
|
95ea96 |
setup_pkinit=not options.no_pkinit,
|
|
|
95ea96 |
pkcs12_info=pkinit_pkcs12_info,
|
|
|
95ea96 |
- promote=promote)
|
|
|
95ea96 |
+ promote=promote,
|
|
|
95ea96 |
+ fstore=fstore)
|
|
|
95ea96 |
|
|
|
95ea96 |
if promote:
|
|
|
95ea96 |
# We need to point to the master when certmonger asks for
|
|
|
95ea96 |
@@ -1479,7 +1483,8 @@ def install(installer):
|
|
|
95ea96 |
promote=promote,
|
|
|
95ea96 |
pkcs12_info=http_pkcs12_info,
|
|
|
95ea96 |
ca_is_configured=ca_enabled,
|
|
|
95ea96 |
- ca_file=cafile)
|
|
|
95ea96 |
+ ca_file=cafile,
|
|
|
95ea96 |
+ fstore=fstore)
|
|
|
95ea96 |
|
|
|
95ea96 |
if promote:
|
|
|
95ea96 |
# Need to point back to ourself after the cert for HTTP is obtained
|
|
|
95ea96 |
--
|
|
|
95ea96 |
2.17.1
|
|
|
95ea96 |
|