Run integrations behind a proxy
Send XTM Composer and the integrations it runs through an HTTP or HTTPS proxy, including a TLS-intercepting proxy with its own certificate authority.
This page sends XTM Composer and the integrations it deploys through your proxy. The settings belong to each platform block, opencti or openaev, so OpenCTI and OpenAEV integrations can use different proxies. Install XTM Composer first: see Install XTM Composer.
- XTM Composer → Integration containers: proxy and CA
- XTM Composer → OpenCTI or OpenAEV: direct
- Integration containers → Your proxy: other traffic
- Integration containers → OpenCTI or OpenAEV: direct
- Integration containers → RabbitMQ: direct
Before you start
- The URL of your proxy, such as
http://proxy.example.com:8080, and the hosts that must not go through it. - For a proxy that intercepts TLS, its certificate authority as a PEM file.
Turn on the proxy
-
Add the proxy to the environment of XTM Composer: its env file, such as
composer.env, or theenvironmentof its service, indocker-compose.override.ymlfor xtm-docker. For OpenAEV, replaceOPENCTI__withOPENAEV__.OPENCTI__WITH_PROXY=true OPENCTI__HTTP_PROXY=http://proxy.example.com:8080 OPENCTI__HTTPS_PROXY=http://proxy.example.com:8080 OPENCTI__NO_PROXY=localhost,127.0.0.1,opencti,openaev,rabbitmqPut in
NO_PROXYevery host XTM Composer and the integrations reach directly: the platform and RabbitMQ at least, as the XTM stack names them here. -
Restart XTM Composer. Integrations get the proxy when XTM Composer creates their container. For an integration already deployed, change its configuration with Update, or stop it and remove its container: XTM Composer then creates it again.
| Key | Environment variable | Default | Effect |
|---|---|---|---|
opencti.with_proxy | OPENCTI__WITH_PROXY | false | true turns the proxy on for this platform. With false, XTM Composer ignores every proxy, including the HTTP_PROXY variables of its own environment |
opencti.http_proxy | OPENCTI__HTTP_PROXY | The proxy for HTTP. Without it, XTM Composer uses HTTP_PROXY from its own environment | |
opencti.https_proxy | OPENCTI__HTTPS_PROXY | The proxy for HTTPS. Without it, XTM Composer uses HTTPS_PROXY from its own environment | |
opencti.no_proxy | OPENCTI__NO_PROXY | Comma-separated hosts, domains or CIDR ranges reached without the proxy, such as opencti,.example.com,10.0.0.0/8. Without it, NO_PROXY from the environment of XTM Composer. It applies to the integrations and to the requests of XTM Composer to the platform |
With the proxy on, XTM Composer sends its own requests to the platform through it, except to the hosts of no_proxy, and gives each integration container HTTP_PROXY, HTTPS_PROXY and NO_PROXY. When you set no_proxy but neither http_proxy nor https_proxy, XTM Composer takes the proxy for its own requests from HTTP_PROXY and HTTPS_PROXY of its environment, else from ALL_PROXY.
Up to XTM Composer 3.261021.1, no_proxy applied to the integrations only: with http_proxy or https_proxy set, XTM Composer reached the platform through the proxy even when the platform was in the list.
Trust a TLS-intercepting proxy
A proxy that decrypts HTTPS presents certificates signed by its own authority. Give that authority to the integrations:
| Key | Environment variable | Default | Effect |
|---|---|---|---|
opencti.https_proxy_ca | OPENCTI__HTTPS_PROXY_CA | Certificates to trust: a list of file paths or PEM blocks. As an environment variable, a JSON array such as ["/certs/proxy-ca.pem"] | |
opencti.https_proxy_reject_unauthorized | OPENCTI__HTTPS_PROXY_REJECT_UNAUTHORIZED | true | false gives the integrations NODE_TLS_REJECT_UNAUTHORIZED=0, which turns off certificate checks in Node.js integrations. Prefer https_proxy_ca |
-
Make the PEM file readable by XTM Composer, which reads the paths: mount it in its container, for example at
/certs/proxy-ca.pem, and add the variable to its environment. In a shell, put the value in single quotes.OPENCTI__HTTPS_PROXY_CA=["/certs/proxy-ca.pem"] -
On Docker, Podman, Docker Swarm or Portainer, let the container engine see the bundle XTM Composer writes. XTM Composer writes the certificates to
/tmp/xtm-composer-proxy-ca/and asks the engine to mount that file in each integration. The engine looks for it on the host, so when XTM Composer runs in a container, mount the same host folder at the same path:-v /tmp/xtm-composer-proxy-ca:/tmp/xtm-composer-proxy-caOn Kubernetes, nothing to add: XTM Composer puts the bundle in a Secret named after the integration's Deployment,
<deployment>-proxy-cacut to 63 characters, and mounts it from there. From XTM Composer 3.261121.0, when the integration's name is not a valid Kubernetes name, such as one longer than 63 characters, the Deployment name ends with 8 characters of a hash, and so does the Secret: see the naming rule in XTM Composer architecture. -
Restart XTM Composer, then recreate the integrations as in the previous procedure.
Each integration then finds the bundle at /etc/ssl/certs/xtm-proxy-ca.crt, and the variables that point most runtimes to it: SSL_CERT_FILE, REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS and CURL_CA_BUNDLE.
These settings are only for the proxy. The certificate of the platform itself is configured on the platform: see Trust your certificate authority and proxy. To make XTM Composer accept an invalid platform certificate while you test, set OPENCTI__UNSECURED_CERTIFICATE=true.
Check that it works
Check the proxy XTM Composer uses for its own requests, in its logs at start:
docker logs xtm-composer 2>&1 | grep -E 'Using HTTPS? proxy'
A line Using HTTP proxy or Using HTTPS proxy per platform, with its no_proxy list and its source: explicit for the URL of the platform block, environment for a URL read from the environment. When the block sets no proxy URL and no no_proxy, XTM Composer uses the proxy variables of its environment and logs no such line.
Then read the environment of an integration container XTM Composer created after the change:
docker ps --filter label=opencti-manager --format '{{.Names}}'
docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' <container name> | grep -E '^(HTTP_PROXY|HTTPS_PROXY|NO_PROXY|SSL_CERT_FILE)='
It prints HTTP_PROXY, HTTPS_PROXY and NO_PROXY with your values, and SSL_CERT_FILE=/etc/ssl/certs/xtm-proxy-ca.crt when you set a certificate authority. With MANAGER__DEBUG__SHOW_ENV_VARS=true, XTM Composer also logs these variables when it starts a container, with the proxy URLs redacted.
What's next
- Pull integrations from a private registry, when the images come from your registry.
- Configure XTM Composer.