From ccec8c6c4193a204428b7ba0f93dac6f0eb26020 Mon Sep 17 00:00:00 2001 From: amitkuma Date: Tue, 30 Jan 2018 17:44:01 +0530 Subject: [PATCH] clear sssd cache when uninstalling client The SSSD cache is not cleared when uninstalling an IPA client. For tidiness we should wipe the cache. This can be done with sssctl. Note that this tool is in sssd-tools which is not currently a dependency. Resolves: https://pagure.io/freeipa/issue/7376 Reviewed-By: Christian Heimes --- freeipa.spec.in | 1 + ipaclient/install/client.py | 8 ++++++++ ipaplatform/base/paths.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/freeipa.spec.in b/freeipa.spec.in index b287d28ff..5b2f88ab4 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -149,6 +149,7 @@ BuildRequires: nss-devel BuildRequires: openssl-devel BuildRequires: libini_config-devel BuildRequires: cyrus-sasl-devel +BuildRequires: sssd-tools %if ! %{ONLY_CLIENT} # 1.3.3.9: DS_Sleep (https://fedorahosted.org/389/ticket/48005) BuildRequires: 389-ds-base-devel >= 1.3.3.9 diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index ea9aab507..8731afd69 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -3140,6 +3140,14 @@ def uninstall(options): remove_file(paths.SSSD_MC_GROUP) remove_file(paths.SSSD_MC_PASSWD) + try: + run([paths.SSSCTL, "cache-remove", "-o", "--stop", "--start"]) + except Exception: + logger.info( + "An error occurred while removing SSSD's cache." + "Please remove the cache manually by executing " + "sssctl cache-remove -o.") + if ipa_domain: sssd_domain_ldb = "cache_" + ipa_domain + ".ldb" sssd_ldb_file = os.path.join(paths.SSSD_DB, sssd_domain_ldb) diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py index 2689c162b..342355346 100644 --- a/ipaplatform/base/paths.py +++ b/ipaplatform/base/paths.py @@ -378,6 +378,6 @@ class BasePathNamespace(object): KEYCTL = '/usr/bin/keyctl' GETENT = '/usr/bin/getent' SSHD = '/usr/sbin/sshd' - + SSSCTL = '/usr/sbin/sssctl' paths = BasePathNamespace()