Repository: cloudstack Updated Branches: refs/heads/master 3060f884a -> c46088c96
CLOUDSTACK-6290: [Windows] Generating SSL keys at the time of installation itself Signed-off-by: Abhinandan Prateek <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c46088c9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c46088c9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c46088c9 Branch: refs/heads/master Commit: c46088c962ea0bcc5273a84a60941384ee01478c Parents: 3060f88 Author: Damodar Reddy <[email protected]> Authored: Thu Mar 27 11:31:07 2014 +0530 Committer: Abhinandan Prateek <[email protected]> Committed: Thu Mar 27 16:03:04 2014 +0530 ---------------------------------------------------------------------- scripts/common/keys/ssl-keys.py | 47 ++++++++++++++++++++++++++++++++++ scripts/installer/windows/acs.wxs | 26 +++++++++---------- 2 files changed, 59 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c46088c9/scripts/common/keys/ssl-keys.py ---------------------------------------------------------------------- diff --git a/scripts/common/keys/ssl-keys.py b/scripts/common/keys/ssl-keys.py new file mode 100644 index 0000000..4ef50b0 --- /dev/null +++ b/scripts/common/keys/ssl-keys.py @@ -0,0 +1,47 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# Copies keys that enable SSH communication with system vms +# $1 = new public key +# $2 = new private key +''' +All imports go here... +''' +from subprocess import call +import socket +import sys +import os + +def generateSSLKey(outputPath): + hostName = socket.gethostbyname(socket.gethostname()) + keyFile = outputPath + os.sep + "cloud.keystore" + print("HostName = %s" % hostName) + print("OutputPath = %s" % keyFile) + dname='cn="Cloudstack User",ou="' + hostName + '",o="' + hostName + '",c="Unknown"'; + print("dname = %s" % dname) + return_code = call(["keytool", "-genkey", "-keystore", keyFile, "-storepass", "vmops.com", "-keypass", "vmops.com", "-keyalg", "RSA", "-validity", "3650", "-dname", dname]) + print("SSL key generated is : %s" % return_code) + +argsSize=len(sys.argv) +if argsSize != 2: + print("Usage: ssl-keys.py <SSL File Key Path>") + sys.exit(None) +sslKeyPath=sys.argv[1] + +generateSSLKey(sslKeyPath) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c46088c9/scripts/installer/windows/acs.wxs ---------------------------------------------------------------------- diff --git a/scripts/installer/windows/acs.wxs b/scripts/installer/windows/acs.wxs index adb2b6c..9456a5a 100644 --- a/scripts/installer/windows/acs.wxs +++ b/scripts/installer/windows/acs.wxs @@ -131,13 +131,6 @@ <File Id="db.properties" Source="client\WEB-INF\classes\db.properties" Checksum="no"> <CopyFile Id="dbproperties" DestinationName="db.properties" - DestinationDirectory="LIB"/> - </File> - <File Id="cloudmanagementserver.keystore" - Source="client\WEB-INF\classes\cloudmanagementserver.keystore" - Checksum="no"> - <CopyFile Id="cloudmanagementserverkeystore" - DestinationName="cloud.keystore" DestinationDirectory="LIB" /> </File> </Component> @@ -149,7 +142,7 @@ </Component> </Directory> </DirectoryRef> - <DirectoryRef Id="INSTALLDIR"> + <DirectoryRef Id="INSTALLDIR"> <Directory Id="LIB" Name="lib"> <Component Id="libFolder" Guid="d338841e-2ea4-48b3-ab48-9c42e2961600"> <CreateFolder /> @@ -189,24 +182,29 @@ <CustomAction Id="TomcatPath" Property="TOMCATDIRECTORY1" Value="[TOMCATDIRECTORY]\bin\Tomcat6.exe"> </CustomAction> - + <Condition Message="Apache tomcat6 is not installed please do install tomcat6 first"><![CDATA[(Installed OR TOMCATDIRECTORY)]]></Condition> <CustomAction Id="UpdateTomcatCatalinaBase" ExeCommand='//US//Tomcat6 --JvmOptions=-Dcatalina.base=[INSTALLDIR];-Djava.io.tmpdir=[INSTALLDIR]\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Dcatalina.home="[TOMCATDIRECTORY]";-Xms512m;-Xmx1024m;-XX:MaxPermSize=512m' Property="TOMCATDIRECTORY1" Execute="commit" Return="check" /> - <CustomAction Id="UpdateTomcatClassPath" + <CustomAction Id="UpdateTomcatClassPath" ExeCommand='//US//Tomcat6 --Classpath="[TOMCATDIRECTORY]\bin\bootstrap.jar";"[TOMCATDIRECTORY]\bin\tomcat-juli.jar";[INSTALLDIR]\conf' - Property="TOMCATDIRECTORY1" Execute="commit" Return="check" /> + Property="TOMCATDIRECTORY1" Execute="commit" Return="check" /> <CustomAction Id="DeleteFiles" Directory='INSTALLDIR' ExeCommand="[SystemFolder]cmd.exe /c del [INSTALLDIR]\webapps\client\WEB-INF\classes\db.properties [INSTALLDIR]\webapps\client\WEB-INF\classes\log4j*.xml" Execute="commit" Return="check" /> + <CustomAction Id="GeneralSSLKey" Directory='INSTALLDIR' + ExeCommand="python [INSTALLDIR]\webapps\client\WEB-INF\classes\scripts\common\keys\ssl-keys.py [INSTALLDIR]\lib" + Execute="commit" Return="check" /> + <InstallExecuteSequence> <InstallServices Sequence="4999"></InstallServices> <Custom Action="TomcatPath" Before="UpdateTomcatClassPath">NOT Installed</Custom> - <Custom Action="UpdateTomcatClassPath" Before="UpdateTomcatCatalinaBase">NOT Installed</Custom> + <Custom Action="UpdateTomcatClassPath" Before="UpdateTomcatCatalinaBase">NOT Installed</Custom> <Custom Action="UpdateTomcatCatalinaBase" Before="InstallFinalize">NOT Installed</Custom> - <Custom Action="DeleteFiles" Before="InstallFinalize">NOT Installed</Custom> + <Custom Action="DeleteFiles" Before="GeneralSSLKey">NOT Installed</Custom> + <Custom Action="GeneralSSLKey" Before="InstallFinalize">NOT Installed</Custom> </InstallExecuteSequence> <UIRef Id="WixUI_Mondo" /> <Feature Id='Complete' Title='ACS' Description='The complete package.' @@ -228,4 +226,4 @@ </Feature> <UIRef Id="WixUI_ErrorProgressText" /> </Product> -</Wix> +</Wix> \ No newline at end of file
