summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2007-09-24 15:44:26 -0400
committerSeth Vidal <skvidal@fedoraproject.org>2007-09-24 15:44:26 -0400
commit122714e5589843c5f283ad935b20345576d24ca6 (patch)
treef3b809bde47d268e3b771d5aa4aed84064ba300f
parent8454fe3216f935746fad17a8c48f4df0e40a0d0d (diff)
downloadfunc-122714e5589843c5f283ad935b20345576d24ca6.tar.gz
func-122714e5589843c5f283ad935b20345576d24ca6.tar.xz
func-122714e5589843c5f283ad935b20345576d24ca6.zip
add certmaster startup and execute script
move certmaster config file into etc path move certmaster.py into func path
-rw-r--r--etc/certmaster.conf (renamed from certs/certmaster.conf)0
-rwxr-xr-xfunc/certmaster.py (renamed from certs/certmaster.py)16
-rwxr-xr-xinit-scripts/certmaster82
-rwxr-xr-xscripts/certmaster12
4 files changed, 102 insertions, 8 deletions
diff --git a/certs/certmaster.conf b/etc/certmaster.conf
index 6e424d1..6e424d1 100644
--- a/certs/certmaster.conf
+++ b/etc/certmaster.conf
diff --git a/certs/certmaster.py b/func/certmaster.py
index 2fbfb57..02c8013 100755
--- a/certs/certmaster.py
+++ b/func/certmaster.py
@@ -159,13 +159,13 @@ class CertMaster(object):
return False, '', ''
+def serve(xmlrpcinstance):
+ """
+ Code for starting the XMLRPC service.
+ """
-
-cm = CertMaster('/etc/func/certmaster.conf')
-server = SimpleXMLRPCServer.SimpleXMLRPCServer((cm.cfg.listen_addr, int(cm.cfg.listen_port)))
-server.logRequests = 0
-server.register_instance(cm)
-server.serve_forever()
-
-
+ server =FuncXMLRPCServer((xmlrpcinstance.listen_addr, xmlrpcinstance.list_port))
+ server.logRequests = 0 # don't print stuff to console
+ server.register_instance(xmlrpcinstance)
+ server.serve_forever()
diff --git a/init-scripts/certmaster b/init-scripts/certmaster
new file mode 100755
index 0000000..71d5d8a
--- /dev/null
+++ b/init-scripts/certmaster
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# certmaster certmaster
+###################################
+
+# LSB header
+
+### BEGIN INIT INFO
+# Provides: certmaster
+# Required-Start: network
+# Default-Start: 3 4 5
+# Short-Description: certificate master for Fedora Unified Network Control 'master server only'
+# Description: certificate master to sign/manage ca/cert infrastructure for func
+### END INIT INFO
+
+# chkconfig header
+
+# chkconfig: 345 98 99
+# description: certificate master to sign/manage ca/cert infrastructure for func
+#
+# processname: /usr/bin/certmaster
+
+# Sanity checks.
+[ -x /usr/bin/certmaster ] || exit 0
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+SERVICE=certmaster
+PROCESS=certmaster
+CONFIG_ARGS=" "
+
+RETVAL=0
+
+start() {
+ echo -n $"Starting certmaster daemon: "
+ daemon --check $SERVICE $PROCESS --daemon $CONFIG_ARGS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping certmaster daemon: "
+ killproc $PROCESS
+ RETVAL=$?
+ echo
+ if [ $RETVAL -eq 0 ]; then
+ rm -f /var/lock/subsys/$SERVICE
+ rm -f /var/run/$SERVICE.pid
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+# See how we were called.
+case "$1" in
+ start|stop|restart)
+ $1
+ ;;
+ status)
+ status $PROCESS
+ RETVAL=$?
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/$SERVICE ] && restart || :
+ ;;
+ reload)
+ echo "can't reload configuration, you have to restart it"
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+ exit 1
+ ;;
+esac
+exit $RETVAL
+
diff --git a/scripts/certmaster b/scripts/certmaster
new file mode 100755
index 0000000..3b212b4
--- /dev/null
+++ b/scripts/certmaster
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import sys
+import distutils.sysconfig
+
+sys.path.append("%s/func" % distutils.sysconfig.get_python_lib())
+
+import certmaster
+
+cm = certmaster.CertMaster('/etc/func/certmaster.conf')
+server = certmaster.serve(cm)
+