Deploying a Python IAST agent
This topic explains how to deploy the Python IAST agent on your web server.
Procedure
-
Download the ASoC Python IAST agent:
- Follow the instructions provided here to download the agent.
-
Extract the ZIP file:
- Unzip the downloaded file to access its contents.
-
Deploy the IAST agent:
Run the installation script:
install_secagent.pyWhen the installation completes, it:
- Creates a secagent folder in your Python site-packages directory.
- Creates an asoc-config folder inside the secagent folder.
- Creates a .pth file in the site-packages directory.
-
Run the Python agent using one of the following options:
- Wrapper (recommended for per-process opt-in)
- Environment variable (automatic for all Python processes)
- sitecustomize (automatic for all Python processes)
Supported environment: Python 3.10+ with Flask.
Running the Python agent with wrapper
About this task
Examples:
Procedure
- Instead of python app.py, run secagent python app.py.
- Instead of python -m flask run, run secagent python -m flask run.
Results
- Sets the SECAGENT_ENABLE environment variable.
- Starts the agent.
- Runs your application.
Running the Python agent with environment variable
About this task
Procedure
- Set the environment variable: SECAGENT_ENABLE=true
- Then start your application normally (no wrapper): python app.py
Results
- The agent is enabled automatically.
- It applies to every Python process started with this environment variable set.
Running the Python agent with sitecustomize
About this task
sitecustomize to apply startup
configuration automatically to all Python processes. When
sitecustomize is available on sys.path, Python
imports it during initialization. This lets you to set environment defaults,
configure proxies or certificates, and apply other global settings without changing
individual scripts.Procedure
- Run: Sitecustomize-install.
- Then start your application normally (no wrapper): python app.py.
Results
- Copies sitecustomize.py into the main site-packages directory.
- The agent is automatically loaded for all Python processes.