From 15389e34d5befcdd5fe8e3383390fc06ba518dda Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 13:42:09 +0300 Subject: [PATCH 1/9] Add/Modify files for optional mongodb service --- .../monkey_island/deb-package/DEBIAN/control | 2 +- .../monkey_island/deb-package/DEBIAN/postinst | 6 +-- .../deb-package/DEBIAN_MONGO/control | 8 ++++ .../deb-package/DEBIAN_MONGO/postinst | 36 ++++++++++++++++ .../deb-package/DEBIAN_MONGO/prerm | 13 ++++++ .../monkey_island_pip_requirements.txt | 19 --------- .../service}/monkey-island.conf | 0 .../service}/systemd/monkey-island.service | 0 .../service}/systemd/start_server.sh | 0 .../service_mongo/monkey-mongo.conf | 18 ++++++++ .../systemd/monkey-island.service | 11 +++++ .../systemd/monkey-mongo.service | 12 ++++++ monkey/monkey_island/linux/install_mongo.sh | 42 +++++++++++++++++++ monkey/monkey_island/requirements.txt | 3 +- 14 files changed, 146 insertions(+), 24 deletions(-) create mode 100644 monkey/monkey_island/deb-package/DEBIAN_MONGO/control create mode 100644 monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst create mode 100644 monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm delete mode 100644 monkey/monkey_island/deb-package/monkey_island_pip_requirements.txt rename monkey/monkey_island/{linux/ubuntu => deb-package/service}/monkey-island.conf (100%) rename monkey/monkey_island/{linux/ubuntu => deb-package/service}/systemd/monkey-island.service (100%) rename monkey/monkey_island/{linux/ubuntu => deb-package/service}/systemd/start_server.sh (100%) create mode 100644 monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf create mode 100644 monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service create mode 100644 monkey/monkey_island/deb-package/service_mongo/systemd/monkey-mongo.service create mode 100644 monkey/monkey_island/linux/install_mongo.sh diff --git a/monkey/monkey_island/deb-package/DEBIAN/control b/monkey/monkey_island/deb-package/DEBIAN/control index b31daa194..2693afbd9 100644 --- a/monkey/monkey_island/deb-package/DEBIAN/control +++ b/monkey/monkey_island/deb-package/DEBIAN/control @@ -5,4 +5,4 @@ Homepage: http://www.guardicore.com Priority: optional Version: 1.0 Description: Guardicore Infection Monkey Island installation package -Depends: openssl, python-pip, python-dev, mongodb +Depends: openssl, python-pip, python-dev diff --git a/monkey/monkey_island/deb-package/DEBIAN/postinst b/monkey/monkey_island/deb-package/DEBIAN/postinst index c113b34d5..4f5299f6d 100644 --- a/monkey/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN/postinst @@ -15,10 +15,10 @@ ${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/pip_r rm -rf ${INSTALLATION_FOLDER} rm -f ${MONKEY_FOLDER}/monkey_island/pip_requirements.txt -cp ${MONKEY_FOLDER}/monkey_island/ubuntu/* /etc/init/ +cp ${MONKEY_FOLDER}/monkey_island/service/* /etc/init/ if [ -d "/etc/systemd/network" ]; then - cp ${MONKEY_FOLDER}/monkey_island/ubuntu/systemd/*.service /lib/systemd/system/ - chmod +x ${MONKEY_FOLDER}/monkey_island/ubuntu/systemd/start_server.sh + cp ${MONKEY_FOLDER}/monkey_island/service/systemd/*.service /lib/systemd/system/ + chmod +x ${MONKEY_FOLDER}/monkey_island/service/systemd/start_server.sh systemctl daemon-reload systemctl enable monkey-island fi diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control new file mode 100644 index 000000000..2693afbd9 --- /dev/null +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control @@ -0,0 +1,8 @@ +Package: gc-monkey-island +Architecture: amd64 +Maintainer: Guardicore +Homepage: http://www.guardicore.com +Priority: optional +Version: 1.0 +Description: Guardicore Infection Monkey Island installation package +Depends: openssl, python-pip, python-dev diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst new file mode 100644 index 000000000..156a46374 --- /dev/null +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst @@ -0,0 +1,36 @@ +#!/bin/bash + +MONKEY_FOLDER=/var/monkey +INSTALLATION_FOLDER=/var/monkey/monkey_island/installation +PYTHON_FOLDER=/var/monkey/monkey_island/bin/python + +# Prepare python virtualenv +pip2 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER +virtualenv -p python2.7 ${PYTHON_FOLDER} + +# install pip requirements +${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER + +# remove installation folder and unnecessary files +rm -rf ${INSTALLATION_FOLDER} +rm -f ${MONKEY_FOLDER}/monkey_island/pip_requirements.txt + +${MONKEY_FOLDER}/monkey_island/install_mongo.sh ${MONKEY_FOLDER}/monkey_island/bin/mongodb + +cp ${MONKEY_FOLDER}/monkey_island/service/* /etc/init/ +if [ -d "/etc/systemd/network" ]; then + cp ${MONKEY_FOLDER}/monkey_island/service/systemd/*.service /lib/systemd/system/ + chmod +x ${MONKEY_FOLDER}/monkey_island/service/systemd/start_server.sh + systemctl daemon-reload + systemctl enable monkey-mongo + systemctl enable monkey-island +fi + +${MONKEY_FOLDER}/monkey_island/create_certificate.sh + +service monkey-island start +service monkey-mongo start + +echo Monkey Island installation ended + +exit 0 \ No newline at end of file diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm b/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm new file mode 100644 index 000000000..69070adaf --- /dev/null +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm @@ -0,0 +1,13 @@ +#!/bin/sh + +service monkey-island stop || true +service monkey-mongo stop || true + +rm -f /etc/init/monkey-island.conf +rm -f /etc/init/monkey-mongo.conf +[ -f "/lib/systemd/system/monkey-island.service" ] && rm -f /lib/systemd/system/monkey-island.service +[ -f "/lib/systemd/system/monkey-mongo.service" ] && rm -f /lib/systemd/system/monkey-mongo.service + +rm -r -f /var/monkey + +exit 0 \ No newline at end of file diff --git a/monkey/monkey_island/deb-package/monkey_island_pip_requirements.txt b/monkey/monkey_island/deb-package/monkey_island_pip_requirements.txt deleted file mode 100644 index 4f6ea54ec..000000000 --- a/monkey/monkey_island/deb-package/monkey_island_pip_requirements.txt +++ /dev/null @@ -1,19 +0,0 @@ -python-dateutil -tornado -werkzeug -jinja2 -markupsafe -itsdangerous -click -flask -Flask-Pymongo -Flask-Restful -Flask-JWT -jsonschema -netifaces -ipaddress -enum34 -pycryptodome -boto3 -awscli -virtualenv \ No newline at end of file diff --git a/monkey/monkey_island/linux/ubuntu/monkey-island.conf b/monkey/monkey_island/deb-package/service/monkey-island.conf similarity index 100% rename from monkey/monkey_island/linux/ubuntu/monkey-island.conf rename to monkey/monkey_island/deb-package/service/monkey-island.conf diff --git a/monkey/monkey_island/linux/ubuntu/systemd/monkey-island.service b/monkey/monkey_island/deb-package/service/systemd/monkey-island.service similarity index 100% rename from monkey/monkey_island/linux/ubuntu/systemd/monkey-island.service rename to monkey/monkey_island/deb-package/service/systemd/monkey-island.service diff --git a/monkey/monkey_island/linux/ubuntu/systemd/start_server.sh b/monkey/monkey_island/deb-package/service/systemd/start_server.sh similarity index 100% rename from monkey/monkey_island/linux/ubuntu/systemd/start_server.sh rename to monkey/monkey_island/deb-package/service/systemd/start_server.sh diff --git a/monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf b/monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf new file mode 100644 index 000000000..cd148d877 --- /dev/null +++ b/monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf @@ -0,0 +1,18 @@ +description "Monkey Island Mongo Service" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit unlimited + +script + chdir /var/monkey/monkey_island/ + exec /var/monkey/monkey_island/bin/mongodb/bin/mongod --dbpath db +end script + +post-stop script + if [ -n $UPSTART_EVENTS ]; then + exec sleep 3 + fi +end script \ No newline at end of file diff --git a/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service b/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service new file mode 100644 index 000000000..d66de2377 --- /dev/null +++ b/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service @@ -0,0 +1,11 @@ +[Unit] +Description=Monkey Island Service +Wants=monkey-mongo.service +After=network.target + +[Service] +Type=simple +ExecStart=/var/monkey/monkey_island/ubuntu/systemd/start_server.sh + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-mongo.service b/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-mongo.service new file mode 100644 index 000000000..b786e0abb --- /dev/null +++ b/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-mongo.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monkey Island Mongo Service +After=network.target + +[Service] +ExecStart=/var/monkey/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey/monkey_island/db +KillMode=process +Restart=always +ExecStop=/var/monkey/monkey_island/bin/mongodb/bin/mongod --shutdown + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/monkey/monkey_island/linux/install_mongo.sh b/monkey/monkey_island/linux/install_mongo.sh new file mode 100644 index 000000000..701a7063e --- /dev/null +++ b/monkey/monkey_island/linux/install_mongo.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +export os_version_monkey=$(cat /etc/issue) +MONGODB_DIR=$1 # If using deb, this should be: /var/monkey/monkey_island/bin/mongodb + +if [[ $os_version_monkey == "Ubuntu 14.04"* ]] ; +then + echo Detected Ubuntu 14.04 + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-4.0.8.tgz" +elif [[ $os_version_monkey == "Ubuntu 16.04"* ]] ; +then + echo Detected Ubuntu 16.04 + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.0.8.tgz" +elif [[ $os_version_monkey == "Ubuntu 18.04"* ]] ; +then + echo Detected Ubuntu 18.04 + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.8.tgz" +elif [[ $os_version_monkey == "Debian GNU/Linux 8"* ]] ; +then + echo Detected Debian 8 + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-4.0.8.tgz" +elif [[ $os_version_monkey == "Debian GNU/Linux 9"* ]] ; +then + echo Detected Debian 9 + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.8.tgz" +else + echo Unsupported OS + exit -1 +fi + +TEMP_MONGO=$(mktemp -d) +pushd $TEMP_MONGO +wget $tgz_url -O mongodb.tgz +tar -xf mongodb.tgz +popd + +mkdir -p $MONGODB_DIR/bin +cp $TEMP_MONGO/mongodb-*/bin/mongod $MONGODB_DIR/bin/mongod +chmod a+x $MONGODB_DIR/bin/mongod +rm -r $TEMP_MONGO + +exit 0 \ No newline at end of file diff --git a/monkey/monkey_island/requirements.txt b/monkey/monkey_island/requirements.txt index 0caf91c10..d86832681 100644 --- a/monkey/monkey_island/requirements.txt +++ b/monkey/monkey_island/requirements.txt @@ -17,4 +17,5 @@ pycryptodome boto3 awscli cffi -PyInstaller \ No newline at end of file +PyInstaller +virtualenv \ No newline at end of file From 0fd46c2828cedde1efff9f1c9934f32cb89e68e5 Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 16:22:27 +0300 Subject: [PATCH 2/9] Use mongodb version 3.6.12 --- monkey/monkey_island/linux/install_mongo.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/linux/install_mongo.sh b/monkey/monkey_island/linux/install_mongo.sh index 701a7063e..87d27c28f 100644 --- a/monkey/monkey_island/linux/install_mongo.sh +++ b/monkey/monkey_island/linux/install_mongo.sh @@ -6,23 +6,23 @@ MONGODB_DIR=$1 # If using deb, this should be: /var/monkey/monkey_island/bin/mon if [[ $os_version_monkey == "Ubuntu 14.04"* ]] ; then echo Detected Ubuntu 14.04 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-4.0.8.tgz" + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.6.12.tgz" elif [[ $os_version_monkey == "Ubuntu 16.04"* ]] ; then echo Detected Ubuntu 16.04 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.0.8.tgz" + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.6.12.tgz" elif [[ $os_version_monkey == "Ubuntu 18.04"* ]] ; then echo Detected Ubuntu 18.04 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.8.tgz" + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-3.6.12.tgz" elif [[ $os_version_monkey == "Debian GNU/Linux 8"* ]] ; then echo Detected Debian 8 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-4.0.8.tgz" + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-3.6.12.tgz" elif [[ $os_version_monkey == "Debian GNU/Linux 9"* ]] ; then echo Detected Debian 9 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.8.tgz" + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-3.6.12.tgz" else echo Unsupported OS exit -1 From 3e0d83d2e27ba3be5c7368345d6bc480d234217a Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 17:24:39 +0300 Subject: [PATCH 3/9] fix postinst, remove unecessary control, add wheel to requirements --- monkey/monkey_island/deb-package/DEBIAN/postinst | 4 ++-- monkey/monkey_island/deb-package/DEBIAN_MONGO/control | 8 -------- monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst | 4 ++-- .../deb-package/service/systemd/monkey-island.service | 2 +- monkey/monkey_island/requirements.txt | 3 ++- 5 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 monkey/monkey_island/deb-package/DEBIAN_MONGO/control diff --git a/monkey/monkey_island/deb-package/DEBIAN/postinst b/monkey/monkey_island/deb-package/DEBIAN/postinst index 4f5299f6d..c319db669 100644 --- a/monkey/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN/postinst @@ -9,11 +9,11 @@ pip2 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER virtualenv -p python2.7 ${PYTHON_FOLDER} # install pip requirements -${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER +${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER # remove installation folder and unnecessary files rm -rf ${INSTALLATION_FOLDER} -rm -f ${MONKEY_FOLDER}/monkey_island/pip_requirements.txt +rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt cp ${MONKEY_FOLDER}/monkey_island/service/* /etc/init/ if [ -d "/etc/systemd/network" ]; then diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control deleted file mode 100644 index 2693afbd9..000000000 --- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control +++ /dev/null @@ -1,8 +0,0 @@ -Package: gc-monkey-island -Architecture: amd64 -Maintainer: Guardicore -Homepage: http://www.guardicore.com -Priority: optional -Version: 1.0 -Description: Guardicore Infection Monkey Island installation package -Depends: openssl, python-pip, python-dev diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst index 156a46374..b46ad0c37 100644 --- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst @@ -9,11 +9,11 @@ pip2 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER virtualenv -p python2.7 ${PYTHON_FOLDER} # install pip requirements -${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER +${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER # remove installation folder and unnecessary files rm -rf ${INSTALLATION_FOLDER} -rm -f ${MONKEY_FOLDER}/monkey_island/pip_requirements.txt +rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt ${MONKEY_FOLDER}/monkey_island/install_mongo.sh ${MONKEY_FOLDER}/monkey_island/bin/mongodb diff --git a/monkey/monkey_island/deb-package/service/systemd/monkey-island.service b/monkey/monkey_island/deb-package/service/systemd/monkey-island.service index b6a536574..e1dea878a 100644 --- a/monkey/monkey_island/deb-package/service/systemd/monkey-island.service +++ b/monkey/monkey_island/deb-package/service/systemd/monkey-island.service @@ -4,7 +4,7 @@ After=network.target [Service] Type=simple -ExecStart=/var/monkey/monkey_island/ubuntu/systemd/start_server.sh +ExecStart=/var/monkey/monkey_island/service/systemd/start_server.sh [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/monkey/monkey_island/requirements.txt b/monkey/monkey_island/requirements.txt index d86832681..ff12ed92d 100644 --- a/monkey/monkey_island/requirements.txt +++ b/monkey/monkey_island/requirements.txt @@ -18,4 +18,5 @@ boto3 awscli cffi PyInstaller -virtualenv \ No newline at end of file +virtualenv +wheel \ No newline at end of file From 8154a7583c685aba78da91f86e807a80c5b19a34 Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 17:57:26 +0300 Subject: [PATCH 4/9] fix start_server path --- .../deb-package/service_mongo/systemd/monkey-island.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service b/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service index d66de2377..aa609f068 100644 --- a/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service +++ b/monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service @@ -5,7 +5,7 @@ After=network.target [Service] Type=simple -ExecStart=/var/monkey/monkey_island/ubuntu/systemd/start_server.sh +ExecStart=/var/monkey/monkey_island/service/systemd/start_server.sh [Install] WantedBy=multi-user.target \ No newline at end of file From e405210e4625dd8fe25f5c7d62686bf78dd8aa11 Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 18:53:40 +0300 Subject: [PATCH 5/9] remove upstart scripts --- .../monkey_island/deb-package/DEBIAN/postinst | 1 - .../deb-package/DEBIAN_MONGO/postinst | 1 - .../deb-package/service/monkey-island.conf | 18 ------------------ .../service_mongo/monkey-mongo.conf | 18 ------------------ 4 files changed, 38 deletions(-) delete mode 100644 monkey/monkey_island/deb-package/service/monkey-island.conf delete mode 100644 monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf diff --git a/monkey/monkey_island/deb-package/DEBIAN/postinst b/monkey/monkey_island/deb-package/DEBIAN/postinst index c319db669..8efc19bbb 100644 --- a/monkey/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN/postinst @@ -15,7 +15,6 @@ ${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/requi rm -rf ${INSTALLATION_FOLDER} rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt -cp ${MONKEY_FOLDER}/monkey_island/service/* /etc/init/ if [ -d "/etc/systemd/network" ]; then cp ${MONKEY_FOLDER}/monkey_island/service/systemd/*.service /lib/systemd/system/ chmod +x ${MONKEY_FOLDER}/monkey_island/service/systemd/start_server.sh diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst index b46ad0c37..76e57caa3 100644 --- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst @@ -17,7 +17,6 @@ rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt ${MONKEY_FOLDER}/monkey_island/install_mongo.sh ${MONKEY_FOLDER}/monkey_island/bin/mongodb -cp ${MONKEY_FOLDER}/monkey_island/service/* /etc/init/ if [ -d "/etc/systemd/network" ]; then cp ${MONKEY_FOLDER}/monkey_island/service/systemd/*.service /lib/systemd/system/ chmod +x ${MONKEY_FOLDER}/monkey_island/service/systemd/start_server.sh diff --git a/monkey/monkey_island/deb-package/service/monkey-island.conf b/monkey/monkey_island/deb-package/service/monkey-island.conf deleted file mode 100644 index e7dfc4d21..000000000 --- a/monkey/monkey_island/deb-package/service/monkey-island.conf +++ /dev/null @@ -1,18 +0,0 @@ -description "Monkey Island Service" - -start on runlevel [2345] -stop on runlevel [!2345] - -respawn -respawn limit unlimited - -script - chdir /var/monkey - exec monkey_island/bin/python/bin/python monkey_island.py -end script - -post-stop script - if [ -n $UPSTART_EVENTS ]; then - exec sleep 2 - fi -end script \ No newline at end of file diff --git a/monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf b/monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf deleted file mode 100644 index cd148d877..000000000 --- a/monkey/monkey_island/deb-package/service_mongo/monkey-mongo.conf +++ /dev/null @@ -1,18 +0,0 @@ -description "Monkey Island Mongo Service" - -start on runlevel [2345] -stop on runlevel [!2345] - -respawn -respawn limit unlimited - -script - chdir /var/monkey/monkey_island/ - exec /var/monkey/monkey_island/bin/mongodb/bin/mongod --dbpath db -end script - -post-stop script - if [ -n $UPSTART_EVENTS ]; then - exec sleep 3 - fi -end script \ No newline at end of file From 11f0363e495d7e6d074b5aa9ba9d86f1fe5352b9 Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 19:17:22 +0300 Subject: [PATCH 6/9] copy mongo license --- monkey/monkey_island/linux/install_mongo.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/monkey/monkey_island/linux/install_mongo.sh b/monkey/monkey_island/linux/install_mongo.sh index 87d27c28f..e7c71acf6 100644 --- a/monkey/monkey_island/linux/install_mongo.sh +++ b/monkey/monkey_island/linux/install_mongo.sh @@ -36,6 +36,7 @@ popd mkdir -p $MONGODB_DIR/bin cp $TEMP_MONGO/mongodb-*/bin/mongod $MONGODB_DIR/bin/mongod +cp $TEMP_MONGO/mongodb-*/LICENSE-Community.txt $MONGODB_DIR/ chmod a+x $MONGODB_DIR/bin/mongod rm -r $TEMP_MONGO From 1274fe053ae1bcb8dbcf2e336f4838c42bef53fb Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 19:22:31 +0300 Subject: [PATCH 7/9] use mongo4 with ubuntu18 --- monkey/monkey_island/linux/install_mongo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey/monkey_island/linux/install_mongo.sh b/monkey/monkey_island/linux/install_mongo.sh index e7c71acf6..7748b8b58 100644 --- a/monkey/monkey_island/linux/install_mongo.sh +++ b/monkey/monkey_island/linux/install_mongo.sh @@ -14,7 +14,7 @@ then elif [[ $os_version_monkey == "Ubuntu 18.04"* ]] ; then echo Detected Ubuntu 18.04 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-3.6.12.tgz" + export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.8.tgz" elif [[ $os_version_monkey == "Debian GNU/Linux 8"* ]] ; then echo Detected Debian 8 From e9d74b1fbd4ee14c5f13dadd12e7c44460446a4a Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 15 Apr 2019 19:33:27 +0300 Subject: [PATCH 8/9] remove upstart scripts from prerm --- monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm | 2 -- 1 file changed, 2 deletions(-) diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm b/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm index 69070adaf..dabdbd2fa 100644 --- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/prerm @@ -3,8 +3,6 @@ service monkey-island stop || true service monkey-mongo stop || true -rm -f /etc/init/monkey-island.conf -rm -f /etc/init/monkey-mongo.conf [ -f "/lib/systemd/system/monkey-island.service" ] && rm -f /lib/systemd/system/monkey-island.service [ -f "/lib/systemd/system/monkey-mongo.service" ] && rm -f /lib/systemd/system/monkey-mongo.service From 051239ee09909c5d620fb7759648a7032701a08a Mon Sep 17 00:00:00 2001 From: itay Date: Tue, 16 Apr 2019 15:36:45 +0300 Subject: [PATCH 9/9] remove ubuntu 14.04 support on mongo script --- monkey/monkey_island/linux/install_mongo.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/monkey/monkey_island/linux/install_mongo.sh b/monkey/monkey_island/linux/install_mongo.sh index 7748b8b58..a00a2078b 100644 --- a/monkey/monkey_island/linux/install_mongo.sh +++ b/monkey/monkey_island/linux/install_mongo.sh @@ -3,11 +3,7 @@ export os_version_monkey=$(cat /etc/issue) MONGODB_DIR=$1 # If using deb, this should be: /var/monkey/monkey_island/bin/mongodb -if [[ $os_version_monkey == "Ubuntu 14.04"* ]] ; -then - echo Detected Ubuntu 14.04 - export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.6.12.tgz" -elif [[ $os_version_monkey == "Ubuntu 16.04"* ]] ; +if [[ $os_version_monkey == "Ubuntu 16.04"* ]] ; then echo Detected Ubuntu 16.04 export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.6.12.tgz"