summaryrefslogtreecommitdiffstats
path: root/ipa-client/ipa-install/ipa-client-install
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-08-31 17:21:25 -0400
committerRob Crittenden <rcritten@redhat.com>2010-09-09 16:38:52 -0400
commitf87bd57c1d3a86ade7419ea17ddee65bacda4b7f (patch)
tree89c99bbb28e2c1965a5f58190065a2f45ae87dbf /ipa-client/ipa-install/ipa-client-install
parent2e8bae590eae495628ffb709540f7e83eee52ba2 (diff)
downloadfreeipa-f87bd57c1d3a86ade7419ea17ddee65bacda4b7f.tar.gz
freeipa-f87bd57c1d3a86ade7419ea17ddee65bacda4b7f.tar.xz
freeipa-f87bd57c1d3a86ade7419ea17ddee65bacda4b7f.zip
Fix certmonger errors when doing a client or server uninstall.
This started with the client uninstaller returning a 1 when not installed. There was no way to tell whether the uninstall failed or the client simply wasn't installed which caused no end of grief with the installer. This led to a lot of certmonger failures too, either trying to stop tracking a non-existent cert or not handling an existing tracked certificate. I moved the certmonger code out of the installer and put it into the client/server shared ipapython lib. It now tries a lot harder and smarter to untrack a certificate. ticket 142
Diffstat (limited to 'ipa-client/ipa-install/ipa-client-install')
-rwxr-xr-xipa-client/ipa-install/ipa-client-install19
1 files changed, 13 insertions, 6 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index e0abfd67a..d8ce5c930 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -34,6 +34,7 @@ try:
from ipapython.ipautil import run, user_input, CalledProcessError, file_exists
from ipapython import sysrestore
from ipapython import version
+ from ipapython import certmonger
import SSSDConfig
from ConfigParser import RawConfigParser
except ImportError:
@@ -174,7 +175,7 @@ def uninstall(options):
if not fstore.has_files() and not options.force:
print "IPA client is not configured on this system."
- return 1
+ return 2
# Remove our host cert and CA cert
if nickname_exists("IPA CA"):
@@ -183,19 +184,25 @@ def uninstall(options):
except Exception, e:
print "Failed to remove IPA CA from /etc/pki/nssdb: %s" % str(e)
if nickname_exists("Server-Cert"):
+ # Always start certmonger. We can't untrack something if it isn't
+ # running
+ try:
+ service('certmonger', 'start')
+ except:
+ pass
+ try:
+ certmonger.stop_tracking('/etc/pki/nssdb', nickname='Server-Cert')
+ except (CalledProcessError, RuntimeError), e:
+ logging.error("certmonger failed to stop tracking certificate: %s" % str(e))
try:
run(["/usr/bin/certutil", "-D", "-d", "/etc/pki/nssdb", "-n", "Server-Cert"])
except Exception, e:
print "Failed to remove Server-Cert from /etc/pki/nssdb: %s" % str(e)
- try:
- run(["/usr/bin/ipa-getcert", "stop-tracking", "-d", "/etc/pki/nssdb", "-n", "Server-Cert"])
- except Exception, e:
- print "Failed to stop tracking Server-Cert in certmonger: %s" % str(e)
try:
service('certmonger', 'stop')
except:
- print "Failed to stop the certmonger daemon"
+ pass
try:
chkconfig('certmonger', 'off')