Install certificate manually·续1
Zero Trust integrates with several mobile device management (MDM) software partners to deploy the Cloudflare One Client across devices.
Microsoft Intune
To upload and deploy a Cloudflare certificate in Microsoft Intune:
- Download and convert a Cloudflare certificate to DER format with the
.cerfile type. - In Microsoft Intune, create a trusted certificate profile ↗︎ with your converted certificate.
For more information, refer to the Microsoft documentation ↗︎.
Jamf Pro
To upload and deploy a Cloudflare certificate in Jamf Pro:
- Download and convert a Cloudflare certificate to DER format with the
.cerfile type. - In Jamf Pro, go to Computers > Configuration Profiles to create a computer configuration profile, or go to Devices > Configuration Profiles to create a mobile device configuration profile. Select New.
- Add a name and description for the profile.
- Choose whether you would like Jamf to install the certificate automatically or with self-service, and whether you would like to install the certificate for a single user or all users on the device.
- Select Add > Certificate. Choose the certificate file.
- Uncheck Allow export from keychain.
- Select Scope, then choose which devices or groups to deploy the certificate to.
- Select Save.
For more information, refer to the Jamf Pro documentation ↗︎.
Kandji
To upload and deploy a Cloudflare certificate in Kandji:
- Download a Cloudflare certificate in
.crtformat. - In Kandji, upload the certificate ↗︎ as a PKCS #1-formatted certificate.
Hexnode
To upload and deploy a Cloudflare certificate in Hexnode:
- Download a Cloudflare certificate in
.pemformat. - In Hexnode, follow the directions for adding the certificate to macOS ↗︎, iOS ↗︎, and/or Android ↗︎ devices.
JumpCloud
To upload and deploy a Cloudflare certificate in JumpCloud:
- Download a Cloudflare certificate in
.pemformat. - In JumpCloud, upload the certificate ↗︎.
- Configure a conditional access policy ↗︎ to deploy the certificate across devices.
Programming languages and runtimes
Programming language runtimes often maintain their own certificate stores or use language-specific certificate management tools.
Python
Depending on which version of Python you have installed and your configuration, you may need to use either the python or python3 command. If you use virtual environments ↗︎, you will need to repeat the following steps within each virtual environment.
The command to install the certificate with Python on Windows automatically includes pip and certifi (the default certificate bundle for certificate validation).
- Download a Cloudflare certificate in
.crtformat. - In a PowerShell terminal, install the
certifipackage:
python -m pip install certifi
```
3. Identify the Python CA store:
```powershell
$CERT_PATH = python -c "import certifi; print(certifi.where())"
```
4. Update the bundle to include the Cloudflare certificate:
```powershell
gc "$env:USERPROFILE\Downloads\certificate.crt" | ac $CERT_PATH
```
5. (Optional) Configure your system variables to point to the CA store by adding them to PowerShell's configuration file:
```powershell
[System.Environment]::SetEnvironmentVariable('CERT_PATH', $CERT_PATH, 'Machine')
[System.Environment]::SetEnvironmentVariable('SSL_CERT_FILE', $CERT_PATH, 'Machine')
[System.Environment]::SetEnvironmentVariable('REQUESTS_CA_BUNDLE', $CERT_PATH, 'Machine')
```
6. Restart your terminal.
1. [Download a Cloudflare certificate](#download-a-cloudflare-root-certificate) in `.pem` format.
2. In a terminal, install the `certifi` package:
```sh
python -m pip install certifi
```
3. Append the Cloudflare certificate to this CA store by running:
```sh
echo | cat - certificate.pem >> $(python -m certifi)
```
4. (Optional) Configure your system variables to point to the CA store by adding them to your shell's configuration file (such as `~/.zshrc` or `~/.bash_profile`). For example:
```sh
echo 'export CERT_PATH=$(python -c "import certifi; print(certifi.where())")
export SSL_CERT_FILE=${CERT_PATH}
export REQUESTS_CA_BUNDLE=${CERT_PATH}' >> ~/.zshrc
```
5. Restart your terminal.
#### Java
Java may have multiple certificate keystore locations depending on different installations or applications that include Java. Depending on your Java Virtual Machine (JVM) installation, you may need to install the certificate for each instance. You may also need to manually configure each Java application to use and trust the certificate.
To install a Cloudflare root certificate in the system JVM, follow the procedure for your operating system. These steps require you to [download a `.pem` certificate](#download-a-cloudflare-root-certificate).
1. Install [OpenSSL ↗︎](https://www.openssl.org/).
2. In a terminal, format the Cloudflare certificate for Java.
```sh
openssl x509 -in Cloudflare_CA.pem -inform pem -out Cloudflare_CA.der -outform der
```
3. Import the converted certificate into the Java keystore.
```sh
sudo $JAVA_HOME/bin/keytool -import -trustcacerts -alias 'Cloudflare Root CA' -file Cloudflare_CA.der -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -noprompt 2>&1
```
4. Restart any instances of Java.
1. Install [OpenSSL for Windows ↗︎](https://slproweb.com/products/Win32OpenSSL.html).
2. In an administrator PowerShell terminal, format the Cloudflare certificate for Java.
```powershell
openssl x509 -in Cloudflare_CA.pem -inform pem -out Cloudflare_CA.der -outform der
```
3. Import the converted certificate into the Java keystore.
```powershell
"%JAVA_HOME%\bin\keytool" -import -trustcacerts -alias "Cloudflare Root CA" -file Cloudflare_CA.der -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -storepass changeit -noprompt
```
4. Restart any instances of Java.
#### Ruby
To trust a Cloudflare root certificate in RubyGems, follow the procedure for your operating system. These steps require you to [download a `.pem` certificate](#download-a-cloudflare-root-certificate).
1. Install [OpenSSL ↗︎](https://www.openssl.org/).
2. In a terminal, format the Cloudflare certificate for Ruby.
```sh
openssl x509 -in ~/Downloads/certificate.pem -out ~/Downloads/ruby-root-ca.crt
```
3. Create a RubyGems certificate directory in your home folder.
```sh
mkdir -p ~/.gem/ssl
```
4. Copy the Cloudflare certificate to your RubyGems certificate store.
```sh
cp ~/Downloads/ruby-root-ca.crt ~/.gem/ssl/rubygems.org.pem
```
5. Configure RubyGems to use the certificate.
```sh
gem sources --add-trusted-cert ~/.gem/ssl/rubygems.org.pem
```
Alternatively, add the following line to your RubyGems configuration file located in `~/.gemrc` file to globally trust the certificate:
```yaml
:ssl_cert: ~/.gem/ssl/rubygems.org.pem
```
6. Restart any terminal sessions.
1. Install [OpenSSL for Windows ↗︎](https://slproweb.com/products/Win32OpenSSL.html).
2. In a PowerShell terminal, format the Cloudflare certificate for Ruby.
```powershell
openssl x509 -in %UserProfile%\Downloads\certificate.pem -out %UserProfile%\Downloads\ruby-root-ca.crt
```
3. Create a RubyGems certificate directory in your home folder.
```powershell
mkdir -Force "$env:USERPROFILE\.gem\ssl"
```
4. Copy the Cloudflare certificate to your RubyGems certificate store.
```powershell
Copy-Item "$env:USERPROFILE\Downloads\ruby-root-ca.crt" "$env:USERPROFILE\.gem\ssl\rubygems.org.pem"
```
5. Configure RubyGems to use the certificate.
```powershell
gem sources --add-trusted-cert "$env:USERPROFILE\.gem\ssl\rubygems.org.pem"
```
Alternatively, add the following line to your RubyGems configuration file located in `$HOME\.gemrc` to globally trust the certificate:
```yaml
:ssl_cert: C:/Users/<username>/.gem/ssl/rubygems.org.pem
```
6. Restart any terminal sessions.
#### Rust
Rust's package manager Cargo uses the system certificate store by default on most platforms. However, you may need to configure it explicitly in some cases.
1. [Download a Cloudflare certificate](#download-a-cloudflare-root-certificate) in `.pem` format.
2. Set the `CARGO_HTTP_CAINFO` environment variable to point to the certificate. In PowerShell:
```powershell
[System.Environment]::SetEnvironmentVariable('CARGO_HTTP_CAINFO', "$HOME\Downloads\certificate.pem", 'User')
```
3. Restart your terminal.
Alternatively, you can configure this in your Cargo configuration file at `%USERPROFILE%\.cargo\config.toml`:
```toml
[http]
cainfo = "C:\\Users\\<username>\\Downloads\\certificate.pem"
- Download a Cloudflare certificate in
.pemformat. - Set the
CARGO_HTTP_CAINFOenvironment variable by adding it to your shell's configuration file (such as~/.zshrcor~/.bash_profile):
export CARGO_HTTP_CAINFO="$HOME/Downloads/certificate.pem"
```
3. Restart your terminal.
Alternatively, you can configure this in your Cargo configuration file at `~/.cargo/config.toml`:
```toml
[http]
cainfo = "/path/to/certificate.pem"
Development tools and package managers
Development tools and package managers often require certificate configuration for secure package downloads and repository access.
Git
- Open PowerShell.
- Run the following command:
git config -l
```
This command will output:
```txt
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
```
3. The `http.sslcainfo` defines the CA Certificate store. To append the Cloudflare certificate to the CA bundle, update `http.sslcainfo`.
```powershell
gc .\certificate.pem | ac $(git config --get http.sslcainfo)
```
To configure Git to trust a Cloudflare certificate, run the following command:
```sh
git config --global http.sslcainfo [PATH_TO_CLOUDFLARE_CERT]
npm
- Download a Cloudflare certificate in
.pemformat. - Set the
cafileconfiguration to use the Cloudflare certificate:
npm config set cafile [PATH_TO_CLOUDFLARE_CERT.pem]
```
On some systems you may need to set the following in your path/export list:
```sh
export NODE_EXTRA_CA_CERTS='[PATH_TO_CLOUDFLARE_CERT.pem]'
PHP Composer
The command below will set the cafile ↗︎ configuration inside of composer.json to use the Cloudflare root certificate. Make sure to download a certificate in the .pem file type.
composer config cafile [PATH_TO_CLOUDFLARE_CERT.pem]
Alternatively, you can add this manually to your composer.json file under the config key.
Docker
To install a certificate for use in a Docker container:
- Download a Cloudflare certificate in
.pemformat. - Create a directory for certificates in your Docker project:
cd docker-project
mkdir certs
mv /path/to/downloaded/certificate.pem certs/
```
3. Verify the certificate was moved to the directory correctly. Your project should have the following structure:
```sh
docker-project/
├── Dockerfile
└── certs/
└── certificate.pem
```
4. Add the certificate to your Docker image:
To add the certificate to your Dockerfile to install it during the build process:
1. Add the certificate install directions to your Dockerfile. For example:
*Red Hat-based imagesdocker*
```docker
FROM registry.access.redhat.com/ubi9/ubi:latest
# Or FROM centos:7 or FROM fedora:38
# Install necessary certificates package
RUN dnf install -y ca-certificates
# Copy and add Cloudflare root certificate
COPY certs/certificate.pem /etc/pki/ca-trust/source/anchors/certificate.crt
RUN update-ca-trust extract
```
*Debian-based imagesdocker*
```docker
FROM debian:12
# Or FROM ubuntu:22.04
# Install necessary certificates package
RUN apt-get update && apt-get install -y ca-certificates
# Copy and add Cloudflare root certificate
COPY certs/certificate.pem /usr/local/share/ca-certificates/certificate.crt
RUN update-ca-certificates
```
*Alpine-based imagesdocker*
```docker
FROM alpine:3.18
# Install necessary certificates package
RUN apk add --no-cache ca-certificates
# Copy and add Cloudflare root certificate
COPY certs/certificate.pem /usr/local/share/ca-certificates/certificate.crt
RUN update-ca-certificates
```
2. Build the Docker image:
```sh
docker build -t <your-container-name> .
```
3. Verify the certificate was installed:
*Red Hat-based imagessh*
```sh
docker run --rm your-image-name sh -c "cat /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem | grep Cloudflare"
```
*Debian and Alpine-based imagessh*
```sh
docker run --rm your-image-name sh -c "cat /etc/ssl/certs/certificate.pem"
```
To add the certificate to your Docker Compose file to install it during runtime:
1. Add the certificate install directions to your `docker-compose.yml` file. For example:
*Red Hat-based containersyaml*
```yaml
version: '3'
services:
redhat-app:
image: registry.access.redhat.com/ubi9/ubi:latest
volumes:
- certs/certificate.pem:/etc/pki/ca-trust/source/anchors/certificate.pem
entrypoint: /bin/sh -c "dnf install -y ca-certificates && update-ca-trust extract && app start"
```
*Debian-based containersyaml*
```yaml
version: '3'
services:
debian-app:
image: debian:12
volumes:
- certs/certificate.pem:/usr/local/share/ca-certificates/certificate.crt
entrypoint: /bin/sh -c "apt-get update && apt-get install -y ca-certificates && update-ca-certificates && app start"
```
*Alpine-based containersyaml*
```yaml
version: '3'
services:
alpine-app:
image: alpine:3.18
volumes:
- certs/certificate.pem:/usr/local/share/ca-certificates/certificate.pem
entrypoint: /bin/sh -c "apk add --no-cache ca-certificates && update-ca-certificates && app start"
```
2. Run the container:
```sh
docker-compose up
```
3. Verify the certificate was installed:
*Red Hat-based containerssh*
```sh
docker exec -it <container-name> sh -c "cat /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem | grep Cloudflare"
```
*Debian and Alpine-based containerssh*
```sh
docker exec -it <container-name> sh -c "cat /etc/ssl/certs/ca-certificates.crt | grep Cloudflare"
```
### Command-line tools
Command-line tools typically use the system certificate store but may require specific configuration.
#### cURL
By default, cURL will use your operating system's native certificate store. To force cURL to use your default certificate, add the `--ca-native` flag to the command. For example:
```curl
curl --ca-native https://example.com
To use a Cloudflare root certificate with cURL on macOS, install the certificate to the operating system keychain. cURL will use the macOS root certificate by default.
To use a Cloudflare certificate with the version of cURL preinstalled on Windows or another version that uses the Schannel (WinSSL) backend, install the certificate to the Windows certificate store. If you use an older or custom version of cURL built with the OpenSSL backend, you will need to manually configure cURL to use the certificate.
