Skip to content

Commit 483084d

Browse files
authored
[ZT] Java cert procedure (#19370)
1 parent 8af75ad commit 483084d

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

src/content/docs/cloudflare-one/connections/connect-devices/user-side-certificates/manual-deployment.mdx

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,54 @@ To install a certificate for use in a Docker container:
626626

627627
</TabItem> </Tabs>
628628

629+
### Java
630+
631+
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.
632+
633+
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-the-cloudflare-root-certificate).
634+
635+
<Tabs>
636+
<TabItem label="macOS and Linux" icon="seti:shell">
637+
638+
1. Install [OpenSSL](https://www.openssl.org/).
639+
640+
2. In a terminal, format the Cloudflare certificate for Java.
641+
642+
```sh
643+
openssl x509 -in Cloudflare_CA.pem -inform pem -out Cloudflare_CA.der -outform der
644+
```
645+
646+
3. Import the converted certificate into the Java keystore.
647+
648+
```sh
649+
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
650+
```
651+
652+
4. Restart any instances of Java.
653+
654+
</TabItem>
655+
656+
<TabItem label="Windows" icon="seti:windows">
657+
658+
1. Install [OpenSSL for Windows](https://slproweb.com/products/Win32OpenSSL.html).
659+
660+
2. In an administrator PowerShell terminal, format the Cloudflare certificate for Java.
661+
662+
```powershell
663+
openssl x509 -in Cloudflare_CA.pem -inform pem -out Cloudflare_CA.der -outform der
664+
```
665+
666+
3. Import the converted certificate into the Java keystore.
667+
668+
```powershell
669+
"%JAVA_HOME%\bin\keytool" -import -trustcacerts -alias "Cloudflare Root CA" -file Cloudflare_CA.der -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -storepass changeit -noprompt
670+
```
671+
672+
4. Restart any instances of Java.
673+
674+
</TabItem>
675+
</Tabs>
676+
629677
### Google Cloud
630678

631679
#### Google Cloud SDK
@@ -662,7 +710,7 @@ If you use Kaniko with Google Cloud SDK, you must install a Cloudflare certifica
662710

663711
#### Google Drive for desktop
664712

665-
To trust a Cloudflare root certificate in the Google Drive desktop application, follow the procedure for your operating system. These steps require you to [download the .pem certificate](#download-the-cloudflare-root-certificate).
713+
To trust a Cloudflare root certificate in the Google Drive desktop application, follow the procedure for your operating system. These steps require you to [download a `.pem` certificate](#download-the-cloudflare-root-certificate).
666714

667715
<Tabs>
668716
<TabItem label="macOS" icon="apple">
@@ -760,7 +808,7 @@ To set the location of the certificate for use as an environment variable:
760808

761809
### PHP Composer
762810

763-
The command below will set the [`cafile`](https://getcomposer.org/doc/06-config.md#cafile) configuration inside of `composer.json` to use the Cloudflare root certificate. Make sure to [download the certificate](#download-the-cloudflare-root-certificate) in the `.pem` file type.
811+
The command below will set the [`cafile`](https://getcomposer.org/doc/06-config.md#cafile) configuration inside of `composer.json` to use the Cloudflare root certificate. Make sure to [download a certificate](#download-the-cloudflare-root-certificate) in the `.pem` file type.
764812

765813
```sh
766814
composer config cafile [PATH_TO_CLOUDFLARE_CERT.pem]

0 commit comments

Comments
 (0)