summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/certs.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-04-10 21:21:08 +0200
committerRob Crittenden <rcritten@redhat.com>2012-04-10 01:08:41 -0400
commit717bbcd2bf624ad68ea1cdf08216ab4f06e8bc4d (patch)
treec322f49a4d11e13bd69ee1f7db69b377f62c93c4 /ipaserver/install/certs.py
parente9b79cc1e111bbdc91675f8a2f48a92baa4266c9 (diff)
downloadfreeipa-717bbcd2bf624ad68ea1cdf08216ab4f06e8bc4d.tar.gz
freeipa-717bbcd2bf624ad68ea1cdf08216ab4f06e8bc4d.tar.xz
freeipa-717bbcd2bf624ad68ea1cdf08216ab4f06e8bc4d.zip
Configure certmonger to execute restart scripts on renewal.
certmonger now has the ability to execute a script when it renews a certificate. This can be used to automatically restart servers so the certificate doesn't expire in the running server. https://fedorahosted.org/freeipa/ticket/2050
Diffstat (limited to 'ipaserver/install/certs.py')
-rw-r--r--ipaserver/install/certs.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index 13770811e..d25a471ea 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -18,6 +18,7 @@
#
import os, stat, subprocess, re
+import sys
import errno
import tempfile
import shutil
@@ -492,16 +493,25 @@ class CertDB(object):
raise RuntimeError("Unable to find serial number")
- def track_server_cert(self, nickname, principal, password_file=None):
+ def track_server_cert(self, nickname, principal, password_file=None, command=None):
"""
Tell certmonger to track the given certificate nickname.
+
+ If command is not a full path then it is prefixed with
+ /usr/lib[64]/ipa/certmonger.
"""
+ if command is not None and not os.path.isabs(command):
+ if sys.maxsize > 2**32:
+ libpath = 'lib64'
+ else:
+ libpath = 'lib'
+ command = '/usr/%s/ipa/certmonger/%s' % (libpath, command)
cmonger = ipaservices.knownservices.certmonger
cmonger.enable()
ipaservices.knownservices.messagebus.start()
cmonger.start()
try:
- (stdout, stderr, rc) = certmonger.start_tracking(nickname, self.secdir, password_file)
+ (stdout, stderr, rc) = certmonger.start_tracking(nickname, self.secdir, password_file, command)
except (ipautil.CalledProcessError, RuntimeError), e:
root_logger.error("certmonger failed starting to track certificate: %s" % str(e))
return