Python advanced configuration
The easiest way to deploy Python agents is to use the Agent wizard in the Contrast web interface.
The standard configuration for all agents uses this order of precedence.
As of version 5.24.0 of the agent, the Contrast Runner is the recommended way to use the Python Agent for most supported frameworks. Manual middleware configuration is still supported for backward compatibility and may continue to be necessary for certain frameworks and applications.
Tip
Use the Contrast agent configuration editor to create or upload a YAML configuration file, validate YAML, and get setting recommendations.
Configure Python agent with environment variables
You can set these application- and server-specific values as environment variables. Environment variable names use double underscores (__) as separators.
Environment variable | Purpose |
|---|---|
| Specify the application name reported to Contrast |
| Specify the access group for this application. (You must have already created access groups.) |
| Specify the labels applied to the application. |
| Specify the server name reported to Contrast. |
| Specify in which environment the application is running (Development, QA and Production). |
| Specify the labels applied to the server. |
Python YAML template
Use this template to configure the Python agent using a YAML configuration file. (Learn more about YAML configuration.)
Place your YAML file in the default location: /etc/contrast/contrast_security.yaml
https://docs.contrastsecurity.com/common-agent-config/python_contrast_security.yaml