Fix create cert paths in postinst and added debug messages

This commit is contained in:
Shay Nehmad 2020-04-11 18:29:19 +03:00
parent f1de8e8c76
commit 9d889aada8
2 changed files with 8 additions and 2 deletions

View File

@ -48,14 +48,16 @@ if [ -d "/etc/systemd/network" ]; then
fi fi
echo "Creating server certificate..." echo "Creating server certificate..."
${MONKEY_FOLDER}/monkey_island/create_certificate.sh ${MONKEY_FOLDER}/monkey_island/ ${MONKEY_FOLDER}/monkey_island/create_certificate.sh ${MONKEY_FOLDER}/monkey_island/cc
echo "Starting services..." echo "Starting services..."
service monkey-island start service monkey-island start
service monkey-mongo start service monkey-mongo start
echo ""
echo "Monkey Island installation ended." echo "Monkey Island installation ended."
echo "The server should be accessible soon via https://localhost:5000/" echo "The server should be accessible soon via https://<server_ip>:5000/"
echo "To check the Island's status, run 'sudo service monkey-island status'" echo "To check the Island's status, run 'sudo service monkey-island status'"
echo ""
exit 0 exit 0

View File

@ -2,6 +2,7 @@
server_root=${1:-"./cc"} server_root=${1:-"./cc"}
echo "Creating server cetificate. Server root: $server_root"
# We override the RANDFILE determined by default openssl.cnf # We override the RANDFILE determined by default openssl.cnf
# This is a known issue with the current version of openssl on Ubuntu 18.04 - once they release # This is a known issue with the current version of openssl on Ubuntu 18.04 - once they release
# a new version, we can delete this command. See # a new version, we can delete this command. See
@ -10,8 +11,11 @@ server_root=${1:-"./cc"}
dd bs=1024 count=2 </dev/urandom >~/.rnd dd bs=1024 count=2 </dev/urandom >~/.rnd
chmod 666 ~/.rnd chmod 666 ~/.rnd
echo "Generating key in $server_root/server.key"
openssl genrsa -out "$server_root"/server.key 2048 openssl genrsa -out "$server_root"/server.key 2048
echo "Generating csr in $server_root/server.csr"
openssl req -new -key "$server_root"/server.key -out "$server_root"/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com" openssl req -new -key "$server_root"/server.key -out "$server_root"/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com"
echo "Generating certificate in $server_root/server.crt"
openssl x509 -req -days 366 -in "$server_root"/server.csr -signkey "$server_root"/server.key -out $server_root/server.crt openssl x509 -req -days 366 -in "$server_root"/server.csr -signkey "$server_root"/server.key -out $server_root/server.crt
# Shove some new random data into the file to override the original seed. # Shove some new random data into the file to override the original seed.