[Cluster-devel] conga luci/init.d/luci ricci/init.d/ricci
kupcevic at sourceware.org
kupcevic at sourceware.org
Wed Aug 16 02:57:53 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-08-16 02:57:53
Modified files:
luci/init.d : luci
ricci/init.d : ricci
Log message:
Generate SSL keys in init scripts
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/luci.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/init.d/ricci.diff?cvsroot=cluster&r1=1.7&r2=1.8
--- conga/luci/init.d/luci 2006/07/17 20:56:46 1.6
+++ conga/luci/init.d/luci 2006/08/16 02:57:52 1.7
@@ -62,6 +62,7 @@
generate_https_certs()
{
+ rm -f $HTTPS_PRIVKEY $HTTPS_PUBKEY
echo -n "generating https SSL certificates... "
/usr/bin/openssl genrsa -out $HTTPS_PRIVKEY 2048 > /dev/null 2>&1
/usr/bin/openssl req -new -x509 -key $HTTPS_PRIVKEY -out $HTTPS_PUBKEY -days 1095 -config /var/lib/luci/var/certs/cacert.config
@@ -213,7 +214,7 @@
;;
*)
- echo $"Usage: $0 {start|stop|reload|restart|status}"
+ echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
rtrn=1
;;
--- conga/ricci/init.d/ricci 2006/07/05 19:20:14 1.7
+++ conga/ricci/init.d/ricci 2006/08/16 02:57:52 1.8
@@ -26,6 +26,9 @@
LOCKFILE="/var/lock/subsys/ricci"
RUNASUSER="ricci"
+SSL_PUBKEY="/var/lib/ricci/certs/cacert.pem"
+SSL_PRIVKEY="/var/lib/ricci/certs/privkey.pem"
+
#
# Only root wants to run this...
#
@@ -37,6 +40,33 @@
[ "${NETWORKING}" = "yes" ] || exit 0
+
+
+ssl_certs_ok()
+{
+ if [ ! -e $SSL_PRIVKEY ] ; then
+ return 1
+ fi
+ if [ ! -e $SSL_PUBKEY ] ; then
+ return 2
+ fi
+ return 0
+}
+
+generate_ssl_certs()
+{
+ rm -f $SSL_PUBKEY $SSL_PRIVKEY
+ echo -n "generating SSL certificates... "
+ /usr/bin/openssl genrsa -out $SSL_PRIVKEY 2048 > /dev/null 2>&1
+ /usr/bin/openssl req -new -x509 -key $SSL_PRIVKEY -out $SSL_PUBKEY -days 1095 -config /var/lib/ricci/certs/cacert.config
+ /bin/chown $RUNASUSER:$RUNASUSER $SSL_PRIVKEY $SSL_PUBKEY
+ /bin/chmod 644 $SSL_PUBKEY
+ /bin/chmod 600 $SSL_PRIVKEY
+ echo "done"
+ return $?
+}
+
+
case $1 in
start)
service messagebus status > /dev/null 2>&1
@@ -60,6 +90,11 @@
fi
fi
+ ssl_certs_ok
+ if [ "1$?" != "10" ] ; then
+ generate_ssl_certs
+ fi
+
NewUID=`cat /etc/passwd | grep "^$RUNASUSER:" | sed -e 's/^[^:]*:[^:]*://' -e 's/:.*//'`
echo -n $"Starting $ID: "
daemon $RICCID -u $NewUID
@@ -112,7 +147,7 @@
;;
*)
- echo $"Usage: $0 {start|stop|reload|restart|status}"
+ echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
rtrn=1
;;
More information about the Cluster-devel
mailing list