How-to guide

Run an integration without XTM Composer

Run an OpenCTI connector or an OpenAEV collector or injector yourself, with Docker Compose or Python, with its own token and network access.

OpenCTIOpenAEVFor platform engineers

This page runs an integration yourself, without XTM Composer: as a Docker Compose service next to the XTM stack, or as a Python program. Use it for an integration that is not in the catalog, or a platform without Enterprise Edition. Read How integrations run first for what an integration needs from its platform.

YOU RUN ITPLATFORMSQUEUESDocker Compose serviceOn the xtm_default networkPython programSettings in config.ymlOpenCTIhttp://opencti:8080OpenAEVhttp://openaev:8080RabbitMQOr MQ_HOST, MQ_PORT to override
  1. Docker Compose service → OpenCTI: URL, token, ID
  2. Docker Compose service → OpenAEV: URL, token, ID
  3. Python program → OpenCTI: same settings
  4. Python program → OpenAEV: same settings
  5. Docker Compose service → RabbitMQ: address from platform
  6. Python program → RabbitMQ: address from platform
An integration you run yourself registers with its platform with its own token and identifier, and reaches RabbitMQ at the address the platform gives it

Before you start

  • The platform running: OpenCTI, OpenAEV or both.
  • The name of the integration and the settings it needs: each one documents them in the README.md of its folder, in the repositories OpenCTI-Platform/connectors, OpenAEV-Platform/collectors and OpenAEV-Platform/injectors.
  • Network access from where the integration runs to the platform URL and to RabbitMQ, at the host and port the platform gives out. In the XTM stack, both are on the xtm_default network.

Create a token

OpenCTI

Run each connector with its own user, so you can tell what each one wrote and limit what it can do. OpenCTI has a Connectors group for them.

Connector typeGroup of its userWhy
EXTERNAL_IMPORT, INTERNAL_ENRICHMENT, INTERNAL_IMPORT_FILE, STREAMConnectorsIt imports, enriches or reads the stream as its own user
INTERNAL_EXPORT_FILEA group with an Administrator role that bypasses capabilitiesIt exports with the rights of the user who asked for the export, which it impersonates
  1. In Settings, then Security, then Users, create a user named after the connector, such as [C] MISP.
  2. Add it to the Connectors group, or the administrator group for an export connector.
  3. Create an API token for it and copy it: it is the OPENCTI_TOKEN of the connector.

A connector can also create its own user. With CONNECTOR_AUTO_CREATE_SERVICE_ACCOUNT=true, it creates a service account named [C] <CONNECTOR_NAME> in the Connectors group, then runs with a token of that account. Its OPENCTI_TOKEN must then be allowed to create users. CONNECTOR_AUTO_CREATE_SERVICE_ACCOUNT_CONFIDENCE_LEVEL sets its confidence level, 50 by default. xtm-docker starts its datasets and MITRE ATT&CK connectors this way.

OpenAEV

Collectors and injectors can share a token: use the admin token of OpenAEV (OPENAEV_ADMIN_TOKEN in the .env of xtm-docker) or the token of another administrator account. One account per integration is not needed.

With multi-tenancy, an Enterprise Edition feature, also set OPENAEV_TENANT_ID to the UUID of the tenant.

Each integration also needs a unique identifier, a UUIDv4, as CONNECTOR_ID, COLLECTOR_ID or INJECTOR_ID. Generate one per integration and keep it: the platform recognizes the integration by it.

python3 -c 'import uuid; print(uuid.uuid4())'

Beside its URL, token, identifier and name, an OpenCTI connector reads a few settings that every connector shares. The README.md of the connector says which ones it needs.

VariableDefaultWhat it sets
CONNECTOR_TYPESet by most imagesThe kind of connector, such as EXTERNAL_IMPORT, INTERNAL_ENRICHMENT or STREAM. Set it when the docker-compose.yml of the connector does
CONNECTOR_SCOPEnot-applicableWhat the connector handles: entity types for an enrichment connector, such as IPv4-Addr,Domain-Name, or MIME types for a file import connector, such as application/pdf
CONNECTOR_AUTOfalsetrue makes an enrichment or file import connector run on its own on what enters its scope, instead of on request
CONNECTOR_LOG_LEVELerrordebug, info, warn or error

Run it with Docker Compose

This example runs the MITRE ATT&CK connector of OpenCTI in its own Compose project, attached to the network of the XTM stack. xtm-docker already runs this connector, as its connector-mitre service: for another integration, change the image and the variables its README.md lists.

  1. Create a folder for the integration with its secrets.

    mkdir connector-mitre && cd connector-mitre
    cat > .env <<EOF
    INTEGRATION_ID=$(python3 -c 'import uuid; print(uuid.uuid4())')
    INTEGRATION_TOKEN=your-integration-token
    EOF
    chmod 600 .env
    

    Replace your-integration-token with the token of Create a token.

  2. Write docker-compose.yml. The default network is the one of the XTM stack, xtm_default with the default COMPOSE_PROJECT_NAME=xtm, so the integration reaches opencti and rabbitmq by name.

    OpenCTI connector
    services:
      connector-mitre:
        image: opencti/connector-mitre:latest
        environment:
          - OPENCTI_URL=http://opencti:8080
          - OPENCTI_TOKEN=${INTEGRATION_TOKEN}
          - CONNECTOR_ID=${INTEGRATION_ID}
          - CONNECTOR_NAME=MITRE ATT&CK
          - CONNECTOR_LOG_LEVEL=error
        restart: always
    networks:
      default:
        external: true
        name: xtm_default
    
    OpenAEV injector
    services:
      injector-nmap:
        image: openaev/injector-nmap:latest
        environment:
          - OPENAEV_URL=http://openaev:8080
          - OPENAEV_TOKEN=${INTEGRATION_TOKEN}
          - INJECTOR_ID=${INTEGRATION_ID}
          - INJECTOR_NAME=Nmap
        restart: always
    networks:
      default:
        external: true
        name: xtm_default
    
  3. Start it.

    docker compose up -d
    
    Check that it worked
    docker compose logs --tail 20
    

    The logs show the integration registering with the platform and no connection error. It appears in Integrations, Deployed tab (Data, then Ingestion, then Connectors before 7.260811) in OpenCTI, or in Integrations > Collectors or Injectors in OpenAEV.

