-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLASHPOINT] Deprecate malware and APT mport options #2874
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e1e9862
refacto: deprecate apt and malware import feature
flavienSindou 98167ca
fix: remove unused/not implemented config vars
flavienSindou 3f44a6b
doc: add readme
flavienSindou 6bc05d5
style
flavienSindou 5c92aea
style
flavienSindou e1cf344
Update external-import/flashpoint/src/flashpoint.py
flavienSindou 031e31b
Update external-import/flashpoint/src/flashpoint.py
flavienSindou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
# OpenCTI Flashpoint Connector | ||
|
||
This connector integrates Flashpoint with the OpenCTI platform. It pulls various threat intelligence data from Flashpoint and imports it into OpenCTI, providing enhanced visibility into security threats. | ||
|
||
See [Flashpoint API Documentation](https://flashpoint.io/resources/datasheets/ignite-platform-datasheet/) for more details. | ||
|
||
## Table of Contents | ||
|
||
- [Introduction](#introduction) | ||
- [Installation](#installation) | ||
- [Requirements](#requirements) | ||
- [Configuration variables](#configuration-variables) | ||
- [OpenCTI environment variables](#opencti-environment-variables) | ||
- [Base connector environment variables](#base-connector-environment-variables) | ||
- [Connector extra parameters environment variables](#connector-extra-parameters-environment-variables) | ||
- [Deployment](#deployment) | ||
- [Docker Deployment](#docker-deployment) | ||
- [Manual Deployment](#manual-deployment) | ||
- [Usage](#usage) | ||
- [Behavior](#behavior) | ||
- [Debugging](#debugging) | ||
- [Additional information](#additional-information) | ||
|
||
## Introduction | ||
|
||
The Flashpoint Connector for OpenCTI imports threat intelligence data from Flashpoint and maps it to relevant entities in the OpenCTI ecosystem. This includes alerts, indicators, malware reports, vulnerabilities, and other intelligence, enhancing threat detection and response capabilities. | ||
|
||
## Installation | ||
|
||
### Requirements | ||
|
||
- OpenCTI Platform >= 6.x | ||
- Flashpoint API access (API key required) | ||
|
||
## Configuration variables | ||
|
||
The configuration variables for the connector can be set in `docker-compose.yml` for Docker deployments or `config.yml` for manual deployments. | ||
|
||
### OpenCTI environment variables | ||
|
||
| Parameter | config.yml | Docker environment variable | Mandatory | Description | | ||
|---------------|------------|-----------------------------|-----------|------------------------------------------------------| | ||
| OpenCTI URL | url | `OPENCTI_URL` | Yes | The URL of the OpenCTI platform. | | ||
| OpenCTI Token | token | `OPENCTI_TOKEN` | Yes | The default admin token set in the OpenCTI platform. | | ||
|
||
### Base connector environment variables | ||
|
||
| Parameter | config.yml | Docker environment variable | Default | Mandatory | Description | | ||
|-----------------|------------|-----------------------------|-----------------|-----------|----------------------------------------------------------------------------------| | ||
| Connector ID | id | `CONNECTOR_ID` | / | Yes | A unique `UUIDv4` identifier for this connector instance. | | ||
| Connector Type | type | `CONNECTOR_TYPE` | EXTERNAL_IMPORT | Yes | Should always be set to `EXTERNAL_IMPORT` for this connector. | | ||
| Connector Name | name | `CONNECTOR_NAME` | | Yes | Name of the connector. | | ||
| Connector Scope | scope | `CONNECTOR_SCOPE` | flashpoint | Yes | The scope or type of data the connector is importing (e.g., flashpoint). | | ||
| Log Level | log_level | `CONNECTOR_LOG_LEVEL` | info | Yes | Determines the verbosity of the logs. Options: `debug`, `info`, `warn`, `error`. | | ||
|
||
### Connector extra parameters environment variables | ||
|
||
| Parameter | config.yml | Docker environment variable | Default | Mandatory | Description | | ||
|---------------------------------|--------------------------------|-------------------------------------|---------------|-----------|-----------------------------------------------------------| | ||
| API base URL | api_base_url | `FLASHPOINT_API_BASE_URL` | https://api.flashpoint.io | Yes | Base URL for the Flashpoint API. | | ||
| API access key | api_access_key | `FLASHPOINT_API_KEY` | | Yes | Flashpoint API access key. | | ||
| Import interval (minutes) | interval | `FLASHPOINT_INTERVAL` | 5 | No | Interval (in minutes) to import data from Flashpoint. | | ||
| Import start date | import_start_date | `FLASHPOINT_IMPORT_START_DATE` | | No | The date from which to start importing data. | | ||
| Import reports | import_reports | `FLASHPOINT_IMPORT_REPORTS` | true | No | Import reports from Flashpoint. | | ||
| Import indicators | import_indicators | `FLASHPOINT_IMPORT_INDICATORS` | true | No | Import indicators of compromise (IoCs). | | ||
| Import communities | import_communities | `FLASHPOINT_IMPORT_COMMUNITIES` | false | No | Import community data. | | ||
| Communities queries | communities_queries | `FLASHPOINT_COMMUNITIES_QUERIES` | "" | No | Comma-separated list of community queries to execute. | | ||
| Import alerts | import_alerts | `FLASHPOINT_IMPORT_ALERTS` | true | No | Import alert data from Flashpoint. | | ||
| Indicators in reports | indicators_in_reports | `FLASHPOINT_INDICATORS_IN_REPORTS` | false | No | Include indicators in the reports imported from MispFeed. | | ||
|
||
## Deployment | ||
|
||
### Docker Deployment | ||
|
||
Before building the Docker container, ensure you have set the version of `pycti` in `requirements.txt` to match the version of OpenCTI you are running. For example, `pycti==6.3.8`. Failing to do so may result in initialization issues. | ||
|
||
Build a Docker Image using the provided `Dockerfile`. | ||
|
||
Example: | ||
|
||
```shell | ||
# Replace the IMAGE NAME with the appropriate value | ||
docker build . -t [IMAGE NAME]:latest | ||
``` | ||
|
||
Make sure to replace the environment variables in docker-compose.yml with the appropriate configurations for your environment. Then, start the docker container with the provided docker-compose.yml. | ||
|
||
```shell | ||
docker compose up -d | ||
``` | ||
|
||
### Manual Deployment | ||
Create a file config.yml based on the provided config.yml.sample. | ||
|
||
Replace the configuration variables (especially the "ChangeMe" variables) with the appropriate configurations for your environment. | ||
|
||
Install the required Python dependencies (preferably in a virtual environment): | ||
|
||
```shell | ||
pip install -r requirements.txt | ||
``` | ||
|
||
Then, start the connector from the /src directory: | ||
```shell | ||
python flashpoint.py | ||
``` | ||
|
||
## Usage | ||
After installation, the connector requires minimal interaction and should update automatically at a regular interval specified in your docker-compose.yml or config.yml under FLASHPOINT_INTERVAL. | ||
|
||
To force an immediate download of a new batch of entities, navigate to: | ||
|
||
Data management -> Ingestion -> Connectors in the OpenCTI platform. | ||
|
||
Find the connector and click on the refresh button to reset the connector's state and force a new download of data by re-running the connector. | ||
|
||
## Behavior | ||
|
||
### Mapping details | ||
|
||
Reports | ||
```mermaid | ||
graph LR | ||
subgraph Flashpoint | ||
direction TB | ||
FlashpointReport[Reports] | ||
|
||
end | ||
|
||
subgraph OpenCTI | ||
direction LR | ||
OpenCTIReport[STIX Report] | ||
OpenCTIThreatActor[STIX Threat Actor] | ||
OpenCTIIntrusionSet[STIX Intrusion Set] | ||
OpenCTIMalware[STIX Malware] | ||
OpenCTIAttackPattern[STIX Attack Pattern] | ||
OpenCTICountry[STIX Country] | ||
OpenCTIRegion[STIX Region] | ||
OpenCTISector[STIX Sector] | ||
OpenCTITool[STIX Tool] | ||
OpenCTIExternalReference[STIX External Reference] | ||
end | ||
|
||
%% Relationships | ||
FlashpointReport --> OpenCTIReport --> OpenCTIExternalReference | ||
|
||
|
||
%% Relationships to reports | ||
OpenCTIReport -- references --> OpenCTIAttackPattern | ||
OpenCTIAttackPattern -- uses --> OpenCTIIntrusionSet & OpenCTIThreatActor & OpenCTIMalware | ||
OpenCTIIntrusionSet & OpenCTIThreatActor -- uses --> OpenCTIMalware | ||
OpenCTIIntrusionSet & OpenCTIThreatActor -- uses --> OpenCTITool | ||
OpenCTIIntrusionSet & OpenCTIThreatActor & OpenCTIMalware -- targets --> OpenCTICountry & OpenCTIRegion & OpenCTISector | ||
|
||
``` | ||
|
||
Communities | ||
|
||
```mermaid | ||
graph LR | ||
subgraph Flashpoint | ||
direction TB | ||
FlashpointCommunity[Communities] | ||
end | ||
|
||
subgraph OpenCTI | ||
direction LR | ||
OpenCTIChannel[Custom Channel] | ||
OpenCTIMediaContent[Custom Media Content] | ||
OpenCTIExternalReference[STIX External Reference] | ||
end | ||
|
||
%% Relationships | ||
FlashpointCommunity --> OpenCTIChannel --> OpenCTIExternalReference | ||
|
||
%% Relationships to communities | ||
OpenCTIChannel -- publishes --> OpenCTIMediaContent | ||
``` | ||
|
||
Alerts | ||
```mermaid | ||
graph LR | ||
subgraph Flashpoint | ||
direction TB | ||
FlashpointAlert[Alerts] | ||
end | ||
|
||
subgraph OpenCTI | ||
direction LR | ||
OpenCTIIncident[STIX Incident] | ||
OpenCTIChannel[Custom Channel] | ||
OpenCTIMediaContent[Custom Media Content] | ||
OpenCTIExternalReference[STIX External Reference] | ||
end | ||
|
||
%% Relationships | ||
FlashpointAlert --> OpenCTIIncident --> OpenCTIExternalReference | ||
|
||
%% Relationships to incidents | ||
OpenCTIIncident -- uses --> OpenCTIChannel | ||
OpenCTIChannel -- publishes --> OpenCTIMediaContent | ||
OpenCTIMediaContent -- related-to --> OpenCTIIncident | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use to_processed() to close the job, it will appear as ‘complete’ on the frontend (for _import_apt and _import_malware). However, other imports such as import_report or import_community based on the same work_id will still be in progress. This can give the impression of a ‘completed’ job when the import is still running in the background. Otherwise the very cool warning (
DeprecationWarning
) !