Skip to main content
egudino
Staff
Staff
March 18, 2026

Technical Tip: Creating and installing a private CA certificate for deep inspection using OpenSSL commands

  • March 18, 2026
  • 0 replies
  • 1242 views
Description This article describes the steps needed to create a CA certificate using OpenSSL and Install it in FortiGate Firewall in order to use it in a Deep Packet Inspection Profile.
Scope FortiGate + OpenSSL installed in a Linux Machine.
Solution

In some cases, it may be necessary to use a custom CA certificate in order to execute Deep-Packet-Inspection rather than using the Local Fortinet_CA_SSL Certificate that is embedded in FortiOS by default.

 

It is necessary to use a Private CA Certificate with x509v3 Basic Constraints with a 'CA:TRUE' value in it.

 

This is an example of how a 'CA:TRUE' constraint looks in a Digital CA Certificate's extensions:

 

image.png
At the end of this example, a '.p12' format will exported and used, as it is the format that contains the Private Key + CA Certificate needed to perform Deep Packet Inspection in a SSL/SSH Profile.

  1. Open the Linux machine's terminal and make sure that the latest OpenSSL version is installed.

     

user@vm:~$sudo apt upgrade openssl

openssl is already the newest version (3.0.13-0ubuntu3.7).
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

 

  1. Create a local Directory to save the files that will be used to generate the CA Certificate. In this example a Folder named 'MyCertificates' is created.

 

user@vm:~$mkdir MyCertificates

user@vm:~/MyCertificates$

 

  1. Generate the CA private key.

 

In this example, a key file named 'MyCAKey.key' is created with a length of 2048, and is encrypted with aes256. Create and take note of the pass phrase used for this key.

 

user@vm:~/MyCertificates$ openssl genrsa -aes256 -out MyCAKey.key 2048
Enter PEM pass phrase: ***
Verifying - Enter PEM pass phrase: ***

 

Verify the .key file was created and is now in this directory with the 'ls' command:


user@vm:~/MyCertificates$ ls
MyCAKey.key

 

  1. Create the self-signed CA Certificate using the private .key of step 3. In this example, a certificate named 'MyCA_Cert' will be generated, with a duration of 365 days. A prompt will appear that must be filled in with the information of the company or organization.

 

user@vm:~/MyCertificates$ openssl req -new -x509 -sha256 -days 365 -key MyCAKey.key -out MyCA_Cert.crt

Enter pass phrase for MyCAKey.key: here type the Key PEM pass phrase used in last step***.
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:MX
State or Province Name (full name) [Some-State]:LATAM
Locality Name (eg, city) []:Mexico City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Fortinet Labs
Organizational Unit Name (eg, section) []:Cybersecurity
Common Name (e.g. server FQDN or YOUR name) []:Local Fortinet CA
Email Address []:myuser@mydomain.com

 

  1. Verify the .key file and the new certificate now appear in the directory:

 

user@vm:~/MyCertificates$ ls
MyCA_Cert.crt MyCAKey.key

 

  1. Combine the '.key + .crt' files into a PKCS#12 file. A prompt will appear requiring for the passphrase that was created in Step #3 (for MyCAKey.key) and type a new 'Export Password' for the PKCS#12 file itself (this can be different from the key's passphrase). In this example the final file is named 'MyNew_P12.p12'.

 

user@vm:~/MyCertificates$  openssl pkcs12 -export -out MyNew_P12.p12 -inkey MyCAKey.key -in MyCA_Cert.crt -name "MyCACertificate"

Enter pass phrase for MyCAKey.key: Pass phrase of step #3
Enter Export Password: New Pass phrase to export file. This will be needed in FortiGate
Verifying - Enter Export Password:
user@vm:~/MyCertificates$ ls
MyCA_Cert.crt MyCAKey.key MyNew_P12.p12

 

  1. Import the .p12 certificate in FortiGate using the Export Password used in Step #6:

Go to System -> Certificates -> Create/Import -> Certificate.

image.png

Select 'Import Certificate'.

image.png
Select 'PKCS #12 Certificate' and select the .p12 File created in the previous steps and type in the Pass Phrase used in Step 6. Additionally, supply a name for this certificate.

image.png
Select 'Create' - the certificate will be imported.

image.png

 

  1. Go to Security Profiles -> SSL/SSH Inspection-> Create/Import -> Create New / Modify the existing one.


It is now possible to use the imported CA certificate:

image.png
Note:

Make sure to also install the CA Certificate (MyCA_Cert.crt, in this example) in the User's Machines to avoid SSL Warnings when browsing the Internet and using this SSL/SSH profile.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!