To add the integration to the Compose project of the platform instead, add the same service to its docker-compose.override.yml with OPENCTI_URL=http://opencti:8080, without the networks block, and with the values of INTEGRATION_ID and INTEGRATION_TOKEN in place of the variables: see Change the stack without editing docker-compose.yml. A separate project keeps the integration and its secrets apart from the stack.

Each integration folder of the repositories also has its own docker-compose.yml to start from. To use the files of one release, such as OpenCTI 7.261030.1:

wget https://github.com/OpenCTI-Platform/connectors/archive/refs/tags/7.261030.1.zip
unzip 7.261030.1.zip
cd connectors-7.261030.1/external-import/mitre

The OpenAEV repositories are tagged with the OpenAEV version, such as 3.261029.0, with one folder per integration at their root, such as nmap or mitre-attack.

Run it with Python

Without Docker, an integration runs as a Python program with the same settings, written in a config.yml file instead of environment variables.

  1. Install Python 3 and pip.

    sudo apt install python3 python3-pip
    
  2. Get the files of the release, as above, and go to the folder of the integration.

  3. Copy the sample configuration to config.yml and fill it: opencti.url and opencti.token, or openaev.url and openaev.token, and the connector, collector or injector block with its id and name.

  4. Install the dependencies and start the program as the README.md of the integration says. OpenCTI connectors use a requirements.txt in their src folder, for example pip3 install -r requirements.txt then python3 -m __main__ for MITRE ATT&CK. OpenAEV collectors and injectors use Poetry.

Networking

An integration reaches RabbitMQ at the host name and port that the platform gives it when it registers: the RabbitMQ settings of the platform. From another network, that name may not resolve.

Override the RabbitMQ address

Give the connector the address and credentials it must use instead, with these variables or the mq block of config.yml:

Variableconfig.yml key
MQ_HOSTmq.host
MQ_PORTmq.port
MQ_VHOSTmq.vhost
MQ_USE_SSLmq.use_ssl
MQ_USERmq.user
MQ_PASSmq.pass

These variables are read by OpenCTI connectors.

Use HTTP instead of RabbitMQ (OpenCTI)

An OpenCTI connector can skip RabbitMQ entirely.

  • CONNECTOR_QUEUE_PROTOCOL=api sends the bundles it produces to the OpenCTI API over HTTP instead of RabbitMQ (amqp, the default). It applies to import, enrichment and file import connectors. OpenCTI refuses a request larger than app:max_payload_body_size (APP__MAX_PAYLOAD_BODY_SIZE), 50mb by default: raise it on the platform for a connector that sends large bundles.
  • CONNECTOR_LISTEN_PROTOCOL=api makes the connector receive its jobs over HTTP: it starts an HTTP server, and the OpenCTI workers call it. It applies to enrichment and export connectors.

New in 7.261119 When the platform runs with app:http:secure_by_default (APP__HTTP__SECURE_BY_DEFAULT) set to true, an unset app:max_payload_body_size is 10mb instead: set it on the platform before you send large bundles over HTTP. See Secure HTTP defaults.

VariableDefaultWhat it sets
CONNECTOR_LISTEN_PROTOCOL_API_PORT7070The port of the HTTP server
CONNECTOR_LISTEN_PROTOCOL_API_PATH/api/callbackThe path the workers call
CONNECTOR_LISTEN_PROTOCOL_API_URIhttp://127.0.0.1:7070The URL, without the path, at which the workers reach the connector
CONNECTOR_LISTEN_PROTOCOL_API_SSLfalsetrue to serve HTTPS, with LISTEN_PROTOCOL_API_SSL_KEY, LISTEN_PROTOCOL_API_SSL_CERT and LISTEN_PROTOCOL_API_SSL_PASSPHRASE

An enrichment connector with both set never connects to RabbitMQ. Set CONNECTOR_LISTEN_PROTOCOL_API_URI to an address the workers can reach, such as http://connector-enrichment:7070 on the network of the stack.

The workers make these calls. Three settings of the worker service shape them:

Worker variableDefaultWhat it sets
WORKER_LISTEN_API_SSL_VERIFYfalsetrue makes the workers check the certificate of a connector that serves HTTPS
WORKER_LISTEN_API_HTTP_PROXYA proxy for the calls to http:// connectors
WORKER_LISTEN_API_HTTPS_PROXYA proxy for the calls to https:// connectors

Check that it works

The platform lists the integration with its status: Integrations, Deployed tab (Data, then Ingestion, then Connectors before 7.260811) in OpenCTI, with the messages waiting in its queue; Integrations > Collectors or Integrations > Injectors in OpenAEV. An integration that does not appear has not registered: read its logs for the platform URL or the token it could not use.

What's next

NextRun integrations behind a proxy
Deploy
Install, configure, secure, scale and upgrade the platform.

Published

Overview
Run the XTM platform locally
OverviewDeploy with an AI agent