@ -12,47 +12,45 @@ echo ">>> Step 1: Change current IP address of the IoT server"
echo ""
echo ""
echo "Please enter the IoT Core IP that you need to replace (if you are trying out IoT server for the first time this will be localhost)"
echo "Please enter the IoT Core IP that you need to replace (if you are trying out IoT server for the first time this will be localhost)"
read val1;
read -r val1;
while [ [ -z $val1 ] ] ; do #if $val1 is a zero length String
while [ [ -z $val1 ] ] ; do #if $val1 is a zero length String
echo "Please enter the IoT Core IP that you need to replace (if you are trying out IoT server for the first time this will be localhost)"
echo "Please enter the IoT Core IP that you need to replace (if you are trying out IoT server for the first time this will be localhost)"
read val1;
read -r val1;
done
done
echo ""
echo ""
echo "Please enter your current IP"
echo "Please enter your current IP"
read val2;
read -r val2;
while [ [ -z $val2 ] ] ; do #if $val2 is a zero length String
while [ [ -z $val2 ] ] ; do #if $val2 is a zero length String
echo "Please enter your current IP"
echo "Please enter your current IP"
read val2;
read -r val2;
done
done
echo "--------------------------------------"
echo "--------------------------------------"
echo "All your " + $val1 + " IP's are replaced with " +$val2 ;
echo "All your " + " $val1 " + " IP's are replaced with " + " $val2 " ;
echo "--------------------------------------"
echo "--------------------------------------"
replaceText = 's/localhost/' $val1 '/g'
echo "Changing <IoT_HOME>/conf/carbon.xml"
echo "Changing <IoT_HOME>/conf/carbon.xml"
sed -i '' -e 's#\(<HostName>\)' $val1 '\(</HostName>\)#\1' $val2 '\2#g' ../conf/carbon.xml
sed -i -e 's#\(<HostName>\)' " $val1 " '\(</HostName>\)#\1' " $val2 " '\2#g' ../conf/carbon.xml
sed -i '' -e 's#\(<MgtHostName>\)' $val1 '\(</MgtHostName>\)#\1' $val2 '\2#g' ../conf/carbon.xml
sed -i -e 's#\(<MgtHostName>\)' " $val1 " '\(</MgtHostName>\)#\1' " $val2 " '\2#g' ../conf/carbon.xml
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/conf/identity/sso-idp-config.xml"
echo "Changing <IoT_HOME>/conf/identity/sso-idp-config.xml"
sed -i '' -e 's/' $val1 '/' $val2 '/g' ../conf/identity/sso-idp-config.xml
sed -i -e 's/' " $val1 " '/' " $val2 " '/g' ../conf/identity/sso-idp-config.xml
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/conf/iot-api-config.xml"
echo "Changing <IoT_HOME>/conf/iot-api-config.xml"
sed -i '' -e 's/' $val1 '/' $val2 '/g' ../conf/iot-api-config.xml
sed -i -e 's/' " $val1 " '/' " $val2 " '/g' ../conf/iot-api-config.xml
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/repository/deployment/server/jaggeryapps/devicemgt/app/conf/app-conf.json"
echo "Changing <IoT_HOME>/repository/deployment/server/jaggeryapps/devicemgt/app/conf/app-conf.json"
sed -i -e 's/"identityProvider.*/\"identityProviderUrl\"\ :\ "https\:\/\/' $val2 ':9443\/samlsso\"\,/' ../repository/deployment/server/jaggeryapps/devicemgt/app/conf/app-conf.json
sed -i -e 's/"identityProvider.*/\"identityProviderUrl\"\ :\ "https\:\/\/' " $val2 " ':9443\/samlsso\"\,/' ../repository/deployment/server/jaggeryapps/devicemgt/app/conf/app-conf.json
sed -i -e 's/"acs.*/\"acs\"\ :\ "https\:\/\/' $val2 ':9443\/devicemgt\/uuf\/sso\/acs\"\,/' ../repository/deployment/server/jaggeryapps/devicemgt/app/conf/app-conf.json
sed -i -e 's/"acs.*/\"acs\"\ :\ "https\:\/\/' " $val2 " ':9443\/devicemgt\/uuf\/sso\/acs\"\,/' ../repository/deployment/server/jaggeryapps/devicemgt/app/conf/app-conf.json
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
@ -62,7 +60,7 @@ echo "Completed!!"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/repository/deployment/server/jaggeryapps/api-store/site/conf/site.json"
echo "Changing <IoT_HOME>/repository/deployment/server/jaggeryapps/api-store/site/conf/site.json"
sed -i -e 's/"identityProvider.*/\"identityProviderURL\"\ :\ "https\:\/\/' $val2 ':9443\/samlsso\"\,/' ../repository/deployment/server/jaggeryapps/api-store/site/conf/site.json
sed -i -e 's/"identityProvider.*/\"identityProviderURL\"\ :\ "https\:\/\/' " $val2 " ':9443\/samlsso\"\,/' ../repository/deployment/server/jaggeryapps/api-store/site/conf/site.json
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
@ -73,79 +71,79 @@ echo 'found'
sed -i -e 's|<!-- Server URL of the API key manager -->||' ../conf/api-manager.xml
sed -i -e 's|<!-- Server URL of the API key manager -->||' ../conf/api-manager.xml
fi
fi
if grep -q ' <ServerURL>https:\/\/\${carbon.local.ip}:\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>' ../conf/api-manager.xml;
if grep -q " <ServerURL>https:\/\/\${carbon.local.ip}:\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>" ../conf/api-manager.xml;
then
then
echo 'found'
echo 'found'
sed -i -e ' s/<ServerURL>https:\/\/\${carbon.local.ip}:\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>//' ../conf/api-manager.xml
sed -i -e " s/<ServerURL>https:\/\/\${carbon.local.ip}:\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>//" ../conf/api-manager.xml
fi
fi
if grep -q '<ServerURL>https:\/\/' $val2 ':\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>' ../conf/api-manager.xml;
if grep -q " <ServerURL>https:\/\/ $val2 :\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL> " ../conf/api-manager.xml;
then
then
echo 'found'
echo 'found'
sed -i -e 's/<ServerURL>https:\/\/' $val2 ':\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>//' ../conf/api-manager.xml
sed -i -e " s/<ServerURL>https:\/\/ $val2 :\${mgt.transport.https.port}\${carbon.context}services\/<\/ServerURL>// " ../conf/api-manager.xml
fi
fi
sed -i '' -e 's/<APIKeyValidator>/<APIKeyValidator><!-- Server URL of the API key manager --><ServerURL>https:\/\/' $val2 '\:\$\{mgt\.transport\.https\.port\}\$\{carbon\.context\}services\/<\/ServerURL>/g' ../conf/api-manager.xml
sed -i -e 's/<APIKeyValidator>/<APIKeyValidator><!-- Server URL of the API key manager --><ServerURL>https:\/\/' " $val2 " '\:\$\{mgt\.transport\.https\.port\}\$\{carbon\.context\}services\/<\/ServerURL>/g' ../conf/api-manager.xml
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
if grep -q '<RevokeAPIURL>https:\/\/localhost:\${https.nio.port}\/revoke<\/RevokeAPIURL>' ../conf/api-manager.xml;
if grep -q "<RevokeAPIURL>https:\/\/localhost:\${https.nio.port}\/revoke<\/RevokeAPIURL>" ../conf/api-manager.xml;
then
then
sed -i -e ' s|<RevokeAPIURL>https:\/\/localhost:\${https.nio.port}\/revoke<\/RevokeAPIURL>|<RevokeAPIURL>https:\/\/'$val2 ':\${https.nio.port}\/revoke<\/RevokeAPIURL>|' ../conf/api-manager.xml
sed -i -e " s|<RevokeAPIURL>https:\/\/localhost:\${https.nio.port}\/revoke<\/RevokeAPIURL>|<RevokeAPIURL>https:\/\/$val2 :\${https.nio.port}\/revoke<\/RevokeAPIURL>| " ../conf/api-manager.xml
fi
fi
if grep -q '<RevokeAPIURL>https:\/\/' $val1 ':\${https.nio.port}\/revoke<\/RevokeAPIURL>' ../conf/api-manager.xml;
if grep -q " <RevokeAPIURL>https:\/\/ $val1 :\${https.nio.port}\/revoke<\/RevokeAPIURL> " ../conf/api-manager.xml;
then
then
sed -i -e 's|<RevokeAPIURL>https:\/\/' $val1 ':\${https.nio.port}\/revoke<\/RevokeAPIURL>|<RevokeAPIURL>https:\/\/' $val2 ':\${https.nio.port}\/revoke<\/RevokeAPIURL>|' ../conf/api-manager.xml
sed -i -e " s|<RevokeAPIURL>https:\/\/ $val1 :\${https.nio.port}\/revoke<\/RevokeAPIURL>|<RevokeAPIURL>https:\/\/ $val2 :\${https.nio.port}\/revoke<\/RevokeAPIURL>| " ../conf/api-manager.xml
fi
fi
#--------------------
#--------------------
echo "Changing <IoT_HOME>/conf/etc/webapp-publisher-config.xml"
echo "Changing <IoT_HOME>/conf/etc/webapp-publisher-config.xml"
sed -i '' -e 's#\(<EnabledUpdateApi>\)false\(</EnabledUpdateApi>\)#\1' true'\2#g' ../conf/etc/webapp-publisher-config.xml
sed -i -e 's#\(<EnabledUpdateApi>\)false\(</EnabledUpdateApi>\)#\1' " true" '\2#g' ../conf/etc/webapp-publisher-config.xml
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/bin/iot-server.sh"
echo "Changing <IoT_HOME>/bin/iot-server.sh"
sed -i -e 's/-Diot.manager.host.*/-Diot.manager.host="' $val2 '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.manager.host.*/-Diot.manager.host="' " $val2 " '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.core.host.*/-Diot.core.host="' $val2 '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.core.host.*/-Diot.core.host="' " $val2 " '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.keymanager.host.*/-Diot.keymanager.host="' $val2 '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.keymanager.host.*/-Diot.keymanager.host="' " $val2 " '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.gateway.host.*/-Diot.gateway.host="' $val2 '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.gateway.host.*/-Diot.gateway.host="' " $val2 " '" \\/' ../bin/iot-server.sh
echo "Completed!!"
echo "Completed!!"
#----------------------
#----------------------
echo ""
echo ""
echo "Changing hostURL of <IoT_HOME>/wso2/broker/conf/broker.xml"
echo "Changing hostURL of <IoT_HOME>/wso2/broker/conf/broker.xml"
if grep -q '<property name="hostURL">https://' $val1 ':9443/services/OAuth2TokenValidationService</property>' ../wso2/broker/conf/broker.xml;
if grep -q '<property name="hostURL">https://' " $val1 " ':9443/services/OAuth2TokenValidationService</property>' ../wso2/broker/conf/broker.xml;
then
then
echo "found"
echo "found"
sed -i -e 's|<property name="hostURL">https:\/\/' $val1 ':9443\/services\/OAuth2TokenValidationService</\property>|<property name="hostURL">https:\/\/' $val2 ':9443\/services\/OAuth2TokenValidationService</\property>|' ../wso2/broker/conf/broker.xml
sed -i -e 's|<property name="hostURL">https:\/\/' " $val1 " ':9443\/services\/OAuth2TokenValidationService</\property>|<property name="hostURL">https:\/\/' " $val2 " ':9443\/services\/OAuth2TokenValidationService</\property>|' ../wso2/broker/conf/broker.xml
echo "Completed!!"
echo "Completed!!"
fi
fi
#------------------------
#------------------------
echo ""
echo ""
echo "Changing tokenEndpoint of <IoT_HOME>/wso2/broker/conf/broker.xml"
echo "Changing tokenEndpoint of <IoT_HOME>/wso2/broker/conf/broker.xml"
if grep -q '<property name="tokenEndpoint">https:\/\/' $val1 ':8243</\property>' ../wso2/broker/conf/broker.xml;
if grep -q '<property name="tokenEndpoint">https:\/\/' " $val1 " ':8243</\property>' ../wso2/broker/conf/broker.xml;
then
then
echo "found"
echo "found"
sed -i -e 's|<property name="tokenEndpoint">https:\/\/' $val1 ':8243</\property>|<property name="tokenEndpoint">https:\/\/' $val2 ':8243</\property>|' ../wso2/broker/conf/broker.xml
sed -i -e 's|<property name="tokenEndpoint">https:\/\/' " $val1 " ':8243</\property>|<property name="tokenEndpoint">https:\/\/' " $val2 " ':8243</\property>|' ../wso2/broker/conf/broker.xml
echo "Completed!!"
echo "Completed!!"
fi
fi
#--------------------------
#--------------------------
echo ""
echo ""
echo "Changing deviceMgtServerUrl of <IoT_HOME>/wso2/broker/conf/broker.xml"
echo "Changing deviceMgtServerUrl of <IoT_HOME>/wso2/broker/conf/broker.xml"
if grep -q '<property name="deviceMgtServerUrl">https:\/\/' $val1 ':8243</\property>' ../wso2/broker/conf/broker.xml;
if grep -q '<property name="deviceMgtServerUrl">https:\/\/' " $val1 " ':8243</\property>' ../wso2/broker/conf/broker.xml;
then
then
echo "found"
echo "found"
sed -i -e 's|<property name="deviceMgtServerUrl">https:\/\/' $val1 ':8243</\property>|<property name="deviceMgtServerUrl">https:\/\/' $val2 ':8243</\property>|' ../wso2/broker/conf/broker.xml
sed -i -e 's|<property name="deviceMgtServerUrl">https:\/\/' " $val1 " ':8243</\property>|<property name="deviceMgtServerUrl">https:\/\/' " $val2 " ':8243</\property>|' ../wso2/broker/conf/broker.xml
echo "Completed!!"
echo "Completed!!"
fi
fi
#--------------------
#--------------------
echo "Changing <IoT_HOME>/wso2/analytics/bin/wso2server.sh"
echo "Changing <IoT_HOME>/wso2/analytics/bin/wso2server.sh"
sed -i -e 's/-Diot.keymanager.host.*/-Diot.keymanager.host="' $val2 '" \\/' ../wso2/analytics/bin/wso2server.sh
sed -i -e 's/-Diot.keymanager.host.*/-Diot.keymanager.host="' " $val2 " '" \\/' ../wso2/analytics/bin/wso2server.sh
sed -i -e 's/-Diot.gateway.host.*/-Diot.gateway.host="' $val2 '" \\/' ../wso2/analytics/bin/wso2server.sh
sed -i -e 's/-Diot.gateway.host.*/-Diot.gateway.host="' " $val2 " '" \\/' ../wso2/analytics/bin/wso2server.sh
echo "Completed!!"
echo "Completed!!"
##################################### IP configs related to broker ####################################
##################################### IP configs related to broker ####################################
@ -156,17 +154,17 @@ echo "-------------------------------------------------------"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/wso2/analytics/bin/wso2server.sh"
echo "Changing <IoT_HOME>/wso2/analytics/bin/wso2server.sh"
sed -i -e 's/-Dmqtt.broker.host.*/-Dmqtt.broker.host="' $val2 '" \\/' ../wso2/analytics/bin/wso2server.sh
sed -i -e 's/-Dmqtt.broker.host.*/-Dmqtt.broker.host="' " $val2 " '" \\/' ../wso2/analytics/bin/wso2server.sh
echo "Completed!!"
echo "Completed!!"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/bin/iot-server.sh"
echo "Changing <IoT_HOME>/bin/iot-server.sh"
sed -i -e 's/-Dmqtt.broker.host.*/-Dmqtt.broker.host="' $val2 '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Dmqtt.broker.host.*/-Dmqtt.broker.host="' " $val2 " '" \\/' ../bin/iot-server.sh
echo "Completed!!"
echo "Completed!!"
echo "Changing <IoT_HOME>/wso2/broker/conf/carbon.xml"
echo "Changing <IoT_HOME>/wso2/broker/conf/carbon.xml"
sed -i '' -e 's#\(<HostName>\)' $val1 '\(</HostName>\)#\1' $val2 '\2#g' ../wso2/broker/conf/carbon.xml
sed -i -e 's#\(<HostName>\)' " $val1 " '\(</HostName>\)#\1' " $val2 " '\2#g' ../wso2/broker/conf/carbon.xml
sed -i '' -e 's#\(<MgtHostName>\)' $val1 '\(</MgtHostName>\)#\1' $val2 '\2#g' ../wso2/broker/conf/carbon.xml
sed -i -e 's#\(<MgtHostName>\)' " $val1 " '\(</MgtHostName>\)#\1' " $val2 " '\2#g' ../wso2/broker/conf/carbon.xml
echo "Completed!!"
echo "Completed!!"
##################################### IP configs related to analytics ####################################
##################################### IP configs related to analytics ####################################
@ -178,12 +176,12 @@ echo "-------------------------------------------------------"
#--------------------
#--------------------
echo "Changing <IoT_HOME>/bin/iot-server.sh"
echo "Changing <IoT_HOME>/bin/iot-server.sh"
sed -i -e 's/-Diot.analytics.host.*/-Diot.analytics.host="' $val2 '" \\/' ../bin/iot-server.sh
sed -i -e 's/-Diot.analytics.host.*/-Diot.analytics.host="' " $val2 " '" \\/' ../bin/iot-server.sh
echo "Completed!!"
echo "Completed!!"
echo "Changing <IoT_HOME>/wso2/analytics/conf/carbon.xml"
echo "Changing <IoT_HOME>/wso2/analytics/conf/carbon.xml"
sed -i '' -e 's#\(<HostName>\)' $val1 '\(</HostName>\)#\1' $val2 '\2#g' ../wso2/analytics/conf/carbon.xml
sed -i -e 's#\(<HostName>\)' " $val1 " '\(</HostName>\)#\1' " $val2 " '\2#g' ../wso2/analytics/conf/carbon.xml
sed -i '' -e 's#\(<MgtHostName>\)' $val1 '\(</MgtHostName>\)#\1' $val2 '\2#g' ../wso2/analytics/conf/carbon.xml
sed -i -e 's#\(<MgtHostName>\)' " $val1 " '\(</MgtHostName>\)#\1' " $val2 " '\2#g' ../wso2/analytics/conf/carbon.xml
echo "Completed!!"
echo "Completed!!"
echo ""
echo ""
@ -195,44 +193,42 @@ echo ""
B_SUBJ = ''
B_SUBJ = ''
C_SUBJ = ''
C_SUBJ = ''
A_SUBJ = ''
A_SUBJ = ''
SERVER_ADDRESS = ''
SAN_NAMES = ''
SAN_NAMES = ''
slash = '/'
slash = '/'
equal = '='
equal = '='
buildSubject( ) {
buildSubject( ) {
if [ $1 = "CN" ] ; then
if [ " $1 " = "CN" ] ; then
echo "Please provide Common Name "
echo "Please provide Common Name "
read val
read -r val
while [ [ -z $val ] ] ; do #if $val is a zero length String
while [ [ -z $val ] ] ; do #if $val is a zero length String
echo "Common name(your server IP/hostname) cannot be null. Please enter the Common name."
echo "Common name(your server IP/hostname) cannot be null. Please enter the Common name."
read val;
read -r val;
done
done
if [ -n $val ] ; then #This is true if $val is not empty (If $val is not a non zero length String)
if [ -n " $val " ] ; then #This is true if $val is not empty (If $val is not a non zero length String)
if [ $3 = "C" ] ; then
if [ " $3 " = "C" ] ; then
C_SUBJ = " $C_SUBJ $slash $1 $equal $val "
C_SUBJ = " $C_SUBJ $slash $1 $equal $val "
return
return
elif [ $3 = "B" ] ; then
elif [ " $3 " = "B" ] ; then
B_SUBJ = " $B_SUBJ $slash $1 $equal $val "
B_SUBJ = " $B_SUBJ $slash $1 $equal $val "
return
return
else
else
A_SUBJ = " $A_SUBJ $slash $1 $equal $val "
A_SUBJ = " $A_SUBJ $slash $1 $equal $val "
SERVER_ADDRESS = $val
return
return
fi
fi
fi
fi
fi
fi
echo "Please provide " $2 ". Press Enter to skip."
echo "Please provide " " $2 " ". Press Enter to skip."
read val;
read -r val;
if [ ! -z $val ] ; then #If $val is not a zero length String; This is same as if[ -n $val]; then
if [ -n " $val " ] ; then #If $val is not a zero length String; This is same as if[ -n $val]; then
if [ $3 = "C" ] ; then
if [ " $3 " = "C" ] ; then
C_SUBJ = " $C_SUBJ $slash $1 $equal $val "
C_SUBJ = " $C_SUBJ $slash $1 $equal $val "
return
return
elif [ $3 = "B" ] ; then
elif [ " $3 " = "B" ] ; then
B_SUBJ = " $B_SUBJ $slash $1 $equal $val "
B_SUBJ = " $B_SUBJ $slash $1 $equal $val "
return
return
elif [ $3 = "S" ] ; then
elif [ " $3 " = "S" ] ; then
SAN_NAMES = " DNS: $val $4 $SAN_NAMES "
SAN_NAMES = " DNS: $val $4 $SAN_NAMES "
buildSubject 'SAN' 'SAN' 'S' ','
buildSubject 'SAN' 'SAN' 'S' ','
return
return
@ -242,7 +238,13 @@ buildSubject(){
fi
fi
fi
fi
}
}
if [ -d "tmp" ] ; then
rm -rf tmp
fi
mkdir tmp
mkdir tmp
echo ''
echo ''
echo '=======Enter Values for IoT Core SSL Certificate======='
echo '=======Enter Values for IoT Core SSL Certificate======='
@ -256,11 +258,11 @@ buildSubject 'CN' 'Common Name' 'C'
buildSubject 'SAN' 'SAN' 'S'
buildSubject 'SAN' 'SAN' 'S'
echo ""
echo ""
echo 'Provided IoT Core SSL Subject : ' $C_SUBJ
echo 'Provided IoT Core SSL Subject : ' " $C_SUBJ "
echo 'If you have a different IoT Core Keystore password please enter it here. Press Enter to use the default password.'
echo 'If you have a different IoT Core Keystore password please enter it here. Press Enter to use the default password.'
read -s password
read -r - s password
if [ ! -z $password ] ; then
if [ -n " $password " ] ; then
SSL_PASS = $password
SSL_PASS = $password
else
else
SSL_PASS = "wso2carbon"
SSL_PASS = "wso2carbon"
@ -269,11 +271,11 @@ fi
echo ""
echo ""
echo "Generating SSL Certificate for IoT Core"
echo "Generating SSL Certificate for IoT Core"
openssl genrsa -out ./tmp/c.key 4096
openssl genrsa -out ./tmp/c.key 4096
openssl req -new -key ./tmp/c.key -out ./tmp/c.csr -subj $C_SUBJ
openssl req -new -key ./tmp/c.key -out ./tmp/c.csr -subj " $C_SUBJ "
if [ -z $SAN_NAMES ] ; then
if [ -z " $SAN_NAMES " ] ; then
openssl x509 -req -days 730 -in ./tmp/c.csr -signkey ./tmp/c.key -set_serial 044324884 -sha256 -out ./tmp/c.crt
openssl x509 -req -days 730 -in ./tmp/c.csr -signkey ./tmp/c.key -set_serial 044324884 -sha256 -out ./tmp/c.crt
else
else
openssl x509 -req -extfile <( printf " subjectAltName=$SAN_NAMES " ) -days 730 -in ./tmp/c.csr -signkey ./tmp/c.key -set_serial 044324884 -sha256 -out ./tmp/c.crt
openssl x509 -req -extfile <( printf " subjectAltName=%s" " $SAN_NAMES " ) -days 730 -in ./tmp/c.csr -signkey ./tmp/c.key -set_serial 044324884 -sha256 -out ./tmp/c.crt
fi
fi
echo "Export to PKCS12"
echo "Export to PKCS12"
@ -299,8 +301,8 @@ else
echo ""
echo ""
echo "Printing certificate"
echo "Printing certificate"
echo "-----------------------"
echo "-----------------------"
echo $VAR
echo " $VAR "
sed -i '' -e 's#<Certificate>.*#<Certificate>' " $VAR " '</Certificate>#g' ../conf/identity/identity-providers/iot_default.xml
sed -i -e 's#<Certificate>.*#<Certificate>' " $VAR " '</Certificate>#g' ../conf/identity/identity-providers/iot_default.xml
echo ""
echo ""
if [ -e "../conf/identity/identity-providers/iot_default.xml-e" ] ; then
if [ -e "../conf/identity/identity-providers/iot_default.xml-e" ] ; then