openwsman/openwsman-initscript.patch
2010-08-10 10:19:08 -05:00

113 lines
3.2 KiB
Diff

diff -up ./etc/init/openwsmand.sh.in.old ./etc/init/openwsmand.sh.in
--- ./etc/init/openwsmand.sh.in.old 2010-08-04 16:43:40.212100948 -0500
+++ ./etc/init/openwsmand.sh.in 2010-08-04 17:26:20.013849220 -0500
@@ -4,15 +4,15 @@
# Provides: openwsmand
# Required-Start: $remote_fs
# Required-Stop: $network
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
+# Default-Start:
+# Default-Stop:
# Short-Description: Openwsman Daemon
# Description: openwsmand
# Start/Stop the Openwsman Daemon
### END INIT INFO
#
#
-# chkconfig: 2345 36 64
+# chkconfig: - 36 64
# description: Openwsman Daemon
# processname: openwsmand
@@ -56,20 +56,16 @@ start()
echo "Using common server certificate /etc/ssl/servercerts/servercert.pem"
ln -s /etc/ssl/servercerts/server{cert,key}.pem @SYSCONFDIR@
else
- echo "Generating Openwsman server public certificate and private key"
- FQDN=`hostname --fqdn`
- if [ "x${FQDN}" = "x" ]; then
- FQDN=localhost.localdomain
- fi
-cat << EOF | sh @SYSCONFDIR@/owsmangencert.sh > /dev/null 2>&1
---
-SomeState
-SomeCity
-SomeOrganization
-SomeOrganizationalUnit
-${FQDN}
-root@${FQDN}
-EOF
+ echo "FAILED: Starting openwsman server"
+ echo "There is no ssl server key available for openwsman server to use."
+ echo -e "Please generate one with the following script and start the openwsman service again:\n"
+ echo "##################################"
+ echo "/etc/openwsman/owsmangencert.sh"
+ echo "================================="
+
+ echo "NOTE: The script uses /dev/random device for generating some random bits while generating the server key."
+ echo -e " If this takes too long, you can replace the value of \"RANDFILE\" in @SYSCONFDIR@/ssleay.cnf with /dev/urandom.\n Please understand the implications of doing do."
+
fi
fi
@@ -145,6 +141,10 @@ case "$1" in
fi
;;
+ condrestart)
+ [ -e $lockfile ] && restart
+ ;;
+
*)
echo "Usage: $0 {restart|start|stop|reload|force-reload|status}"
esac
diff -up ./etc/owsmangencert.sh.in.old ./etc/owsmangencert.sh.in
--- ./etc/owsmangencert.sh.in.old 2010-08-04 17:14:31.241100874 -0500
+++ ./etc/owsmangencert.sh.in 2010-08-04 17:21:02.944850958 -0500
@@ -1,7 +1,5 @@
#!/bin/sh
-#!/bin/sh -e
-
CERTFILE=@SYSCONFDIR@/servercert.pem
KEYFILE=@SYSCONFDIR@/serverkey.pem
CNFFILE=@SYSCONFDIR@/ssleay.cnf
@@ -15,19 +13,33 @@ if [ "$1" = "--force" ]; then
shift
fi
+FQDN=`hostname --fqdn`
+ if [ "x${FQDN}" = "x" ]; then
+ FQDN=localhost.localdomain
+ fi
echo
echo creating selfsingned certificate
echo "replace it with one signed by a certification authority (CA)"
echo
-echo enter your ServerName at the Common Name prompt
+#echo enter your ServerName at the Common Name prompt
echo
# use special .cnf, because with normal one no valid selfsigned
# certificate is created
-export RANDFILE=/dev/random
-openssl req -days 365 $@ -config $CNFFILE \
+#export RANDFILE=/dev/random
+cat <<EOF |openssl req -days 365 $@ -config $CNFFILE \
-new -x509 -nodes -out $CERTFILE \
-keyout $KEYFILE
+--
+SomeState
+SomeCity
+SomeOrganization
+SomeOrganizationalUnit
+${FQDN}
+root@${FQDN}
+EOF
+
+
chmod 600 $KEYFILE