Install and attach K2's Python Language Agent with your Python application hosted on Node/VM/EC2 for Runtime Self Application Protection.
Steps to protect Python Application
Step 1 : Prerequisites
For Python web applications, make sure you have Python 3.x installed.
Step 2 : Python Language Agent Location
The Python language agent is placed at one of the following locations(a.k.a LANGUAGE_COLLECTORS_HOME) based on the agent installation,
In /opt/k2-ic if the installation of agent is done via a privileged user(Eg. root).
In ${HOME}/k2-ic if the installation of agent is done via an unprivileged user.
${HOME} points to the home directory of the linux user used to run the agent on the host.
In [sharable-directory]/k2-ic if a shareable-directory is configured in the env.properties file during the installation of agent.
For any containerized Python web application (Docker/K8s), the host path LANGUAGE_COLLECTORS_HOME is to be mounted at "/opt/k2-ic" inside the container with option 'z'.
Step 3 : Install Python Language Agent
Install the Python Agent by following the command.
The Python Agent can be statically attached to your application in the following ways
Note: The above run command expects both the /opt/k2-ic/k2-python-agent & your script to be in the PYTHONPATH of your env. This can be set like any other env variable as $ export PYTHONPATH=$PYTHONPATH:{PATHS_TO_BE_ADDED}