Configure the shared services
Size and connect the search engine, Redis, RabbitMQ, S3 storage, PostgreSQL and mail server that the XTM modules share, or point them to your own.
This page covers the services the XTM modules share: the search engine, Redis, RabbitMQ, S3 object storage, PostgreSQL and the mail server. For each one it says which module uses it, what xtm-docker sets, the settings you decide on to replace the bundled container with your own service, such as a managed cluster, to secure and to size it, and what to watch. Every other key is in the generated references: OpenCTI configuration and OpenAEV configuration.
Before you start
- The stack installed as Install with Docker Compose describes. The settings below go in
.envor in theenvironmentof a service indocker-compose.override.yml: see Change the stack without editing docker-compose.yml. - How each platform names its settings in the environment:
- OpenCTI: two underscores per level of
default.json.elasticsearch:urlbecomesELASTICSEARCH__URL. - OpenAEV: one underscore per dot of the Spring property, hyphens kept.
openaev.rabbitmq.queue-typebecomesOPENAEV_RABBITMQ_QUEUE-TYPE. - XTM One: the variable names of its own configuration, such as
REDIS_URL.
- OpenCTI: two underscores per level of
Who uses which service
- OpenCTI → Elasticsearch
- OpenCTI → RabbitMQ
- OpenCTI → Redis
- OpenCTI → S3 object storage
- OpenAEV → Elasticsearch
- OpenAEV → RabbitMQ
- OpenAEV → S3 object storage
- OpenAEV → PostgreSQL
- XTM One → Redis
- XTM One → S3 object storage
- XTM One → PostgreSQL
| Service | Service in xtm-docker | Image | Used by | Compose file |
|---|---|---|---|---|
| Elasticsearch | elasticsearch | elasticsearch:8.19.23 | OpenCTI, OpenAEV | infra/elasticsearch.yml |
| RabbitMQ | rabbitmq | rabbitmq:4.3-management | OpenCTI, OpenAEV | infra/rabbitmq.yml |
| Redis | redis | redis:8.8.3 | OpenCTI, XTM One | infra/redis.yml |
| S3 object storage | minio | rustfs/rustfs:1.0.4 (RustFS) | OpenCTI, OpenAEV, OpenCRQ, XTM One | infra/rustfs.yml |
| PostgreSQL with pgvector | pgsql | pgvector/pgvector:pg17 | OpenAEV, OpenCRQ, XTM One | infra/postgresql.yml |
Every shared service starts with the whole stack, as docker-compose.yml includes the five Compose files of infra/.
Each module keeps its data apart in the shared services: its own index prefix in Elasticsearch, its own bucket in S3, its own database in PostgreSQL. You can therefore replace one shared service by your own for every module at once, or for one module only.
To point a module to your own service, set its variables below on the module's service in docker-compose.override.yml, and remove the bundled service from the depends_on list of that module with !reset null. When no module depends on the bundled service any more, give it a profile you never turn on, such as disabled, or Docker Compose keeps starting it, then remove its container with docker compose rm -sf <service>. For example, for an Elasticsearch cluster of your own used by OpenCTI and OpenAEV:
services:
opencti:
environment:
- ELASTICSEARCH__URL=https://search.example.com:9200
depends_on:
elasticsearch: !reset null
openaev:
environment:
- ENGINE_URL=https://search.example.com:9200
- SPRING_ELASTICSEARCH_URIS=https://search.example.com:9200
depends_on:
elasticsearch: !reset null
elasticsearch:
profiles: !override ["disabled"]
Elasticsearch or OpenSearch
The bundled elasticsearch service is one node, with security turned off (xpack.security.enabled=false): no user, no TLS. Keep it for one host on a private network; in production, use a cluster with authentication.
-
Size the Java heap.
ELASTIC_MEMORY_SIZEin.envsets both-Xmsand-Xmxof the bundled node.RAM of the host ELASTIC_MEMORY_SIZE16 GB 2G32 GB 4G64 GB or more 8G -
On a Linux host, raise the number of memory maps Elasticsearch may use, or it can fail to start.
sudo sysctl -w vm.max_map_count=262144To keep the value after a reboot, add
vm.max_map_count=262144to/etc/sysctl.conf. -
To use your own cluster, set its address and credentials on each platform.
OpenCTIVariable Default Set it to ELASTICSEARCH__URLhttp://localhost:9200The URL of your cluster, or a list of URLs. xtm-docker sets http://elasticsearch:9200ELASTICSEARCH__USERNAME,ELASTICSEARCH__PASSWORDThe user of OpenCTI on the cluster ELASTICSEARCH__API_KEYAn Elasticsearch API key instead of a user: the encodedvalue Elasticsearch returns when it creates the keyELASTICSEARCH__INDEX_PREFIXopenctiKeep it, unless two OpenCTI platforms share the cluster ELASTICSEARCH__NUMBER_OF_REPLICASxtm-docker sets 0, for one node. On a cluster, set the number of replicas each index needsELASTICSEARCH__PROXYThe URL of an HTTP proxy between OpenCTI and the cluster, such as http://proxy.example.com:3128. The platforms'HTTPS_PROXYsettings, in Trust your certificate authority and proxy, do not apply to the clusterOPENSEARCH__REGIONThe AWS region of an Amazon OpenSearch Service domain, such as eu-west-3. Requests are then signed with AWS credentialsOPENSEARCH__SERVICEesWith OPENSEARCH__REGION:esfor Amazon OpenSearch Service,aossfor Amazon OpenSearch ServerlessVariable Default Set it to ELASTICSEARCH__ENGINE_SELECTORautoelkfor Elasticsearch oropensearchfor OpenSearch.autodetects the engine. SetelkwithELASTICSEARCH__API_KEY, so that OpenCTI uses the Elasticsearch client from the startELASTICSEARCH__ENGINE_CHECKtrueWith elkoropensearchselected, OpenCTI refuses to start when the engine it detects is the other one.falseskips that checkOpenAEVVariable Default Set it to ENGINE_URLhttp://localhost:9200The URL of your cluster. xtm-docker sets http://elasticsearch:9200, and the same value inSPRING_ELASTICSEARCH_URISENGINE_USERNAME,ENGINE_PASSWORDThe user of OpenAEV on the cluster ENGINE_CLIENTautoelasticsearch8,elasticsearch9oropensearchto force the client.autodetects the engine fromENGINE_URLENGINE_ENGINE_AWS_MODEnoesfor Amazon OpenSearch Service oraossfor Amazon OpenSearch Serverless, withENGINE_ENGINE_AWS_HOST(the host, withouthttps://) andENGINE_ENGINE_AWS_REGIONOpenAEV indices start with
openaev, so OpenCTI and OpenAEV can share one cluster.With
ENGINE_ENGINE_AWS_MODE, OpenAEV signs its requests with the AWS credentials of its environment, such as the IAM role of the node or the pod it runs on. In the security settings of OpenSearch, map that IAM role as a backend role of a role allowed to manage theopenaev*indices.OpenAEV rebuilds its indices from PostgreSQL by itself: pointed to a new, empty cluster, it creates each index at start and fills it again, so nothing needs to be copied. To rebuild the indices of the current cluster, stop OpenAEV, empty the
indexing_statustable of theopenaevdatabase, and start it again. The search screens fill up again while it reindexes.engine.engine-selector, which older versions used to choose the engine, is ignored now: setENGINE_CLIENTinstead.To trust the certificate of your cluster, see Trust your certificate authority and proxy.
Size how OpenCTI uses the cluster
The defaults fit most platforms. Change them when the logs of OpenCTI show search engine timeouts or rejected requests, or when indexing fails on a limit. Index settings (shards, replicas, result window) go into the index templates of OpenCTI at each start: they apply to the indices created afterwards, at the next rollover, not to the existing ones.
| Variable | Default | Effect |
|---|---|---|
ELASTICSEARCH__NUMBER_OF_SHARDS | The engine's default | Primary shards of each new index. Rollover keeps each primary shard under 50 GB: see Manage Elasticsearch indices |
ELASTICSEARCH__REQUEST_TIMEOUT | 3600000 (ms, one hour) | Time OpenCTI waits for one request to the cluster |
ELASTICSEARCH__MAX_RETRIES | 3 | Retries of a failed request before OpenCTI returns an error |
ELASTICSEARCH__SNIFF_ON_START | false | true to discover the nodes of the cluster at start and spread requests over them. Keep false behind a load balancer, or when the nodes announce addresses OpenCTI cannot reach |
ELASTICSEARCH__MAX_BULK_OPERATIONS | 5000 | Operations in one bulk request during mass updates and migrations. Lower it if bulk requests time out or exceed the request size limit of the cluster |
ELASTICSEARCH__MAX_CONCURRENCY | 4 | Bulk requests sent in parallel during mass updates and migrations. Raise it on a large cluster to go faster, lower it to reduce the load |
ELASTICSEARCH__BATCH_LOADER_MAX_SIZE | 300 | Elements grouped into one query when an API request loads related data, such as creators and markings |
ELASTICSEARCH__DEFAULT_PAGINATION_RESULT, ELASTICSEARCH__MAX_PAGINATION_RESULT | 500, 5000 | Page size of a list query that asks for none, and the largest page size a query gets |
ELASTICSEARCH__MAX_RESULT_WINDOW | 100000 | The max_result_window of the indices: the deepest offset a search can reach |
ELASTICSEARCH__MAX_RUNTIME_RESOLUTIONS | 5000 | Entities loaded to sort a list by a computed column, such as the author. Raise it if such a sort shows Unknown on a large dataset |
ELASTICSEARCH__MAX_CONTAINER_RESOLUTIONS, ELASTICSEARCH__MAX_CONTAINER_OBJECT_RESOLUTIONS | 1000, 100000 | Containers, and objects in them, loaded to show the related containers of an entity |
ELASTICSEARCH__UNSECURE_SCRIPT_FILTER_ENABLED | false | true allows the script filter operator, which sends a raw script to the cluster. Any user who can filter can then run a script: keep false unless you trust every user |
What to watch on the cluster: the heap of each node, the rejected requests of its write and search thread pools, and the size of the shards of the opencti_* indices.
All settings: Elasticsearch.
Redis
OpenCTI keeps its event stream in Redis, among other things; XTM One uses it too. The bundled redis service has no password.
| Variable | Default | Set it to |
|---|---|---|
REDIS__HOSTNAME, REDIS__PORT | localhost, 6379 | Your Redis. xtm-docker sets redis and 6379 |
REDIS__USERNAME, REDIS__PASSWORD | The credentials of your Redis | |
REDIS__MODE | single | sentinel or cluster, with REDIS__HOSTNAMES (and REDIS__SENTINEL_MASTER_NAME in sentinel mode) |
REDIS__USE_SSL | false | true for a Redis that only accepts TLS, in single or cluster mode |
REDIS__DATABASE | 0 | The database number, in single mode only |
REDIS__NAMESPACE | A prefix for every key and channel of OpenCTI, such as cti-prod. Set it when several OpenCTI platforms share one Redis | |
REDIS__HOST_IP_FAMILY | 4 | 6 for a Redis reachable over IPv6 only, 0 for both |
REDIS__TRIMMING | 2000000 | The number of events kept in the live stream. It sizes the memory Redis needs |
REDIS__ACTIVITY_TRIMMING, REDIS__NOTIFICATION_TRIMMING | 50000, 50000 | The events kept, approximately, in the activity stream and in the notification stream. Raise the second if digests over long periods miss events |
| Variable | Default | Set it to |
|---|---|---|
REDIS_URL | redis://redis:6379 | The URL of your Redis. Set it on xtm-one and xtm-one-worker |
REDIS_PASSWORD | The password of your Redis | |
REDIS_MODE | standalone | sentinel, with REDIS_SENTINEL_HOSTS and REDIS_SENTINEL_SERVICE |
OpenCTI with Redis Sentinel
In sentinel mode, OpenCTI asks the Sentinels listed in REDIS__HOSTNAMES for the address of the master named REDIS__SENTINEL_MASTER_NAME, then connects to that master.
| Variable | Default | Set it to |
|---|---|---|
REDIS__SENTINEL_USERNAME, REDIS__SENTINEL_PASSWORD | The credentials of the Sentinels, when they ask for some. REDIS__USERNAME and REDIS__PASSWORD stay those of the master | |
REDIS__SENTINEL_ROLE | master | Keep master: OpenCTI writes to Redis. slave connects to a replica, in the order of REDIS__SENTINEL_PREFERRED_SLAVES, a list of { "ip", "port", "prio" } objects |
REDIS__SENTINEL_FAILOVER_DETECTOR | false | true to listen to the Sentinels and reconnect to the new master as soon as a failover happens, instead of when the connection to the old one fails |
REDIS__SENTINEL_UPDATE_SENTINELS | true | false to use only the Sentinels of REDIS__HOSTNAMES, when the addresses the Sentinels announce are not reachable from OpenCTI |
REDIS__SENTINEL_TLS | false | See the warning below |
In sentinel mode, OpenCTI passes no TLS settings to its Redis client: REDIS__USE_SSL, REDIS__CA and REDIS__SENTINEL_TLS do not encrypt the connections to the Sentinels or to the master. Keep them on a private network, or use single or cluster mode for TLS.
services:
opencti:
environment:
- REDIS__MODE=sentinel
- 'REDIS__HOSTNAMES=["sentinel1.example.com:26379","sentinel2.example.com:26379","sentinel3.example.com:26379"]'
- REDIS__SENTINEL_MASTER_NAME=opencti
- REDIS__SENTINEL_USERNAME=opencti
- REDIS__SENTINEL_PASSWORD=${REDIS_SENTINEL_PASSWORD}
- REDIS__USERNAME=opencti
- REDIS__PASSWORD=${REDIS_PASSWORD}
- REDIS__SENTINEL_FAILOVER_DETECTOR=true
OpenCTI with a Redis cluster
In cluster mode, OpenCTI connects to the nodes of REDIS__HOSTNAMES and learns the others from the cluster. Putting Redis in cluster mode for capacity is in Scale.
| Variable | Default | Set it to |
|---|---|---|
REDIS__NAT_MAP | When the nodes sit behind NAT or a proxy (Docker, Kubernetes, cloud) and announce addresses OpenCTI cannot reach: a JSON list of announced>reachable pairs, such as ["10.0.0.11:6379>redis-1.example.com:6379"] | |
REDIS__SCALE_READS | all | The nodes that serve reads: master, slave or all. master when a read must never miss a write a replica has not received yet |
New in 7.260811 LTS REDIS__NOTIFICATION_RANGE_BATCH_SIZE, 1000 by default, sets how many events of the notification stream the notification manager reads per request when it builds a digest. Lower it if building digests over a busy stream takes too much memory.
What to watch on Redis: its used memory against maxmemory, which the stream trimming settings above drive, and its connected clients. Each OpenCTI node opens six connections at start (five, and one for its lock process), then one more for each reader of the stream it runs: each manager that reads the stream (history, rules, notifications, playbooks, publication, activity, file indexing) and each live stream a connector or a remote platform consumes from it.
All settings: Redis.
RabbitMQ
OpenCTI and OpenAEV pass work to their workers and integrations through RabbitMQ. In xtm-docker both use the same broker and the same user, RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS from .env. OpenCTI also calls the management API, on port 15672, and so does OpenAEV when it migrates its queues: a broker of your own needs the management plugin.
| Variable | Default | Set it to |
|---|---|---|
RABBITMQ__HOSTNAME, RABBITMQ__PORT | localhost, 5672 | Your broker |
RABBITMQ__PORT_MANAGEMENT | 15672 | The port of its management API. RABBITMQ__HOSTNAME_MANAGEMENT if it has another host name |
RABBITMQ__USERNAME, RABBITMQ__PASSWORD | guest, guest | The user of OpenCTI |
RABBITMQ__VHOST | / | The virtual host of OpenCTI |
RABBITMQ__QUEUE_TYPE | classic | quorum on a cluster of brokers |
RABBITMQ__QUEUE_PREFIX | A prefix, followed by _, on the names of the exchanges and queues of OpenCTI, such as cti-prod. Set it, or a virtual host of its own, when several OpenCTI platforms share one broker | |
RABBITMQ__USE_SSL, RABBITMQ__MANAGEMENT_SSL | false, false | true for a broker, or a management API, that only accepts TLS |
RABBITMQ__USE_SSL_REJECT_UNAUTHORIZED, RABBITMQ__MANAGEMENT_SSL_REJECT_UNAUTHORIZED | off, off | true to check the certificate of the broker, or of the management API. Off by default: turn them on once OpenCTI trusts their CA, see Trust your certificate authority and proxy |
RABBITMQ__USE_SSL_CERT, RABBITMQ__USE_SSL_KEY | For a broker that asks for a client certificate: the certificate and the private key of OpenCTI, as paths in the container or PEM contents. Or RABBITMQ__USE_SSL_PFX, both in one PKCS#12 file | |
RABBITMQ__USE_SSL_PASSPHRASE | The passphrase of that private key or PKCS#12 file, when it is encrypted |
| Variable | Default | Set it to |
|---|---|---|
OPENAEV_RABBITMQ_HOSTNAME, OPENAEV_RABBITMQ_PORT | localhost, 5672 | Your broker |
OPENAEV_RABBITMQ_MANAGEMENT-PORT | 15672 | The port of its management API |
OPENAEV_RABBITMQ_USER, OPENAEV_RABBITMQ_PASS | guest, guest | The user of OpenAEV |
OPENAEV_RABBITMQ_VHOST | / | The virtual host of OpenAEV |
OPENAEV_RABBITMQ_QUEUE-TYPE | classic | quorum on a cluster of brokers |
OPENAEV_RABBITMQ_PREFIX | openaev | The prefix of the OpenAEV queues |
OPENAEV_RABBITMQ_SSL | false | true for a broker that only accepts TLS. OpenAEV then also calls the management API over HTTPS, on the host of the broker |
OPENAEV_RABBITMQ_TRUST-STORE, OPENAEV_RABBITMQ_TRUST-STORE-PASSWORD | Over TLS, a PKCS12 trust store that holds the CA of the broker's certificate, such as file:/opt/openaev/rabbitmq-truststore.p12, and its password. OpenAEV then checks the broker against this trust store only, in TLS 1.3, and the management API against this trust store or the platform's. Without it, or when the file does not exist, as with the placeholder of the shipped application.properties, OpenAEV checks both against the platform trust store: the CAs of Java and the certificates of OPENAEV_EXTRA-TRUSTED-CERTS-DIR |
Over TLS, OpenAEV always checks the certificate of the broker and of its management API: OPENAEV_RABBITMQ_MANAGEMENT-INSECURE no longer has any effect. When your internal CA signed the certificate of the broker, the simplest is to put that CA in the folder of OPENAEV_EXTRA-TRUSTED-CERTS-DIR, as Trust your certificate authority and proxy shows, and to set no RabbitMQ trust store: the broker and the management API then trust the same CAs as the other connections of OpenAEV. For a broker that asks for a client certificate, OpenAEV presents the one of the key store that the standard Java properties javax.net.ssl.keyStore, javax.net.ssl.keyStoreType and javax.net.ssl.keyStorePassword name.
For example, for a broker whose certificate the internal CA of ./certs/internal-ca.pem signed, in docker-compose.override.yml:
services:
openaev:
volumes:
- ./certs:/opt/openaev/additional_certs:ro
environment:
- OPENAEV_RABBITMQ_HOSTNAME=rabbitmq.example.com
- OPENAEV_RABBITMQ_PORT=5671
- OPENAEV_RABBITMQ_MANAGEMENT-PORT=15671
- OPENAEV_RABBITMQ_USER=openaev
- OPENAEV_RABBITMQ_PASS=${OPENAEV_RABBITMQ_PASSWORD}
- OPENAEV_RABBITMQ_SSL=true
depends_on:
rabbitmq: !reset null
Integrations connect to RabbitMQ with the host name and port their platform gives them, rabbitmq and 5672 in xtm-docker. An integration that runs where that name does not resolve cannot reach its queue. See Run an integration without XTM Composer.
OpenCTI workers and connectors get the host, port, user and RABBITMQ__USE_SSL setting of the broker from OpenCTI, not its certificates. Over TLS, they accept any certificate the broker presents until you set, on each worker and connector:
| Variable | Default | Set it to |
|---|---|---|
MQ_USE_SSL_REJECT_UNAUTHORIZED | false | true to check the certificate of the broker |
MQ_USE_SSL_CA | The CA that signed it, as a path in the container or PEM content | |
MQ_USE_SSL_CERT, MQ_USE_SSL_KEY | For a broker that asks for a client certificate: the certificate and its private key, as paths or PEM content | |
MQ_USE_SSL_PASSPHRASE | The passphrase of that private key, when it is encrypted |
What to watch on RabbitMQ: the messages ready in the push_ queues, which grow when the workers cannot keep up (add workers, see Scale), the disk and memory alarms of the broker, which block every publisher, and its free disk space.
All settings of OpenCTI: RabbitMQ.
S3 object storage
OpenCTI, OpenAEV, OpenCRQ and XTM One store their files in S3. The bundled minio service runs RustFS, an S3-compatible server, with the credentials MINIO_ROOT_USER and MINIO_ROOT_PASSWORD of .env: the service and the variables keep the names of MinIO, which the stack ran before. Each platform uses its own bucket.
| Variable | Default | Set it to |
|---|---|---|
MINIO__ENDPOINT, MINIO__PORT | localhost, 9000 | Your S3 service, such as s3.eu-west-3.amazonaws.com and 443 for AWS. With s3.amazonaws.com, the AWS SDK chooses the endpoint of the region itself |
MINIO__USE_SSL | false | true for HTTPS |
MINIO__ACCESS_KEY, MINIO__SECRET_KEY | The credentials of OpenCTI | |
MINIO__SESSION_TOKEN | The session token of temporary credentials from AWS Security Token Service (STS), with the access and secret keys. OpenCTI reads it at start and does not renew it: restart it with new credentials before they expire, or prefer MINIO__USE_AWS_ROLE | |
MINIO__BUCKET_NAME | opencti-bucket | The bucket of OpenCTI |
MINIO__BUCKET_REGION | us-east-1 | The region of the bucket on AWS |
MINIO__USE_AWS_ROLE | false | true to take the credentials from the AWS role of the host instead of the access and secret keys |
MINIO__DISABLE_CHECKSUM_VALIDATION | false | true when an S3-compatible service rejects uploads because of the checksum headers recent AWS SDKs send. OpenCTI then sends checksums only when the operation requires them |
MINIO__USE_AWS_LOGS | false | true to write the debug messages of the S3 client to the log of OpenCTI, to diagnose a connection to the bucket |
MINIO__EXCLUDED_FILES | [".DS_Store"] | The file names OpenCTI hides when it lists the files of the bucket, case-insensitive |
All settings: S3 Bucket.
| Variable | Default | Set it to |
|---|---|---|
MINIO_ENDPOINT, MINIO_PORT | localhost, 9000 | Your S3 service. On AWS, the endpoint of the bucket's region, such as s3.eu-west-3.amazonaws.com, and 443 |
MINIO_SECURE | false | true for HTTPS |
MINIO_ACCESS-KEY, MINIO_ACCESS-SECRET | The credentials of OpenAEV | |
MINIO_BUCKET | openaev | The bucket of OpenAEV, created at start when missing |
OPENAEV_S3_USE-AWS-ROLE | false | true to take the credentials from AWS Security Token Service (STS), with the IAM role of the host, instead of the access keys |
OPENAEV_S3_STS-ENDPOINT | Optional, experimental. Your own STS endpoint. Empty, OpenAEV calls https://sts.amazonaws.com, or the regional endpoint when AWS_REGION is set |
Variable in modules/xtm-one.yml | Set from .env | Set it to |
|---|---|---|
S3_ENDPOINT | Your S3 service, as host:port. xtm-docker sets minio:9000 | |
S3_USE_SSL | true for HTTPS | |
S3_ACCESS_KEY, S3_SECRET_KEY | MINIO_ROOT_USER, MINIO_ROOT_PASSWORD | The credentials of XTM One |
S3_BUCKET | XTM_ONE_S3_BUCKET, xtm-one-files by default | The bucket of XTM One. XTM One creates it at its first start |
S3_REGION | The region of the bucket, required on AWS | |
S3_USE_AWS_ROLE | true to take the credentials from the role of the host |
Set them on xtm-one and xtm-one-worker.
Variable in modules/opencrq.yml | Set from .env | Set it to |
|---|---|---|
FILE_STORAGE__ENDPOINT | The URL of your S3 service. xtm-docker sets http://minio:9000 | |
FILE_STORAGE__ACCESS_KEY, FILE_STORAGE__SECRET_KEY | MINIO_ROOT_USER, MINIO_ROOT_PASSWORD | The credentials of OpenCRQ |
FILE_STORAGE__BUCKET | OPENCRQ_S3_BUCKET, opencrq by default | The bucket of OpenCRQ. OpenCRQ never creates it: in xtm-docker, the opencrq-bucket-init job does, at every start |
FILE_STORAGE__REGION | The region of the bucket, eu-west-3 by default |
On your own S3 service, create the bucket first, and keep opencrq-bucket-init from starting, as the last step of PostgreSQL does for opencrq-db-init.
PostgreSQL
OpenAEV, OpenCRQ and XTM One share the pgsql instance, each with its own database: openaev, opencrq and xtm_one.
- OpenAEV connects with the superuser of the instance,
POSTGRES_USERandPOSTGRES_PASSWORDof.env. - XTM One connects with its own role,
XTM_ONE_POSTGRES_USERandXTM_ONE_POSTGRES_PASSWORD, which must differ from the superuser. At every start, thextm-one-db-initservice creates that role, thextm_onedatabase and thevectorextension (pgvector) that XTM One needs. Only a superuser can create that extension. - OpenCRQ connects with its own role too,
OPENCRQ_POSTGRES_USER(opencrq) andOPENCRQ_POSTGRES_PASSWORD, which must differ from the superuser and from the XTM One role. At every start, theopencrq-db-initservice creates that role, sets its password from.env, and creates theopencrqdatabase it owns. The only extension OpenCRQ creates,uuid-ossp, is a trusted one: the role needs no superuser right. SetOPENCRQ_POSTGRES_USERonce: changed after the first start, theopencrqdatabase and its tables stay owned by the old role. infra/postgresql.ymlstarts PostgreSQL withmax_connections=200: OpenAEV opens up to 20 connections, XTM One up to 35 per process, over its web processes and its worker, and OpenCRQ about 50 at peak. Keep at least this value on your own server.- It also gives the container 1 GB of shared memory (
shm_size): parallel queries pass their rows through it, and the aggregates of OpenCRQ fail past the 64 MB a container gets by default.
To use your own PostgreSQL server:
-
On your server, connect with
psqlas a superuser and create the databases, the roles of XTM One and OpenCRQ, and the extension. Use the values ofXTM_ONE_POSTGRES_USER(xtmonein.env.sample),XTM_ONE_POSTGRES_PASSWORD,OPENCRQ_POSTGRES_USER(opencrq) andOPENCRQ_POSTGRES_PASSWORDfrom.env.CREATE DATABASE openaev; CREATE ROLE opencrq LOGIN PASSWORD 'the value of OPENCRQ_POSTGRES_PASSWORD'; CREATE DATABASE opencrq OWNER opencrq; CREATE ROLE xtmone LOGIN PASSWORD 'the value of XTM_ONE_POSTGRES_PASSWORD'; CREATE DATABASE xtm_one OWNER xtmone; \connect xtm_one CREATE EXTENSION IF NOT EXISTS vector; -
Point OpenAEV to it, in the
openaevservice ofdocker-compose.override.yml. SetPOSTGRES_USERandPOSTGRES_PASSWORDin.envto a role of your server that can create extensions in theopenaevdatabase, as the superuser does in xtm-docker: OpenAEV creates thehstoreandpg_trgmextensions during its migrations.- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres.example.com:5432/openaev - SPRING_DATASOURCE_USERNAME=${POSTGRES_USER} - SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD} -
Point XTM One to it, in the
xtm-oneandxtm-one-workerservices ofdocker-compose.override.yml:- DATABASE_URL=postgresql+asyncpg://${XTM_ONE_POSTGRES_USER}:${XTM_ONE_POSTGRES_PASSWORD}@postgres.example.com:5432/xtm_one -
Point OpenCRQ to it, in the
opencrqservice ofdocker-compose.override.yml. It keeps connecting asOPENCRQ_POSTGRES_USER:- POSTGRES__HOST=postgres.example.com - POSTGRES__PORT=5432 -
Keep the
pgsql,xtm-one-db-initandopencrq-db-initservices from starting, and remove them from thedepends_onlists ofopenaev,xtm-oneandopencrq. With steps 2 to 4,docker-compose.override.ymlholds:services: openaev: environment: - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres.example.com:5432/openaev - SPRING_DATASOURCE_USERNAME=${POSTGRES_USER} - SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD} depends_on: pgsql: !reset null xtm-one: environment: - DATABASE_URL=postgresql+asyncpg://${XTM_ONE_POSTGRES_USER}:${XTM_ONE_POSTGRES_PASSWORD}@postgres.example.com:5432/xtm_one depends_on: xtm-one-db-init: !reset null xtm-one-worker: environment: - DATABASE_URL=postgresql+asyncpg://${XTM_ONE_POSTGRES_USER}:${XTM_ONE_POSTGRES_PASSWORD}@postgres.example.com:5432/xtm_one opencrq: environment: - POSTGRES__HOST=postgres.example.com - POSTGRES__PORT=5432 depends_on: opencrq-db-init: !reset null pgsql: profiles: !override ["disabled"] xtm-one-db-init: profiles: !override ["disabled"] opencrq-db-init: profiles: !override ["disabled"]If they ran, remove their containers with
docker compose rm -sf pgsql xtm-one-db-init opencrq-db-init.Check that it workeddocker compose config --quiet && echo "configuration OK"It prints
configuration OK. Afterdocker compose up -d,docker compose psshowsopenaev,xtm-oneandopencrqhealthy.
Mail server
The SMTP_* and IMAP_* variables of .env do not reach every platform:
| Platform | Reads |
|---|---|
| OpenAEV | Every SMTP_* variable, and the IMAP_* variables when OPENAEV_MAIL_IMAP_ENABLED=true |
| OpenCTI | SMTP_HOST only: modules/opencti.yml sets the port to 25, without authentication |
OpenAEV sends the email injects of simulations through SMTP. On port 587, as with Gmail or Microsoft 365, set SMTP_STARTTLS_ENABLE=true and SMTP_SSL_ENABLE=false; on port 465, the reverse. A mailbox protected by two-factor authentication needs an app password, created in the account of the mailbox, in SMTP_PASSWORD. With IMAP on, OpenAEV reads the same mailbox every 10 seconds, to show the players' replies in the simulation: it reads the folders of OPENAEV_MAIL_IMAP_INBOX (INBOX, several separated by commas) and files what it sends in OPENAEV_MAIL_IMAP_SENT (Sent), which it creates when missing. Gmail names that folder [Gmail]/Sent Mail. The keys are in the spring.mail and openaev.mail blocks of the configuration reference.
To send OpenCTI mail through a relay that needs authentication, add these variables to the opencti service in docker-compose.override.yml. SMTP__PORT replaces the port 25 that modules/opencti.yml sets:
services:
opencti:
environment:
- SMTP__PORT=${SMTP_PORT}
- SMTP__USERNAME=${SMTP_USERNAME}
- SMTP__PASSWORD=${SMTP_PASSWORD}
- SMTP__USE_SSL=${SMTP_SSL_ENABLE}
SMTP__USE_SSL=true opens the connection in TLS, as on port 465. On port 587, keep SMTP_SSL_ENABLE=false.
New in 7.260811 LTS For a provider that no longer accepts passwords, such as Microsoft 365, OpenCTI authenticates with OAuth2: set SMTP__AUTH_TYPE=oauth2, then SMTP__OAUTH_USER (the mailbox), SMTP__OAUTH_CLIENT_ID, SMTP__OAUTH_CLIENT_SECRET, SMTP__OAUTH_ISSUER (the OpenID Connect issuer URL of the provider) and SMTP__OAUTH_REFRESH_TOKEN, instead of SMTP__USERNAME and SMTP__PASSWORD. OpenCTI exchanges the refresh token for an access token before it sends. Request the refresh token with the scope that allows sending through SMTP: for Microsoft 365, https://outlook.office.com/SMTP.Send with offline_access; for Google Workspace, https://mail.google.com/.
OpenCTI can also take its mail server from its interface, in , without a restart. When that configuration is in use, OpenCTI ignores the SMTP__* variables. See Send emails from OpenCTI.
Example CERT runs OpenCTI at https://cti.example.com for the hotel chains it serves. It moves OpenCTI to its own services: an Elasticsearch cluster of three nodes with an API key, a Redis Sentinel group, a RabbitMQ cluster behind a TLS load balancer, and an S3 bucket on AWS reached with the role of the host. Its internal CA signed the certificates of the cluster and of the broker; ./certs/internal-ca.pem holds it. In docker-compose.override.yml:
services:
opencti:
volumes:
- ./certs:/opt/opencti/certs:ro
environment:
- ELASTICSEARCH__URL=https://search.example.com:9200
- ELASTICSEARCH__API_KEY=${OPENCTI_ELASTIC_API_KEY}
- ELASTICSEARCH__SSL__CA=/opt/opencti/certs/internal-ca.pem
- ELASTICSEARCH__NUMBER_OF_SHARDS=3
- ELASTICSEARCH__NUMBER_OF_REPLICAS=1
- REDIS__MODE=sentinel
- 'REDIS__HOSTNAMES=["sentinel1.example.com:26379","sentinel2.example.com:26379","sentinel3.example.com:26379"]'
- REDIS__SENTINEL_MASTER_NAME=opencti
- REDIS__SENTINEL_PASSWORD=${REDIS_SENTINEL_PASSWORD}
- REDIS__PASSWORD=${REDIS_PASSWORD}
- REDIS__SENTINEL_FAILOVER_DETECTOR=true
- RABBITMQ__HOSTNAME=rabbitmq.example.com
- RABBITMQ__PORT=5671
- RABBITMQ__PORT_MANAGEMENT=15671
- RABBITMQ__USERNAME=opencti
- RABBITMQ__PASSWORD=${OPENCTI_RABBITMQ_PASSWORD}
- RABBITMQ__QUEUE_TYPE=quorum
- RABBITMQ__USE_SSL=true
- 'RABBITMQ__USE_SSL_CA=["/opt/opencti/certs/internal-ca.pem"]'
- RABBITMQ__USE_SSL_REJECT_UNAUTHORIZED=true
- RABBITMQ__MANAGEMENT_SSL=true
- RABBITMQ__MANAGEMENT_SSL_REJECT_UNAUTHORIZED=true
- NODE_EXTRA_CA_CERTS=/opt/opencti/certs/internal-ca.pem
- MINIO__ENDPOINT=s3.amazonaws.com
- MINIO__PORT=443
- MINIO__USE_SSL=true
- MINIO__BUCKET_NAME=example-cert-opencti
- MINIO__BUCKET_REGION=eu-west-3
- MINIO__USE_AWS_ROLE=true
depends_on:
elasticsearch: !reset null
redis: !reset null
rabbitmq: !reset null
minio: !reset null
With the API key, add ELASTICSEARCH__ENGINE_SELECTOR=elk to the environment list, so that OpenCTI uses the Elasticsearch client from the start.
After docker compose up -d opencti, the query of Check that it works lists Search engine, RabbitMQ and Redis with the versions of Example CERT's services. The bundled services still start for the other modules: give each one the disabled profile once no module uses it, as Who uses which service shows.
Read the service credentials of OpenCTI from CyberArk
When your policy forbids passwords in .env, OpenCTI can fetch the credentials of Elasticsearch, Redis and S3 storage from the CyberArk Central Credential Provider when it connects to them. Each service has its prefix: ELASTICSEARCH, REDIS, or MINIO for S3 storage.
| Variable | Default | Set it to |
|---|---|---|
<PREFIX>__CREDENTIALS_PROVIDER__SELECTOR | cyberark. Without it, OpenCTI ignores the other variables of the service | |
<PREFIX>__CREDENTIALS_PROVIDER__CYBERARK__URI | The Accounts endpoint of the Central Credential Provider, such as https://cyberark.example.com/AIMWebService/api/Accounts | |
<PREFIX>__CREDENTIALS_PROVIDER__CYBERARK__APP_ID, __SAFE, __OBJECT | The application ID, safe and object of the account, sent as AppID, Safe and Object | |
<PREFIX>__CREDENTIALS_PROVIDER__CYBERARK__FIELD_TARGETS | A JSON list: the setting that receives each value of the secret, in order. Without it, OpenCTI reads <PREFIX>__CREDENTIALS_PROVIDER__FIELD_TARGETS. With neither, the secret fills nothing | |
<PREFIX>__CREDENTIALS_PROVIDER__CYBERARK__DEFAULT_SPLITTER | : | The separator between the values of the secret, as in user:password. OpenCTI cuts the secret at every separator, so a password that contains it is cut too: choose a separator your passwords never contain |
<PREFIX>__CREDENTIALS_PROVIDER__HTTPS_CERT__CRT, __KEY | When the provider asks for a client certificate: the certificate and its private key, each as its PEM content encoded in base64 on one line, not a path | |
<PREFIX>__CREDENTIALS_PROVIDER__HTTPS_CERT__CA | Read only together with a client certificate. Leave it unset, and give the CA that signed the certificate of the provider to NODE_EXTRA_CA_CERTS, as described in Trust your certificate authority and proxy: a list set here replaces the CAs OpenCTI trusts, and does not load as a CA | |
<PREFIX>__CREDENTIALS_PROVIDER__HTTPS_CERT__REJECT_UNAUTHORIZED | off | true to check the certificate of the provider. Keep true in production: with false, anyone between OpenCTI and the provider can pose as it and read the secrets |
The settings a secret can fill depend on the service:
| Service | Prefix | Field targets |
|---|---|---|
| Elasticsearch or OpenSearch | ELASTICSEARCH | username and password, or apiKey |
| Redis | REDIS | username and password; with Sentinel, also sentinelUsername and sentinelPassword |
| S3 storage | MINIO | accessKeyId and secretAccessKey |
For example, Example CERT keeps the Elasticsearch and Redis accounts of OpenCTI in the CyberArk safe cti-platform, each as its user name and password separated by |, because the passwords may contain a colon. Its Central Credential Provider accepts only clients with a certificate, signed like the provider's own certificate by the internal CA. The platform team stores the client certificate and its key, base64-encoded, in .env as CYBERARK_CLIENT_CERT_B64 and CYBERARK_CLIENT_KEY_B64 (for example with base64 -w0 opencti-client.crt), and adds to the opencti service in docker-compose.override.yml:
services:
opencti:
volumes:
- ./certs:/opt/opencti/certs:ro
environment:
- ELASTICSEARCH__CREDENTIALS_PROVIDER__SELECTOR=cyberark
- ELASTICSEARCH__CREDENTIALS_PROVIDER__CYBERARK__URI=https://cyberark.example.com/AIMWebService/api/Accounts
- ELASTICSEARCH__CREDENTIALS_PROVIDER__CYBERARK__APP_ID=opencti
- ELASTICSEARCH__CREDENTIALS_PROVIDER__CYBERARK__SAFE=cti-platform
- ELASTICSEARCH__CREDENTIALS_PROVIDER__CYBERARK__OBJECT=elasticsearch-opencti
- 'ELASTICSEARCH__CREDENTIALS_PROVIDER__CYBERARK__FIELD_TARGETS=["username","password"]'
- ELASTICSEARCH__CREDENTIALS_PROVIDER__CYBERARK__DEFAULT_SPLITTER=|
- ELASTICSEARCH__CREDENTIALS_PROVIDER__HTTPS_CERT__CRT=${CYBERARK_CLIENT_CERT_B64}
- ELASTICSEARCH__CREDENTIALS_PROVIDER__HTTPS_CERT__KEY=${CYBERARK_CLIENT_KEY_B64}
- ELASTICSEARCH__CREDENTIALS_PROVIDER__HTTPS_CERT__REJECT_UNAUTHORIZED=true
- REDIS__CREDENTIALS_PROVIDER__SELECTOR=cyberark
- REDIS__CREDENTIALS_PROVIDER__CYBERARK__URI=https://cyberark.example.com/AIMWebService/api/Accounts
- REDIS__CREDENTIALS_PROVIDER__CYBERARK__APP_ID=opencti
- REDIS__CREDENTIALS_PROVIDER__CYBERARK__SAFE=cti-platform
- REDIS__CREDENTIALS_PROVIDER__CYBERARK__OBJECT=redis-opencti
- 'REDIS__CREDENTIALS_PROVIDER__FIELD_TARGETS=["username","password"]'
- REDIS__CREDENTIALS_PROVIDER__CYBERARK__DEFAULT_SPLITTER=|
- REDIS__CREDENTIALS_PROVIDER__HTTPS_CERT__CRT=${CYBERARK_CLIENT_CERT_B64}
- REDIS__CREDENTIALS_PROVIDER__HTTPS_CERT__KEY=${CYBERARK_CLIENT_KEY_B64}
- REDIS__CREDENTIALS_PROVIDER__HTTPS_CERT__REJECT_UNAUTHORIZED=true
- NODE_EXTRA_CA_CERTS=/opt/opencti/certs/internal-ca.pem
Each service carries its own provider settings, client certificate included: Redis reads none of the Elasticsearch ones. ELASTICSEARCH__CREDENTIALS_PROVIDER__HTTPS_CERT__CA and its Redis counterpart stay unset: NODE_EXTRA_CA_CERTS makes OpenCTI trust the internal CA that signed the provider's certificate. Redis takes its field targets from the variable without CYBERARK, which serves any provider; both forms work.
At startup, the logs of opencti show Remote credentials successfully fetched once for the source elasticsearch and once for the source redis. When the provider cannot be reached, they show Remote credentials data fail to fetch, fallback. Then, as when the provider returns no secret, OpenCTI connects with the ELASTICSEARCH__USERNAME and ELASTICSEARCH__PASSWORD of its configuration, if any. The secrets of single sign-on providers use the same mechanism under another prefix: see Authentication.
Check that it works
From the host, ask OpenCTI which versions of its services it reaches:
set -a; . ./.env; set +a
curl -s "http://localhost:$OPENCTI_PORT/graphql" \
-H "Authorization: Bearer $OPENCTI_ADMIN_TOKEN" -H 'Content-Type: application/json' \
-d '{"query":"{ about { dependencies { name version } } }"}'
The answer lists Search engine, RabbitMQ and Redis, each with a version. docker compose ps shows opencti, openaev and xtm-one healthy.
What's next
- Trust your certificate authority and proxy, to trust the certificates of your services.
- Connect the modules to each other.
- Back up and restore, for the data these services hold.
- Scale: workers, platforms and clusters.