summaryrefslogtreecommitdiffstats
path: root/install
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:07:11 -0400
commit24cc8d4f334c8b61bac09371b5f9f8919395d172 (patch)
treeeab7b84df0c9bd0cde187e5f0210f16110a1da77 /install
parent6b07af64926cb65695eff22b0c167eafcdf00ec4 (diff)
downloadfreeipa.git-24cc8d4f334c8b61bac09371b5f9f8919395d172.tar.gz
freeipa.git-24cc8d4f334c8b61bac09371b5f9f8919395d172.tar.xz
freeipa.git-24cc8d4f334c8b61bac09371b5f9f8919395d172.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 'install')
-rw-r--r--install/Makefile.am1
-rw-r--r--install/configure.ac1
-rw-r--r--install/restart_scripts/Makefile.am15
-rw-r--r--install/restart_scripts/README2
-rw-r--r--install/restart_scripts/restart_dirsrv13
-rw-r--r--install/restart_scripts/restart_httpd7
6 files changed, 39 insertions, 0 deletions
diff --git a/install/Makefile.am b/install/Makefile.am
index 1b0cda90..4d24d072 100644
--- a/install/Makefile.am
+++ b/install/Makefile.am
@@ -13,6 +13,7 @@ SUBDIRS = \
tools \
updates \
po \
+ restart_scripts \
$(NULL)
install-exec-local:
diff --git a/install/configure.ac b/install/configure.ac
index bb1ec502..827ddbab 100644
--- a/install/configure.ac
+++ b/install/configure.ac
@@ -81,6 +81,7 @@ AC_CONFIG_FILES([
tools/man/Makefile
updates/Makefile
po/Makefile
+ restart_scripts/Makefile
])
AC_OUTPUT
diff --git a/install/restart_scripts/Makefile.am b/install/restart_scripts/Makefile.am
new file mode 100644
index 00000000..abc066b3
--- /dev/null
+++ b/install/restart_scripts/Makefile.am
@@ -0,0 +1,15 @@
+NULL =
+
+appdir = $(libdir)/ipa/certmonger
+app_DATA = \
+ restart_dirsrv \
+ restart_httpd \
+ $(NULL)
+
+EXTRA_DIST = \
+ $(app_DATA) \
+ $(NULL)
+
+MAINTAINERCLEANFILES = \
+ *~ \
+ Makefile.in
diff --git a/install/restart_scripts/README b/install/restart_scripts/README
new file mode 100644
index 00000000..64ad8b43
--- /dev/null
+++ b/install/restart_scripts/README
@@ -0,0 +1,2 @@
+This directory contains scripts to be used by the command (-C) option
+of certmonger to restart services when the certificates are renewed.
diff --git a/install/restart_scripts/restart_dirsrv b/install/restart_scripts/restart_dirsrv
new file mode 100644
index 00000000..e243583f
--- /dev/null
+++ b/install/restart_scripts/restart_dirsrv
@@ -0,0 +1,13 @@
+#!/usr/bin/python -E
+import sys
+from ipapython import services as ipaservices
+
+try:
+ instance = sys.argv[1]
+except IndexError:
+ instance = ""
+
+try:
+ ipaservices.knownservices.dirsrv.restart(instance)
+except Exception, e:
+ print "Cannot restart dirsrv (instance: '%s'): %s" % (instance, str(e))
diff --git a/install/restart_scripts/restart_httpd b/install/restart_scripts/restart_httpd
new file mode 100644
index 00000000..a53ab6e6
--- /dev/null
+++ b/install/restart_scripts/restart_httpd
@@ -0,0 +1,7 @@
+#!/usr/bin/python -E
+from ipapython import services as ipaservices
+
+try:
+ ipaservices.knownservices.httpd.restart()
+except Exception, e:
+ print "Cannot restart httpd: %s" % str(e)