Start Here
About C3P0
Development acknowledgment: C3P0 was developed with the assistance of OpenAI Codex AI.
C3P0 is a read-only Imperva account-health reporting tool providing a local WebUI and command-line reports for:
- Origin Connection Reuse Score
- SNI Account Certificate Migration readiness
No Imperva configuration is changed.
API credentials remain in memory for the current run and are not written into reports or diagnostics.
Requirements
- Windows, macOS, or Linux
- Python 3.11 or newer
- Network access to the listed Imperva endpoints
- An Imperva API ID and key with read access to the selected accounts
Check Python
py --versionOn macOS or Linux, use:
python3 --versionInstallation
1. Install Python
Download Python from python.org. On Windows, enable Add Python to PATH.
2. Open a terminal in the extracted C3P0 folder
cd C:\path\to\C3P0-v13. Install requirements — Windows
py -m pip install --upgrade pip
py -m pip install --no-warn-script-location -r requirements.txtmacOS or Linux
python3 -m pip install --upgrade pip
python3 -m pip install --no-warn-script-location -r requirements.txt--no-warn-script-location suppresses only warnings about optional package executables that are not on PATH. It does not suppress dependency, download, or permission failures.
Verify
py C3P0_v1.py --checkWebUI — easiest start
py C3P0_v1.pyC3P0 opens at http://127.0.0.1:33160. It is bound to the local computer and is not exposed to the network.
Alternate port or no automatic browser
py C3P0_v1.py --webui --port 33161
py C3P0_v1.py --webui --no-browserCLI reports
Origin Connection Reuse
py C3P0_v1.py --origin-reportSNI migration
py C3P0_v1.py --sni-reportRun both reports
py C3P0_v1.py --origin-report --sni-reportLimit account scope
py C3P0_v1.py --origin-report --sni-report --account-id 111111 --account-id 222222Include all visible sites in SNI output
py C3P0_v1.py --sni-report --all-sitesSelect SNI workers or output folder
py C3P0_v1.py --sni-report --workers 5
py C3P0_v1.py --origin-report --sni-report --output-dir customer-reportsWorker values 1–10 are supported. Five is recommended. A safe Origin sample is available with --origin-report --sample.
Credentials
The WebUI requests an API ID and key for every run. CLI mode uses the current terminal session’s C3P0_API_ID and C3P0_API_KEY, or securely prompts for missing values.
PowerShell session
$env:C3P0_API_ID="YOUR_API_ID"
$env:C3P0_API_KEY="YOUR_API_KEY"
py C3P0_v1.py --origin-report --sni-reportmacOS or Linux session
export C3P0_API_ID="YOUR_API_ID"
export C3P0_API_KEY="YOUR_API_KEY"
python3 C3P0_v1.py --origin-report --sni-reportThese variables are stored in the current terminal session, not in a file, and normally disappear when the terminal closes. To change customers, overwrite the same two variables before the next run. C3P0 ignores unnamed IMPERVA_API_ID and IMPERVA_API_KEY variables to reduce accidental use of stale credentials.
Output files
CLI output defaults to reports/:
origin_connection_reuse.csvorigin_connection_reuse.htmlsni_account_certificate_audit.csvsni_account_certificate_audit.htmlapi_diagnostics.json
Customer-facing downloaded HTML reports omit C3P0 branding. Diagnostics combine shared discovery/delivery requests and SNI-specific requests into one collection.
How API requests run
- Discover the parent account, subaccounts, and visible sites once.
- Request every site’s delivery configuration once and cache it.
- Generate Origin results from cached
origin_connection_reuse. - Reuse cached
support_non_sni_clientsfor SNI assessment. - Request only the additional certificate/SAN and CNAME-reuse endpoints required for qualifying SNI sites.
The reports do not duplicate delivery-configuration calls. SNI site work is concurrent, so diagnostics record those responses in completion order with timestamps.
Load protection, progress, and stopping
- Each individual HTTP request has a 30-second timeout. This is not a whole-report timeout.
- Request starts are paced to no more than five per second.
- HTTP 429, 502, 503, and 504 status responses use bounded retries and backoff.
- SNI concurrency is bounded and defaults to five workers.
- The total gauge shows planned work; the bar shows the active report phase.
Full Stop prevents new queued calls from starting. An already-active request may return or reach its 30-second timeout. HTTP 401/403 responses and Imperva response bodies reporting a disabled or invalid API key automatically open the same global circuit breaker.
Security notes
- C3P0 performs read-only API operations.
- No create, update, save, upload, enable/disable, PUT, PATCH, or DELETE operation exists.
- WebUI credentials are kept for the current process only.
- Credential headers are redacted in diagnostics.
- Downloaded customer reports do not contain credentials.
- The WebUI listens only on
127.0.0.1. - API keys are never accepted as command-line arguments.
- Diagnostics may contain account metadata and should be reviewed before sharing.
Troubleshooting
Missing pandas or requests
py -m pip install --no-warn-script-location -r requirements.txtPort 33160 is in use
py C3P0_v1.py --webui --port 33161Authentication or permission error
Confirm the API ID/key pair and its read permission for the requested parent or subaccounts. Use API diagnostics to inspect redacted requests and responses.
Large audit appears slow
Requests are deliberately paced. Imperva throttling and temporary service responses may also activate backoff. Avoid increasing workers unless the account owner accepts the additional burst.
Maintenance commands
py C3P0_v1.py --test
py C3P0_v1.py --helpPackage layout
C3P0_v1.py— only supported launcherimperva_reports/— internal API, collection, WebUI, and report modulesimperva_reports/sni_engine.py— SNI, certificate, SAN, and CNAME assessment logicimperva_reports/sni_audit.py— shared discovery, progress, concurrency, cancellation, and diagnostics adapterrequirements.txt— Python dependenciestests/— regression testsVERSIONandCHANGELOG.md— release information
Imperva API endpoint reference
All calls are read operations. Some Imperva list/status APIs use POST as their query method.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | https://my.imperva.com/api/prov/v1/account | Read parent account ID and name. |
| POST | https://my.imperva.com/api/prov/v1/accounts/listSubAccounts | List visible subaccounts. |
| POST | https://my.imperva.com/api/prov/v1/sites/list | List visible sites with pagination. |
| GET | https://my.imperva.com/api/prov/v2/sites/{site_id}/settings/delivery | Read Origin reuse and non-SNI support; shared between reports. |
| POST | https://my.imperva.com/api/prov/v1/sites/performance/advanced/get | Read-only fallback for non-SNI support. |
| GET | https://api.imperva.com/certificates-ui/v3/instructions/all | Read certificate level and SAN data. |
| GET | https://api.imperva.com/site-domain-manager/v2/sites/{site_id}/domains | Read manual and auto-discovered CNAME-reuse domains. |