Island: Remode disused deb-package/

This commit is contained in:
Mike Salvatore 2022-08-29 10:31:18 -04:00
parent 3000304d28
commit 40d4f7f50c
9 changed files with 0 additions and 160 deletions

View File

@ -1,31 +0,0 @@
#!/bin/bash
MONKEY_FOLDER=/var/monkey
INSTALLATION_FOLDER=/var/monkey/monkey_island/installation
PYTHON_FOLDER=/var/monkey/monkey_island/bin/python
# Prepare python virtualenv
pip3 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER
python3 -m virtualenv -p python3 ${PYTHON_FOLDER}
# install pip requirements
${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/requirements.txt
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-island
fi
${MONKEY_FOLDER}/monkey_island/create_certificate.sh ${MONKEY_FOLDER}/monkey_island/
service monkey-island start
echo Monkey Island installation ended
exit 0

View File

@ -1,10 +0,0 @@
#!/bin/sh
service monkey-island stop || true
rm -f /etc/init/monkey-island.conf
[ -f "/lib/systemd/system/monkey-island.service" ] && rm -f /lib/systemd/system/monkey-island.service
rm -r -f /var/monkey
exit 0

View File

@ -1,8 +0,0 @@
Package: gc-monkey-island
Architecture: amd64
Maintainer: Guardicore <support@infectionmonkey.com>
Homepage: https://www.infectionmonkey.com
Priority: optional
Version: 1.0
Description: Guardicore Infection Monkey Island installation package
Depends: openssl, python3.7-dev, python3.7-venv, python3-venv, build-essential

View File

@ -1,63 +0,0 @@
#!/bin/bash
# See the "Depends" field of the control file for what packages this scripts depends on.
# Here are the explanations for the current deps:
# Dependency - Why is it required
## openssl - Server certificate generation
## python3.7-dev - Server runtime
## python3.7-venv - For creating virtual env to install all the server pip deps (don't want to pollute system python)
## python3-venv - python3.7-venv doesn't work without it since you need ensure-pip
## build-essential - for compiling python dependencies that don't come in a pre-compiled wheel, like `netifaces`
echo "Installing Monkey Island (Infection Monkey server)..."
MONKEY_FOLDER=/var/monkey
INSTALLATION_FOLDER=/var/monkey/monkey_island/installation
PYTHON_FOLDER=/var/monkey/monkey_island/bin/python
PYTHON_VERSION=python3.7
# Prepare python virtualenv
# This is using the apt package `python3.7-venv` which is listed in the `control` file as a dependency.
# See https://packages.debian.org/stable/python/python3.7-venv
echo "Using $(command -v $PYTHON_VERSION) as the base for virtualenv creation"
$PYTHON_VERSION -m venv ${PYTHON_FOLDER}
# shellcheck disable=SC1090
source ${PYTHON_FOLDER}/bin/activate
echo "Installing Python dependencies using $(command -v python) and $(command -v pip)..."
# First, make sure that pip is updated
python -m pip install --upgrade pip
# Then install the dependecies from the pre-downloaded whl and tar.gz file
python -m pip install -r $MONKEY_FOLDER/monkey_island/requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
deactivate
# remove installation folder and unnecessary files
rm -rf ${INSTALLATION_FOLDER}
rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt
echo "Installing mongodb..."
${MONKEY_FOLDER}/monkey_island/install_mongo.sh ${MONKEY_FOLDER}/monkey_island/bin/mongodb
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
echo "Creating server certificate..."
${MONKEY_FOLDER}/monkey_island/create_certificate.sh ${MONKEY_FOLDER}/monkey_island/cc
echo "Starting services..."
service monkey-island start
service monkey-mongo start
echo ""
echo "Monkey Island installation ended."
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 ""
exit 0

View File

@ -1,11 +0,0 @@
#!/bin/sh
service monkey-island stop || true
service monkey-mongo stop || true
[ -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

View File

@ -1,10 +0,0 @@
[Unit]
Description=Monkey Island Service
After=network.target
[Service]
Type=simple
ExecStart=/var/monkey/monkey_island/service/systemd/start_server.sh
[Install]
WantedBy=multi-user.target

View File

@ -1,11 +0,0 @@
[Unit]
Description=Monkey Island Service
Wants=monkey-mongo.service
After=network.target
[Service]
Type=simple
ExecStart=/var/monkey/monkey_island/service/systemd/start_server.sh
[Install]
WantedBy=multi-user.target

View File

@ -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

View File

@ -1,4 +0,0 @@
#!/bin/bash
cd /var/monkey
/var/monkey/monkey_island/bin/python/bin/python monkey_island.py