From 5c6b9c43b3d5292aa6e37ab0823e0b21157c07fd Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Fri, 10 Apr 2020 14:45:25 +0300 Subject: [PATCH] Added build-essential to deps, to install packages without precompiled whl like netifaces --- monkey/monkey_island/deb-package/DEBIAN_MONGO/control | 10 +++++++++- monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control index 93e062b51..62efa5077 100644 --- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control @@ -5,4 +5,12 @@ 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 + +# | 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` | +Depends: openssl, python3.7-dev, python3.7-venv, python3-venv, build-essential diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst index 3ae266edc..6e1b98f79 100644 --- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst +++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst @@ -8,11 +8,16 @@ 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 # install pip requirements ${PYTHON_FOLDER}/bin/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