diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d61fbfd8..e71ba72a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -137,8 +137,7 @@ jobs: run: | chmod +x drakrun/drakrun/tools/* # gh artifacts don't keep file permissions cd drakrun - ( cd drakrun/web/frontend ; npm install && npm run-script build ) - python3 setup.py bdist_wheel + make DIST=1 - uses: actions/upload-artifact@v3 with: name: drakvuf-sandbox-whl diff --git a/docs/usage/getting_started.rst b/docs/usage/getting_started.rst index e53b3975..323cc13e 100644 --- a/docs/usage/getting_started.rst +++ b/docs/usage/getting_started.rst @@ -171,3 +171,38 @@ It's also recommended to perform all installation activities using ``root`` user Add ``--no-report`` if you don't want ``draksetup`` to send `basic usage report `_. 16. Test your installation by navigating to the web interface ( http://localhost:6300/ ) and uploading some samples. The default analysis time is 10 minutes. + +Building from sources +===================== + +1. Clone Drakvuf Sandbox repository including submodules + + .. code-block:: console + + $ git clone --recursive git@github.com:CERT-Polska/drakvuf-sandbox.git + +2. Build and install Drakvuf from sources using `instructions from the official Drakvuf documentation `_. It's recommended to use version pinned to the submodule. + +3. Install DRAKVUF Sandbox system dependencies + + .. code-block:: console + + $ apt install tcpdump genisoimage qemu-utils bridge-utils dnsmasq libmagic1 + +4. Install additional Web build dependencies + + .. code-block:: console + + $ apt install nodejs npm + +5. Make and install DRAKVUF Sandbox Python wheel. It's highly recommended to use `virtualenv `_. + + .. code-block:: console + + $ python3 -m venv venv + $ source venv/bin/activate + $ cd drakrun + $ make + $ make install + +6. Follow the :ref:`Basic installation` starting from the Step 2. Redis, MinIO and Drakvuf Sandbox configuration. diff --git a/drakrun/.gitignore b/drakrun/.gitignore index 76b8c667..6007cdb6 100644 --- a/drakrun/.gitignore +++ b/drakrun/.gitignore @@ -1,2 +1,3 @@ build/ drakrun.egg-info/ +dist/ diff --git a/drakrun/Makefile b/drakrun/Makefile new file mode 100644 index 00000000..fcadfddd --- /dev/null +++ b/drakrun/Makefile @@ -0,0 +1,35 @@ +WEB_SOURCE_FILES := $(wildcard *.js *.css) +PYTHON_SOURCE_FILES := $( wildcard *.py ) drakrun/data pyproject.toml MANIFEST.in requirements.txt setup.py + +.PHONY: all +all: dist/*.whl + +dist/*.whl: $(PYTHON_SOURCE_FILES) drakrun/web/frontend/build drakrun/tools/get-explorer-pid drakrun/tools/test-altp2m + rm -f dist/*.whl +ifndef DIST + DRAKRUN_VERSION_TAG=$(shell git rev-parse --short HEAD) python3 setup.py bdist_wheel +else + python3 setup.py bdist_wheel +endif + +drakrun/web/frontend/build: drakrun/web/frontend/node_modules $(WEB_SOURCE_FILES) drakrun/web/frontend/public + cd drakrun/web/frontend ; npm run build + +drakrun/web/frontend/node_modules: drakrun/web/frontend/package.json drakrun/web/frontend/package-lock.json + cd drakrun/web/frontend ; npm ci + +drakrun/tools/get-explorer-pid: drakrun/tools/get-explorer-pid.c + gcc $< -o $@ -lvmi `pkg-config --cflags --libs glib-2.0` + +drakrun/tools/test-altp2m: drakrun/tools/test-altp2m.c + gcc $< -o $@ -lvmi `pkg-config --cflags --libs glib-2.0` + +.PHONY: clean +clean: + rm -rf dist drakvuf_sandbox.egg-info build + rm -rf drakrun/web/frontend/build drakrun/web/frontend/node_modules + rm -f drakrun/tools/get-explorer-pid drakrun/tools/test-altp2m + +.PHONY: install +install: all + pip install dist/*.whl