mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6290: [Windows] Generating SSL keys at the time of installation itself
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
parent
3060f884ab
commit
c46088c962
47
scripts/common/keys/ssl-keys.py
Normal file
47
scripts/common/keys/ssl-keys.py
Normal file
@ -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)
|
||||||
@ -131,13 +131,6 @@
|
|||||||
<File Id="db.properties" Source="client\WEB-INF\classes\db.properties"
|
<File Id="db.properties" Source="client\WEB-INF\classes\db.properties"
|
||||||
Checksum="no">
|
Checksum="no">
|
||||||
<CopyFile Id="dbproperties" DestinationName="db.properties"
|
<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" />
|
DestinationDirectory="LIB" />
|
||||||
</File>
|
</File>
|
||||||
</Component>
|
</Component>
|
||||||
@ -149,7 +142,7 @@
|
|||||||
</Component>
|
</Component>
|
||||||
</Directory>
|
</Directory>
|
||||||
</DirectoryRef>
|
</DirectoryRef>
|
||||||
<DirectoryRef Id="INSTALLDIR">
|
<DirectoryRef Id="INSTALLDIR">
|
||||||
<Directory Id="LIB" Name="lib">
|
<Directory Id="LIB" Name="lib">
|
||||||
<Component Id="libFolder" Guid="d338841e-2ea4-48b3-ab48-9c42e2961600">
|
<Component Id="libFolder" Guid="d338841e-2ea4-48b3-ab48-9c42e2961600">
|
||||||
<CreateFolder />
|
<CreateFolder />
|
||||||
@ -189,24 +182,29 @@
|
|||||||
<CustomAction Id="TomcatPath" Property="TOMCATDIRECTORY1"
|
<CustomAction Id="TomcatPath" Property="TOMCATDIRECTORY1"
|
||||||
Value="[TOMCATDIRECTORY]\bin\Tomcat6.exe">
|
Value="[TOMCATDIRECTORY]\bin\Tomcat6.exe">
|
||||||
</CustomAction>
|
</CustomAction>
|
||||||
|
|
||||||
<Condition
|
<Condition
|
||||||
Message="Apache tomcat6 is not installed please do install tomcat6 first"><![CDATA[(Installed OR TOMCATDIRECTORY)]]></Condition>
|
Message="Apache tomcat6 is not installed please do install tomcat6 first"><![CDATA[(Installed OR TOMCATDIRECTORY)]]></Condition>
|
||||||
<CustomAction Id="UpdateTomcatCatalinaBase"
|
<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'
|
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" />
|
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'
|
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'
|
<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"
|
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" />
|
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>
|
<InstallExecuteSequence>
|
||||||
<InstallServices Sequence="4999"></InstallServices>
|
<InstallServices Sequence="4999"></InstallServices>
|
||||||
<Custom Action="TomcatPath" Before="UpdateTomcatClassPath">NOT Installed</Custom>
|
<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="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>
|
</InstallExecuteSequence>
|
||||||
<UIRef Id="WixUI_Mondo" />
|
<UIRef Id="WixUI_Mondo" />
|
||||||
<Feature Id='Complete' Title='ACS' Description='The complete package.'
|
<Feature Id='Complete' Title='ACS' Description='The complete package.'
|
||||||
@ -228,4 +226,4 @@
|
|||||||
</Feature>
|
</Feature>
|
||||||
<UIRef Id="WixUI_ErrorProgressText" />
|
<UIRef Id="WixUI_ErrorProgressText" />
|
||||||
</Product>
|
</Product>
|
||||||
</Wix>
|
</Wix>
|
||||||
Loading…
x
Reference in New Issue
Block a user