> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/10.4/analyzing-source-code/scanner-environment/install-self-signed-certificate.md).

# Installing the server’s self-signed certificate

If your SonarQube Server instance uses HTTPS with a self-signed certificate, you must import the certificate into the scanner environment. This page is for SonarQube Server 10.4.

{% hint style="info" %}
**For AI agents:** You're in the SonarQube Server 10.4 documentation. For a list of all 10.4 pages, see the [SonarQube Server 10.4 page index](https://2155789048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL4urx4YsPFYDefLTrxao%2Fuploads%2FEzX50B1e7djUECg3wgVO%2Fsonarqube-server-10.4-llms.txt?alt=media). For the whole site, see the [page index](https://docs.sonarsource.com/llms.txt) or the [full text](https://docs.sonarsource.com/llms-full.txt). For another version, replace 10.4 in the URL with that version. The [latest version](https://docs.sonarsource.com/sonarqube-server/) has no version number in its URL.
{% endhint %}

If your SonarQube Server instance is [Operating the server](/sonarqube-server/10.4/setup-and-upgrade/configure-and-operate-a-server/operating-the-server.md) and a self-signed certificate (or more generally, an SSL certificate that is not signed by an authority trusted by Java) then you must install the self-signed certificate into the Java truststore of your CI/CD host machine otherwise the scanner will not be able to connect to the server and the analysis will fail.

## General procedure <a href="#general-procedure" id="general-procedure"></a>

JVM comes with a default truststore called `cacerts`. It resides in`\jre\lib\security\cacerts`.

To install the certificate into the truststore, use the JVM tool `keytool`. The instructions depend on your operating system and you will find many resources online, such as [this one](https://www.ibm.com/docs/en/tnpm/1.4.2?topic=security-import-certificate-jre-keystore) for Linux.

## If running the scanner with Docker <a href="#with-docker" id="with-docker"></a>

If you need to configure a self-signed certificate for the scanner to communicate with your SonarQube Server instance, you can use a volume under `/tmp/cacerts` to add it to the containers java trust store:

```css-79elbk
docker pull sonarsource/sonar-scanner-cli
docker run \
    --rm \
    -v ${YOUR_CERTS_DIR}/cacerts:/tmp/cacerts \
    -v ${YOUR_CACHE_DIR}:/opt/sonar-scanner/.sonar/cache \
    -v ${YOUR_REPO}:/usr/src \
    -e SONAR_HOST_URL="http://${SONARQUBE_URL}" \
    sonarsource/sonar-scanner-cli
```

Alternatively, you can create your own container that includes the modified `cacerts` file. Create a `Dockerfile` with the following contents:

```css-79elbk
FROM sonarsource/sonar-scanner-cli
COPY cacerts /usr/lib/jvm/default-jvm/jre/lib/security/cacerts
```

Then, assuming both the `cacerts` and `Dockerfile` are in the current directory, create the new image with a command such as:

```css-79elbk
docker build --tag our-custom/sonar-scanner-cli .
```


---

# 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.sonarsource.com/sonarqube-server/10.4/analyzing-source-code/scanner-environment/install-self-signed-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.
