From f745f4594064b670aad71c1abb641f7998083ab7 Mon Sep 17 00:00:00 2001 From: Daniel Goldberg Date: Sun, 9 Feb 2020 11:37:25 +0200 Subject: [PATCH] Move to single line of code for creating certs on linux --- deployment_scripts/deploy_linux.sh | 5 ++--- monkey/monkey_island/linux/create_certificate.sh | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/deployment_scripts/deploy_linux.sh b/deployment_scripts/deploy_linux.sh index 085c30b3a..90a6f0769 100755 --- a/deployment_scripts/deploy_linux.sh +++ b/deployment_scripts/deploy_linux.sh @@ -169,9 +169,8 @@ cd "${ISLAND_PATH}" || { echo "cd failed" exit 1 } -openssl genrsa -out cc/server.key 2048 -openssl req -new -key cc/server.key -out cc/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com" -openssl x509 -req -days 366 -in cc/server.csr -signkey cc/server.key -out cc/server.crt + +"${ISLAND_PATH}"/linux/create_certificate.sh ${ISLAND_PATH}/cc # Update node if ! exists npm; then diff --git a/monkey/monkey_island/linux/create_certificate.sh b/monkey/monkey_island/linux/create_certificate.sh index 72aace118..427915340 100644 --- a/monkey/monkey_island/linux/create_certificate.sh +++ b/monkey/monkey_island/linux/create_certificate.sh @@ -1,6 +1,9 @@ #!/bin/bash -openssl genrsa -out ./cc/server.key 2048 -openssl req -new -key ./cc/server.key -out ./cc/server.csr -subj "/OU=Monkey Department/CN=monkey.com" -openssl x509 -req -days 366 -in ./cc/server.csr -signkey ./cc/server.key -out ./cc/server.crt +server_root=${1:-"./cc"} + + +openssl genrsa -out $server_root/server.key 2048 +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 x509 -req -days 366 -in $server_root/server.csr -signkey $server_root/server.key -out $server_root/server.crt