> For the complete documentation index, see [llms.txt](https://docs.digibee.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digibee.com/documentation/troubleshooting/pt-br/authentication-and-security-guides/mtls/how-to.md).

# Como configurar o mTLS na Digibee Integration Platform

Learn how to install mTLS on your realm.

O Mutual Transport Layer Security (mTLS) é um protocolo de autenticação bilateral que verifica usuários, dispositivos e servidores dentro de uma organização, validando que ambas as partes (servidor e cliente) possuem as chaves privadas corretas. A Digibee Integration Platform permite consumir e publicar APIs com o protocolo mTLS para identificar clientes e servidores por meio de certificados TLS.

Para que a Digibee possa proceder com a instalação, é necessário registrar um certificado utilizando um Root Certificate salvo em uma [conta do tipo Certificate Chain](https://docs.digibee.com/documentation/developer-guide/pt-br/development-cycle/build-overview/accounts.md#tipos-de-contas) no seu realm.. Os certificados devem ser emitidos, fornecidos e gerenciados pelo cliente e devem estar disponíveis para que a comunicação com o servidor Digibee, onde o Root Certificate foi configurado, ocorra com sucesso.

## Configurando o mTLS

Para configurar o mTLS na Digibee Integration Platform, siga os passos abaixo:

{% hint style="info" %}
Nesta configuração, a cadeia completa de certificados e a chave não são necessárias. O campo de senha deve ser deixado vazio ao salvar o certificado.
{% endhint %}

1. Salve o Root Certificate no formato `.pem` no campo Chain. O certificado em formato `.pem` segue o formato abaixo:

```
-----COMEÇO CERTIFICADO-----
MIIF4zCCA8ugAwIBAgIUI/vA3JlEcMMpXnufpuVSLhQZcwUwDQYJKoZIhvcNAQEL
BQAwgYAxCzAJBgNVBAYTAkJSMQswCQYDVQQIDAJTQzELMAkGA1UEBwwCRkwxCzA
JBgNVBAoMAkRHMQ4wDAYDVQQLDAVERy1GTDEPMA0GA1UEAwwGZGduYW1lMSkw
-----FINAL CERTIFICADO-----
```

{% hint style="info" %}
Preste atenção ao ambiente, pois pode haver certificados diferentes para teste e produção. Atualmente, a Digibee suporta apenas um certificado por ambiente.
{% endhint %}

2. O nome da conta é crucial para a instalação bem-sucedida do certificado no Load Balancer dedicado ao seu realm. Ele deve seguir o formato `dgb-mtls-REFERENCIA_NOME.` No exemplo abaixo, a conta foi nomeada como `dgb-mtls-autocorp`.

<figure><img src="https://content.gitbook.com/content/3ANg0NQQeslB7Og5K7Ah/blobs/YF5BlEjWLhX5gPzamz0J/MTLS.png" alt=""><figcaption></figcaption></figure>

3. Após criar a conta do tipo Certificate Chain com o certificado salvo no formato `.pem`, [entre em contato com a Digibee pelo chat](https://docs.digibee.com/documentation/troubleshooting/pt-br/help-and-faq/support.md). Você deve informar o nome da conta para que o certificado possa ser instalado no Load Balancer do seu realm.

## Usando mTLS em outros pipelines

1. Ative o parâmetro **mTLS enabled API** no trigger do pipeline.
2. **Desmarque a opção API Key** no trigger ao usar o mTLS enabled API.

<figure><img src="https://content.gitbook.com/content/3ANg0NQQeslB7Og5K7Ah/blobs/iZjDnTAXbfIGJEXKXXQw/Mtls-Other-pipelines.png" alt=""><figcaption></figcaption></figure>

## Endpoints

Os endpoints desempenham um papel crucial na implementação do mTLS, pois são o ponto de interação entre o cliente e o servidor onde o protocolo mTLS é configurado e aplicado.

A Digibee cria novos endpoints, diferentes dos endpoints regulares. Durante a configuração, você receberá as informações sobre os endpoints recém-criados. Os endpoints mTLS são exclusivos para acesso via internet e não são acessíveis por VPN.

Os endpoints gerados pela Plataforma sempre seguem esta estrutura:

* **Ambiente de produção**

```
https://api.godigibee.io/pipeline/{{NOME_DO_REALM}}/v1/{{NOME_DO_PIPELINE}}

```

* **Ambiente de teste**

```
https://test.godigibee.io/pipeline/{{NOME_DO_REALM}}/v1/{{NOME_DO_PIPELINE}}
```

O endpoint gerado após a instalação do mTLS seguirá o mesmo formato, mas com o número `2` adicionado à URL:

* **Ambiente de produção**

```
https://api2.godigibee.io/pipeline/{{NOME_DO_REALM}}/v1/{{NOME_DO_PIPELINE}}
```

* **Ambiente de teste**

```
https://test2.godigibee.io/pipeline/{{NOME_DO_REALM}}/v1/{{NOME_DO_PIPELINE}}
```


---

# 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.digibee.com/documentation/troubleshooting/pt-br/authentication-and-security-guides/mtls/how-to.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.
