> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-6-1/data-flows/agents/installing-agents/using-mutual-tls-for-agents.md).

# Using Mutual TLS for Agents

Configure protocol-mapper agents to authenticate with Connectware over mutual TLS (mTLS) using client and CA certificates.

You can configure protocol-mapper agents to use mutual TLS (mTLS) for secure communication with Connectware. In the following example setup, the agent connects via MQTT over a secure TLS connection (port 8883), requiring both client and CA certificates for mutual authentication. This approach ensures that both the server and the client verify each other's identities, adding an extra layer of security.

Setting `CYBUS_USE_MUTUAL_TLS` to `true` switches `CYBUS_DATAPLANE_SCHEME` to `mqtts` and `CYBUS_DATAPLANE_PORT` to `8883`, so the example does not set them. Set them explicitly only if your Connectware instance uses a different scheme or port. See [Environment Variables](/2-6-1/reference/environment-variables.md).

The example also mounts the client certificate and the CA certificate as Docker volumes.

{% code lineNumbers="true" %}

```yaml
services:
  protocol-mapper-agent:
    image: registry.cybus.io/cybus/protocol-mapper:${IMAGE_TAG}
    environment:
      CYBUS_AGENT_MODE: distributed
      CYBUS_AGENT_NAME: myAgent
      CYBUS_HOSTNAME_INGRESS: connectware.example.com
      CYBUS_USE_MUTUAL_TLS: true
    volumes:
      - protocol-mapper-agent:/data
      - /mycerts:/connectware/certs/client
      - /myca:/connectware/certs/ca
    restart: unless-stopped
    network_mode: bridge
    hostname: <some-suitable-hostname>
volumes:
  protocol-mapper-agent:
```

{% endcode %}

Replace `${IMAGE_TAG}` with the protocol-mapper agent image version that matches your Connectware version, and `connectware.example.com` with the address of your Connectware server.

The example uses `network_mode: bridge` so that several agents can run on the same host. See [Network Mode](/2-6-1/data-flows/agents/installing-agents/installing-agents-via-docker-compose.md#network-mode).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cybus.io/2-6-1/data-flows/agents/installing-agents/using-mutual-tls-for-agents.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
