From a86ff68e4fe8241a5683f441da5a0eb513e454c1 Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Apr 25 2018 11:40:59 +0000 Subject: Issue 49538 - replace cacertdir_rehash with openssl rehash Bug description: Enable TLS method fails on newer Fedora systems. It complains that cacertdir_rehash tool is not found. Fix description: The reason is that authconfig was replaced with authselect package. Authconfig shipped a tool called cacertdir_rehash which is no longer available on Fedora. We need to switch to openssl tool: 'c_rehash ' that serves the same purpose and is present on both RHEL7 and Fedora. Remove authconfig from 389-ds-base.spec.in because 'cacertdir_rehash' was the only reason why we had the dependency. Add openssl-perl dependency to the SPEC file. Eventially, c_rehash will go away but for now we keep it for RHEL7 compatibility. Fix a small thing in remove_ds_instance function. We should ignore FileNotFound errors while removing the instance. https://pagure.io/389-ds-base/issue/49538 Reviewed by: mreynolds, mhonek (Thanks!) --- diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in index 28c8136..0e6bbc5 100644 --- a/rpm/389-ds-base.spec.in +++ b/rpm/389-ds-base.spec.in @@ -267,9 +267,9 @@ BuildArch: noarch Group: Development/Libraries Requires: krb5-workstation Requires: openssl +# This is for /usr/bin/c_rehash tool +Requires: openssl-perl Requires: iproute -# This is for /usr/sbin/cacertdir_rehash -Requires: authconfig Requires: python%{python3_pkgversion} Requires: python%{python3_pkgversion}-pytest Requires: python%{python3_pkgversion}-pyldap diff --git a/src/lib389/lib389/instance/remove.py b/src/lib389/lib389/instance/remove.py index 440ff7b..25d56a3 100644 --- a/src/lib389/lib389/instance/remove.py +++ b/src/lib389/lib389/instance/remove.py @@ -51,7 +51,10 @@ def remove_ds_instance(dirsrv): shutil.rmtree(config_dir_rm) _log.debug("Copying %s to %s" % (config_dir, config_dir_rm)) - shutil.copytree(config_dir, config_dir_rm) + try: + shutil.copytree(config_dir, config_dir_rm) + except FileNotFoundError: + pass # Remove these paths: # for path in ('backup_dir', 'cert_dir', 'config_dir', 'db_dir', diff --git a/src/lib389/lib389/nss_ssl.py b/src/lib389/lib389/nss_ssl.py index f8f2f2f..7c78d49 100644 --- a/src/lib389/lib389/nss_ssl.py +++ b/src/lib389/lib389/nss_ssl.py @@ -201,7 +201,7 @@ class NssSsl(object): certdetails = check_output(cmd, stderr=subprocess.STDOUT) with open('%s/ca.crt' % self._certdb, 'w') as f: f.write(ensure_str(certdetails)) - check_output(['/usr/sbin/cacertdir_rehash', self._certdb], stderr=subprocess.STDOUT) + check_output(['/usr/bin/c_rehash', self._certdb], stderr=subprocess.STDOUT) return True def _rsa_cert_list(self): @@ -423,7 +423,7 @@ class NssSsl(object): to our database. """ shutil.copyfile(ca, '%s/ca.crt' % self._certdb) - check_output(['/usr/sbin/cacertdir_rehash', self._certdb], stderr=subprocess.STDOUT) + check_output(['/usr/bin/c_rehash', self._certdb], stderr=subprocess.STDOUT) check_output([ '/usr/bin/certutil', '-A',