A comprehensive Prefect 3.x workflow orchestration project for security automation, asset management, and vulnerability assessment. This repository contains production-ready flows for integrating with various security tools and platforms.
- FortiGate - Firewall device configuration export and management
- Tenable/Nessus - Vulnerability scan results synchronization
- DefectDojo - Vulnerability management and risk acceptance workflows
- Azure Entra ID - User and group management automation
- LDAP - Directory services integration with proxy support
- Citrix - Load balancer and application delivery controller management
- Database Operations - Automated table initialization and data synchronization
- Asset Management - Comprehensive company asset discovery and tracking
- DNS Management - Internal DNS record management and synchronization
- Risk Management - Automated risk acceptance and severity updates
- Data Export - Excel and Nessus format exports with progress tracking
- Python 3.9 or higher
- Prefect 3.4.3+
- PostgreSQL database
- Access to security tools and APIs
-
Clone the repository
git clone <repository-url> cd prefect-worker
-
Create and activate virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure Prefect blocks and variables
prefect block register --file .\lib\block\file.py
This project requires several Prefect blocks to be configured:
SqlAlchemyConnector
- PostgreSQL connection for data storage
MinIOCredentials
- S3-compatible storage for artifactsS3Bucket
- Storage bucket configuration
TenableHostCredentials
- Nessus scanner accessFortigateCredentials
- FortiGate device managementDefectDojoCredentials
- DefectDojo API accessAzureAppCredentials
- Microsoft Entra ID integrationLDAPCredentials
- Directory services accessNitroCredentials
- Citrix NetScaler management
Configure the following Prefect variables for your deployments:
{
"ldap_list": [
"ldap-example",
"ldap-test"
],
"azure_creds": "entra-app",
"socks_filter": {
"host": "127.0.0.1",
"port": "9999",
"domains": [
"example.local",
"test.local"
]
}
}
{
"credentials": "defectdojo-info",
"product_name": "Nerdy",
"invicti_eng_id": 57
}
{
"engagements": [
58,
60,
61
],
"accepted_vuln_ids": [
{
"name": "ssl_medium_strength_cipher_suites_supported",
"plugin_id": 42873,
"new_severity": "Medium",
"old_severity": "High"
},
{
"name": "ssl_version_2_and_3_protocol_detection",
"plugin_id": 20007,
"new_severity": "Medium",
"old_severity": "Critical"
}
]
}
{
"devices": [
"fortigate-test",
"fortigate-example"
]
}
{
"devices": [
"citrix-test",
"citrix-example"
]
}
{
"timediff": 7,
"scan_type": "Tenable Scan",
"scanner_list": [
"secops-test",
"secops-example"
],
"tenablesc_info": "secops-tenable-sc"
}
{
"engagements": [
58,
60,
61
],
"accepted_vuln_ids": {
"ssl_self-signed_certificate": 57582,
"hsts_missing_from_https_server": 142960,
"ssl_certificate_cannot_be_trusted": 51192,
"ssl_certificate_with_wrong_hostname": 45411,
"ssl_certificate_signed_using_weak_hashing_algorithm": 35291,
"web_application_potentially_vulnerable_to_clickjacking": 85582
}
}
-
Start Prefect server
prefect server start
-
Run individual flows
# Database initialization python main.py db_init # Export FortiGate devices python main.py export_fortigate_devices_flow # Sync Nessus results python main.py export_nessus_results_flow
Use the provided prefect.yaml
configuration:
# Deploy all flows
prefect deploy
# Deploy specific flow
prefect deploy --name export_fortigate_devices
Deployment | Description | Tags |
---|---|---|
export_fortigate_devices |
Export FortiGate device configurations | fortigate , postgres , export |
export_nessus_results |
Sync Nessus scan results to DefectDojo | appsec , defectdojo , nessus |
export_company_assets |
Export LDAP & Entra ID data | audit , ldap , entra |
export_citrix_devices |
Export Citrix device configurations | audit , citrix , loadbalancer |
export_internal_dns_records |
Export internal DNS records | audit , dns , intranet |
dd_risk_acceptance |
DefectDojo risk acceptance automation | appsec , defectdojo , risk |
dd_update_finding_severity |
Update finding severity levels | appsec , defectdojo , severity |
dd_update_invicti_titles |
Update Invicti test titles | appsec , defectdojo , invicti |
prefect-worker/
βββ main.py # Main flow definitions
βββ prefect.yaml # Deployment configuration
βββ requirements.txt # Python dependencies
βββ lib/
β βββ block/ # Prefect block definitions
β β βββ azure.py # Azure Entra ID integration
β β βββ defectdojo.py # DefectDojo API client
β β βββ fortigate.py # FortiGate API client
β β βββ ldap.py # LDAP directory services
β β βββ nitro.py # Citrix NetScaler API
β β βββ tenable.py # Tenable/Nessus integration
β βββ model/ # Data models and business logic
β β βββ fortigate.py # FortiGate data models
β β βββ nessus.py # Nessus scan models
β βββ deployments/ # Deployment utilities
β βββ utils.py # Common utilities
βββ static/ # Static assets (logos)
from main import export_fortigate_devices_flow
# Export device configurations
devices = {
"devices": [
{"name": "fw-primary", "host": "192.168.1.1"},
{"name": "fw-secondary", "host": "192.168.1.2"}
]
}
export_fortigate_devices_flow(devices)
from main import export_nessus_results_flow
# Sync scan results to DefectDojo
defectdojo_info = {
"credentials": "defectdojo-prod",
"product_name": "Web Application",
"invicti_eng_id": 123
}
nessus_list = {
"scanner_list": ["nessus-scanner-1", "nessus-scanner-2"],
"tenablesc_info": "tenablesc-prod",
"scan_type": "Nessus Scan",
"timediff": 24
}
export_nessus_results_flow(defectdojo_info, nessus_list)
- Progress Tracking - Real-time progress artifacts for long-running operations
- Link Artifacts - Direct links to exported files and reports
- Structured Logging - Comprehensive logging with Prefect's built-in observability
- Flow Monitoring - Monitor flow runs through Prefect UI or Cloud
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Prefect Documentation
- Prefect GitHub Repository
- DefectDojo Documentation
- FortiGate API Documentation
- Tenable API Documentation
For support and questions:
- Open an issue in this repository
- Check the Prefect Community
- Review the Prefect Documentation
Built with β€οΈ using Prefect