Skip to content

Commit

Permalink
[pan-cortex-xsoar] Create a stream intel connector (#3429)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelHassine committed Feb 14, 2025
1 parent b022181 commit b513b96
Show file tree
Hide file tree
Showing 10 changed files with 569 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .circleci/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ images:
python: python3-11
stream_harfanglab:
python: python3-11
stream_pan-cortex-xsoar-intel:
python: python3-11
external-import_harfanglab-incidents:
python: python3-11
internal-import-file_import-file-stix:
Expand Down
4 changes: 4 additions & 0 deletions stream/pan-cortex-xsoar-intel/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/config.yml
src/__pycache__
src/logs
src/*.gql
4 changes: 4 additions & 0 deletions stream/pan-cortex-xsoar-intel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config.yml
__pycache__
logs
*.gql
18 changes: 18 additions & 0 deletions stream/pan-cortex-xsoar-intel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.11-alpine
ENV CONNECTOR_TYPE=STREAM

# Copy the worker
COPY src /opt/opencti-connector-pan-cortex-xsoar-intel

# Install Python modules
# hadolint ignore=DL3003
RUN apk --no-cache add git build-base libmagic libffi-dev libxml2-dev libxslt-dev

RUN cd /opt/opencti-connector-pan-cortex-xsoar-intel && \
pip3 install --no-cache-dir -r requirements.txt && \
apk del git build-base

# Expose and entrypoint
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
25 changes: 25 additions & 0 deletions stream/pan-cortex-xsoar-intel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# OpenCTI PAN Cortex XSOAR intel

This connector allows organizations to push indicators to PAN Cortex XSOAR.

## Installation

### Configuration

| Parameter | Docker envvar | Mandatory | Description |
|-----------------------------------------|-----------------------------------------| --------- |-----------------------------------------------------------------------------------------------|
| `opencti_url` | `OPENCTI_URL` | Yes | The URL of the OpenCTI platform. |
| `opencti_token` | `OPENCTI_TOKEN` | Yes | The default admin token configured in the OpenCTI platform parameters file. |
| `connector_id` | `CONNECTOR_ID` | Yes | A valid arbitrary `UUIDv4` that must be unique for this connector. |
| `connector_name` | `CONNECTOR_NAME` | Yes | The name of the XSOAR instance, to identify it if you have multiple XSOAR connectors. |
| `connector_scope` | `CONNECTOR_SCOPE` | Yes | Must be `xsoar`, not used in this connector. |
| `connector_confidence_level` | `CONNECTOR_CONFIDENCE_LEVEL` | Yes | The default confidence level for created sightings (a number between 1 and 4). |
| `connector_log_level` | `CONNECTOR_LOG_LEVEL` | Yes | The log level for this connector, could be `debug`, `info`, `warn` or `error` (less verbose). |
| `connector_live_stream_id` | `CONNECTOR_LIVE_STREAM_ID` | Yes | The Live Stream ID of the stream created in the OpenCTI interface. |
| `connector_live_stream_start_timestamp` | `CONNECTOR_LIVE_STREAM_START_TIMESTAMP` | No | Start timestamp used on connector first start. |
| `xsoar_url` | `XSOAR_URL` | Yes | The XSOAR API URL (generally prefixed with "api-" in PAN cloud) |
| `xsoar_key_id` | `XSOAR_KEY_ID` | Yes | The XSOAR key ID |
| `xsoar_key` | `XSOAR_KEY` | Yes | The XSOAR key |
| `metrics_enable` | `METRICS_ENABLE` | No | Whether or not Prometheus metrics should be enabled. |
| `metrics_addr` | `METRICS_ADDR` | No | Bind IP address to use for metrics endpoint. |
| `metrics_port` | `METRICS_PORT` | No | Port to use for metrics endpoint. |
19 changes: 19 additions & 0 deletions stream/pan-cortex-xsoar-intel/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3"
services:
connector-pan-cortex-xsoar-intel:
image: opencti/connector-pan-cortex-xsoar-intel:6.5.1
environment:
- OPENCTI_URL=http://localhost
- OPENCTI_TOKEN=ChangeMe
- CONNECTOR_ID=ChangeMe
- CONNECTOR_LIVE_STREAM_ID=live # ID of the live stream created in the OpenCTI UI
- CONNECTOR_LIVE_STREAM_LISTEN_DELETE=true
- CONNECTOR_LIVE_STREAM_NO_DEPENDENCIES=true
- "CONNECTOR_NAME=PAN Cortex XSOAR Intel"
- CONNECTOR_SCOPE=xsoar
- CONNECTOR_CONFIDENCE_LEVEL=80 # From 0 (Unknown) to 100 (Fully trusted)
- CONNECTOR_LOG_LEVEL=error
- XSOAR_URL=https://xsoar.changeme.com
- XSOAR_KEY_ID=ChangeMe
- XSOAR_KEY=ChangeMe
restart: always
7 changes: 7 additions & 0 deletions stream/pan-cortex-xsoar-intel/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Go to the right directory
cd /opt/opencti-connector-pan-cortex-xsoar-intel

# Launch the worker
python3 pan-cortex-xsoar-intel.py
24 changes: 24 additions & 0 deletions stream/pan-cortex-xsoar-intel/src/config.yml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
opencti:
url: 'http://localhost:8080'
token: 'ChangeMe'

connector:
id: 'ChangeMe'
type: 'STREAM'
live_stream_id: 'live' # ID of the live stream created in the OpenCTI UI
live_stream_listen_delete: true
live_stream_no_dependencies: true
name: 'PAN Cortex XSOAR Intel'
scope: 'xsoar' # Reserved
log_level: 'info'
consumer_count: 5 # number of consumer/worker used to push data to splunk

xsoar:
url: 'https://xsoar.changeme.com'
key_id: 'ChangeMe'
key: 'ChangeMe'

metrics:
enable: true # set to true to expose prometheus metrics
port: 9113 # port on which metrics should be exposed
addr: 0.0.0.0 # ip on which metrics should be exposed
Loading

0 comments on commit b513b96

Please sign in to comment.