From 1189d42bbb1ac287619122b39a7a5532d4c203ac Mon Sep 17 00:00:00 2001 From: itay Date: Thu, 14 Feb 2019 13:57:56 +0200 Subject: [PATCH 1/2] Debian package now requires mongo as dependency instead of having a monkey-mongo service --- .../monkey_island/deb-package/DEBIAN/control | 2 +- .../monkey_island/deb-package/DEBIAN/postinst | 2 -- monkey/monkey_island/deb-package/DEBIAN/prerm | 3 --- monkey/monkey_island/linux/clear_db.sh | 6 ------ monkey/monkey_island/linux/run.sh | 1 - .../linux/ubuntu/monkey-mongo.conf | 18 ------------------ .../linux/ubuntu/systemd/monkey-island.service | 1 - .../linux/ubuntu/systemd/monkey-mongo.service | 12 ------------ 8 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 monkey/monkey_island/linux/clear_db.sh delete mode 100644 monkey/monkey_island/linux/ubuntu/monkey-mongo.conf delete mode 100644 monkey/monkey_island/linux/ubuntu/systemd/monkey-mongo.service diff --git a/monkey/monkey_island/deb-package/DEBIAN/control b/monkey/monkey_island/deb-package/DEBIAN/control index 2693afbd9..b31daa194 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 +Depends: openssl, python-pip, python-dev, mongodb diff --git a/monkey/monkey_island/deb-package/DEBIAN/postinst b/monkey/monkey_island/deb-package/DEBIAN/postinst index b55f791b8..c113b34d5 100644 --- a/monkey/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN/postinst @@ -20,14 +20,12 @@ 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 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 diff --git a/monkey/monkey_island/deb-package/DEBIAN/prerm b/monkey/monkey_island/deb-package/DEBIAN/prerm index 69070adaf..0449e0b3f 100644 --- a/monkey/monkey_island/deb-package/DEBIAN/prerm +++ b/monkey/monkey_island/deb-package/DEBIAN/prerm @@ -1,12 +1,9 @@ #!/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 diff --git a/monkey/monkey_island/linux/clear_db.sh b/monkey/monkey_island/linux/clear_db.sh deleted file mode 100644 index 7ec819cd5..000000000 --- a/monkey/monkey_island/linux/clear_db.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -service monkey-mongo stop -cd /var/monkey/monkey_island -rm -rf ./db/* -service monkey-mongo start diff --git a/monkey/monkey_island/linux/run.sh b/monkey/monkey_island/linux/run.sh index c72b5f3b9..978e02fe5 100644 --- a/monkey/monkey_island/linux/run.sh +++ b/monkey/monkey_island/linux/run.sh @@ -1,5 +1,4 @@ #!/bin/bash cd /var/monkey -/var/monkey/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey/monkey_island/db & /var/monkey/monkey_island/bin/python/bin/python monkey_island.py \ No newline at end of file diff --git a/monkey/monkey_island/linux/ubuntu/monkey-mongo.conf b/monkey/monkey_island/linux/ubuntu/monkey-mongo.conf deleted file mode 100644 index cd148d877..000000000 --- a/monkey/monkey_island/linux/ubuntu/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 diff --git a/monkey/monkey_island/linux/ubuntu/systemd/monkey-island.service b/monkey/monkey_island/linux/ubuntu/systemd/monkey-island.service index d66de2377..b6a536574 100644 --- a/monkey/monkey_island/linux/ubuntu/systemd/monkey-island.service +++ b/monkey/monkey_island/linux/ubuntu/systemd/monkey-island.service @@ -1,6 +1,5 @@ [Unit] Description=Monkey Island Service -Wants=monkey-mongo.service After=network.target [Service] diff --git a/monkey/monkey_island/linux/ubuntu/systemd/monkey-mongo.service b/monkey/monkey_island/linux/ubuntu/systemd/monkey-mongo.service deleted file mode 100644 index b786e0abb..000000000 --- a/monkey/monkey_island/linux/ubuntu/systemd/monkey-mongo.service +++ /dev/null @@ -1,12 +0,0 @@ -[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 From 03a0c45b5cc4d12427237022f10d46dc617d8e79 Mon Sep 17 00:00:00 2001 From: itay Date: Thu, 14 Feb 2019 16:50:00 +0200 Subject: [PATCH 2/2] Use monkey's python --- monkey/monkey_island/linux/ubuntu/monkey-island.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey/monkey_island/linux/ubuntu/monkey-island.conf b/monkey/monkey_island/linux/ubuntu/monkey-island.conf index 1ded4d94a..e7dfc4d21 100644 --- a/monkey/monkey_island/linux/ubuntu/monkey-island.conf +++ b/monkey/monkey_island/linux/ubuntu/monkey-island.conf @@ -8,7 +8,7 @@ respawn limit unlimited script chdir /var/monkey - exec python monkey_island/cc/main.py + exec monkey_island/bin/python/bin/python monkey_island.py end script post-stop script