> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/gateway/guides/certificates/change-certificate.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# Change the Devolutions Gateway certificate

Replace the Devolutions Gateway TLS certificate from the Devolutions Server Console, with PowerShell, in gateway.json, or in Docker.

Replace the TLS certificate of Devolutions Gateway before it expires, or when you move from a self-signed certificate to one issued by your certificate authority. The new certificate must meet the requirements in [Certificates and TLS](https://docs.devolutions.net/gateway/guides/certificates.md): Subject Alternative Name, Server Authentication EKU and full chain.

## Pick the right option

<table><thead><tr><th width="260">CHOOSE</th><th>WHAT HAPPENS</th><th>USE IT WHEN</th></tr></thead><tbody><tr><td><strong>Devolutions Server Console</strong></td><td>The console stops the service, imports the certificate, updates the configuration and starts the service again.</td><td>Devolutions Gateway was installed or is managed from the Devolutions Server Console, on the Devolutions Server machine.</td></tr><tr><td><strong>PowerShell module</strong></td><td><code>Import-DGatewayCertificate</code> converts the certificate to <code>server.crt</code> and <code>server.key</code> and updates <code>gateway.json</code>. You restart the service.</td><td>Any Windows or Linux installation.</td></tr><tr><td><strong>Edit gateway.json</strong></td><td>You copy the files and change the certificate keys by hand. You restart the service.</td><td>You manage the configuration file directly, or you want to keep every other key of the file untouched.</td></tr><tr><td><strong>Windows certificate store</strong></td><td>Devolutions Gateway picks up a renewed certificate with the same subject name by itself.</td><td>Your certificates are deployed and renewed in the Windows certificate store. See <a href="https://docs.devolutions.net/gateway/guides/certificates/windows-certificate-store.md">Use the Windows certificate store</a>.</td></tr><tr><td><strong>Docker environment variables</strong></td><td>The container imports the certificate at every start.</td><td>Devolutions Gateway runs in a container. See <a href="https://docs.devolutions.net/gateway/for-administrators/install/docker.md">Run in Docker</a>.</td></tr></tbody></table>

## From the Devolutions Server Console

1. On the Devolutions Server machine, open the Devolutions Server Console and select the instance.
2. In the ***Companions*** tab, in the ***Devolutions Gateway*** section, click ***Edit***.
3. In ***Devolutions Gateway Listeners***, make sure the ***HTTP listener*** uses ***https***.
4. In ***Certificate configuration***, select the new ***Certificate file*** and enter the ***Certificate password*** for a `.pfx` or `.p12` file, or the ***Private key file*** for a `.pem` or `.crt` file. To use a certificate from the Windows certificate store instead, fill in ***Certificate store location***, ***Certificate store name*** and ***Certificate subject name*** (***Select certificate...***).
5. Click ***OK***. The console stops the Devolutions Gateway service, applies the change and starts the service again.

The console shows "Certificate is mandatory when using HTTPS", "Devolutions Gateway certificate password is mandatory with the certificate file." or "Devolutions Gateway certificate private key is mandatory with the certificate file." when a value is missing.

{% hint style="warning" %}
The console writes the configuration with the DevolutionsGateway PowerShell module, which removes the `TlsVerifyStrict` key and other keys it doesn't know from `gateway.json`. Add them back after the change. See [Manage Devolutions Gateway with PowerShell](https://docs.devolutions.net/gateway/for-administrators/powershell.md).
{% endhint %}

## With the PowerShell module

Run these commands in an elevated PowerShell session on the Devolutions Gateway machine. The module is installed with Devolutions Gateway on Windows; on Linux, install it from the PowerShell Gallery (see [Manage Devolutions Gateway with PowerShell](https://docs.devolutions.net/gateway/for-administrators/powershell.md)).

1. Back up the configuration file:

```powershell
Import-Module DevolutionsGateway
$ConfigFile = Join-Path (Get-DGatewayPath) 'gateway.json'
Copy-Item $ConfigFile "$ConfigFile.bak"
```

2. Import the certificate. For a `.pfx` or `.p12` file, pass its password; for PEM files, pass the private key file:

```powershell
# PFX file
Import-DGatewayCertificate -CertificateFile 'C:\certs\gateway.pfx' -Password (Read-Host 'PFX password')

# PEM files
Import-DGatewayCertificate -CertificateFile '/etc/ssl/gateway/fullchain.pem' -PrivateKeyFile '/etc/ssl/gateway/privkey.pem'
```

`Import-DGatewayCertificate` writes the certificate to `server.crt` and an unencrypted private key to `server.key` in the configuration folder, and sets `TlsCertificateFile` and `TlsPrivateKeyFile`. It doesn't change `TlsCertificateSource`: if it's `System`, set it back to `External` with `Set-DGatewayConfig -TlsCertificateSource External`.

3. Restore the keys the module removed, as shown in [Manage Devolutions Gateway with PowerShell](https://docs.devolutions.net/gateway/for-administrators/powershell.md), in particular `"TlsVerifyStrict": true`.
4. Restart the service: `Restart-DGateway`.

## By editing gateway.json

1. Copy the certificate and its key into the configuration folder: `%ProgramData%\Devolutions\Gateway` on Windows, `/etc/devolutions-gateway` on Linux.
2. In `gateway.json`, set the certificate keys. With PEM files:

```json
"TlsCertificateSource": "External",
"TlsCertificateFile": "server.crt",
"TlsPrivateKeyFile": "server.key",
"TlsVerifyStrict": true
```

With a PFX file, set `TlsCertificateFile` to the `.pfx` file, remove `TlsPrivateKeyFile`, and set `TlsPrivateKeyPassword` to the file password.

3. Check that the HTTP listener uses `https`, for example `"InternalUrl": "https://*:7171"`.
4. Restart the service:
   * Windows: `Restart-Service DevolutionsGateway` (display name ***Devolutions Gateway Service***).
   * Linux: `sudo systemctl restart devolutions-gateway`.

On Linux, keep the key file readable only by the service account: `sudo chmod 600 /etc/devolutions-gateway/server.key`.

## Verify the new certificate

1. Open `https://<gateway host name>:7171/jet/health` in a browser on a client computer. The page shows `Devolutions Gateway "<host name>" is alive and healthy.` and the browser shows the new certificate without a warning.
2. In Devolutions Server, go to ***Administration*** – ***Devolutions Gateway***, open the menu of the gateway and select ***Diagnostic***. ***Secure HTTPS communication enabled*** and ***Gateway health*** must be green.
3. In Devolutions Cloud, go to ***Administration*** – ***Devolutions Gateway*** and check the health of the gateway.

## If it doesn't work

* **The service doesn't start:** read `boot.stacktrace` in the configuration folder, or event 1010 "Configuration invalid" (the error is raised before logging starts, so it isn't in the `gateway.*.log` files). The message "found significant issues with the certificate" means the certificate has no Subject Alternative Name or no Server Authentication EKU while `TlsVerifyStrict` is `true`. See [Certificates and TLS](https://docs.devolutions.net/gateway/guides/certificates.md).
* **Clients fail but the browser on the gateway works:** the intermediate certificates are missing from the file. Re-export the certificate with the full chain.
* **Recordings fail after the change:** see [Invalid TLS certificate for session recording](https://docs.devolutions.net/gateway/help/troubleshooting/recording-tls-certificate.md).
* More checks: [Devolutions Gateway troubleshooting](https://docs.devolutions.net/gateway/help/troubleshooting/general.md).


---

# 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.devolutions.net/gateway/guides/certificates/change-certificate.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.
