Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93348434
step2.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 28, 02:40
Size
1 KB
Mime Type
text/x-shellscript
Expires
Sat, Nov 30, 02:40 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
22619310
Attached To
R4444 MedCo Deployment
step2.sh
View Options
#!/bin/bash
##################################################################
# MedCo configuration generator: step 2
# generate keypair of the node or import it
##################################################################
set
-e
shopt
-s nullglob
if
[
$#
!
=
4 -a
$#
!
=
5
]
then
echo
"Usage:"
echo
"Generate pair of keys:"
echo
" bash step2.sh CONFIGURATION_PROFILE NODE_INDEX KEYSTORE_PASSWORD NODE_DNS NODE_IP"
echo
"Import pair of keys:"
echo
" bash step2.sh CONFIGURATION_PROFILE NODE_INDEX KEYSTORE_PASSWORD KEY_FILE_PATH"
exit
fi
SCRIPT_FOLDER
=
"$( cd "
$(
dirname
"${BASH_SOURCE[0]}"
)
" && pwd )"
/..
CONF_PROFILE
=
"$1"
CONF_FOLDER
=
"$SCRIPT_FOLDER/../../configuration-profiles/$CONF_PROFILE"
COMPOSE_FOLDER
=
"$SCRIPT_FOLDER/../../compose-profiles/$CONF_PROFILE"
NODE_IDX
=
"$2"
KEYSTORE_PW
=
"$3"
# check dependency
which keytool
##################################################################
# execute step 2
##################################################################
KEYSTORE
=
"$CONF_FOLDER/srv$NODE_IDX.keystore"
KEYSTORE_PRIVATE_ALIAS
=
"srv$NODE_IDX-private"
if
[
$#
==
5
]
then
NODE_DNS
=
"$4"
NODE_IP
=
"$5"
echo
"### Generating java keystore pair of keys"
keytool -genkeypair -keysize 2048 -alias
"$KEYSTORE_PRIVATE_ALIAS"
-validity 7300
\
-dname
"CN=$NODE_DNS"
-ext
"SAN=DNS:$NODE_DNS,IP:$NODE_IP"
\
-keyalg RSA -keypass
"$KEYSTORE_PW"
-storepass
"$KEYSTORE_PW"
-keystore
"$KEYSTORE"
elif
[
$#
==
4
]
then
echo
"### Importing pair of keys"
echo
"NOT IMPLEMENTED"
exit
# todo
fi
Event Timeline
Log In to Comment