Python virtualenv for additional packages - netfishers-onl/Netshot GitHub Wiki

This is experimental. Requires Netshot 0.16.2 or later.

su - netshot -s /bin/bash
cd /usr/local/netshot
mkdir python && cd python
# For versions between 0.16.2 and 0.20.0 (excluded):
graalpython -m venv venv
# For versions 0.21.2+
# Please check last section of installation guide if you are missing graalpy
/usr/lib/graalpy/bin/graalpy -m venv venv  
source venv/bin/activate
/usr/local/netshot/python/venv/bin/graalpy -m pip install --upgrade pip
pip install [some package]

Add the following line to netshot.conf:

netshot.python.virtualenv = /usr/local/netshot/python/venv

In your compliance script, you can import the installed package:

import site
import ...

For packages which require additional access to the system, the two additional configuration options might be useful... but are insecure:

netshot.python.allowallaccess = true
netshot.python.filesystemfilter = false