Technical Tip: How to avoid certificate error message by chaining Root CA and Intermediate CA certificates on FortiGate
Description
This article describes a scenario about when using third-party certificates signed by intermediate CA/root CA, sometimes FortiOS will not send the complete certificate chain to the client. This occurs due to an incorrect configuration and a certificate error message is displayed on the client browser.
This article helps to avoid such error messages.
Scope
This article applies to the following authentication types:
-
Admin WebUI login to FortiGate.
-
SSL VPN authentication to FortiGate.
-
Captive Portal authentication over HTTPS to FortiGate.
Â
This article applies to the following certificate types:
-
Locally signed certificates.
-
Certificates signed by well-known CAs.
Solution
While authenticating against the captive portal of a FortiGate, a certificate error message is sometimes displayed.
The certificate error can be caused by several Alert messages as described in the TLS/SSL RFCs. Viewing the developer tools available in the web browser helps narrow down the exact root cause of the certificate error message:
Â

Â
In this case, the certificate error message was caused by an invalid/no chain of certificates verifying the authenticity of the server certificate provided in the SSL/TLS handshake.
Â
The certificate chain is missing, as shown in the certification path tab:
Â

Â
Using Wireshark, the same can be verified by capturing the SSL/TLS handshake between the browser and the server.
Â

Â
Select Export Packet Bytes and save the file as certificate.cer, and open the certificate.cer, which looks like below.
Â

Â
Go to the FortiGate GUI and upload the public key/certificate of Root CA and Intermediate CA in the CA Certificate section in PEM/cer format.
Â

Â
Make sure that you have the Root CA and Intermediate CA under the External CA certificates.
Â

Â
In new versions, the location is under 'Remote CA Certificate':
Â

Â
Restart the authd process:
Â

Â
For SSL VPN web services to take effect, either restart the SSLVPND daemon or reconfigure the server certificate in the SSL VPN settings by switching to another certificate and reverting back to the original certificate.
Note:
Restarting the SSLVPND daemon or reconfiguring the SSL VPN server certificate will interrupt active SSL VPN connections.
Â
On the browser, ensure that the Root CA is present/installed/trusted.
Intermediate CA doesn't need to be installed on the browser because the intermediate CA will be sent in the SSL/TLS handshake by the FortiGate.
Â

Â
Â
Â
Re-open the browser and access any web page. This redirects to the captive portal login page on the FortiGate.
Â
Â

Â
Â
Â
The certificate chain is present this time, and no error is seen on the browser.
Â
Â

Â
Â
Â
Verify using Wireshark to capture the SSL/TLS Handshake.
Â
Â

Â
Another option is to use OpenSSL to validate the certificate chain:
Â
openssl s_client -verify 5 -connect 192.168.170.33:10443 </dev/null
verify depth is 5
CONNECTED(00000003)
depth=2 C = MX, ST = CDMX, L = Mexico, O = Fortinet, OU = TAC, CN = CA_XCA-root, emailAddress = oxxx@fortinet.com
verify error:num=19:self signed certificate in certificate chain
verify return:1
depth=2 C = MX, ST = CDMX, L = Mexico, O = Fortinet, OU = TAC, CN = CA_XCA-root, emailAddress = oxxx@fortinet.com
verify return:1
depth=1 C = MX, ST = CDMX, L = MEXICO, O = TAC XCA, OU = SOPORTE, CN = CA_XCA_2025, emailAddress = oxxx@fortinet.com
verify return:1
depth=0 C = MX, ST = MEXICO, L = DCMX, O = MEXICOTAC, OU = TACMEX, CN = *vpn2.tacmexico.mx, emailAddress = oxxx@fortinet.com
verify return:1
---
Certificate chain
0Â s:/C=MX/ST=MEXICO/L=DCMX/O=MEXICOTAC/OU=TACMEX/CN=*vpn2.tacmexico.mx/emailAddress=oxxx@fortinet.com
  i:/C=MX/ST=CDMX/L=MEXICO/O=TAC XCA/OU=SOPORTE/CN=CA_XCA_2025/emailAddress=oxxx@fortinet.com
1Â s:/C=MX/ST=CDMX/L=MEXICO/O=TAC XCA/OU=SOPORTE/CN=CA_XCA_2025/emailAddress=oxxx@fortinet.com
  i:/C=MX/ST=CDMX/L=Mexico/O=Fortinet/OU=TAC/CN=CA_XCA-root/emailAddress=oxxx@fortinet.com
2Â s:/C=MX/ST=CDMX/L=Mexico/O=Fortinet/OU=TAC/CN=CA_XCA-root/emailAddress=oxxx@fortinet.com
  i:/C=MX/ST=CDMX/L=Mexico/O=Fortinet/OU=TAC/CN=CA_XCA-root/emailAddress=oxxx@fortinet.com
Note:
-
Public key of the Root and Intermediate CA needs to be uploaded to FortiGate, as Remote CA certs.
-
The following two CLI commands are in place.
Â

   Â
-
Instead of IP, FQDN should be used, and the FQDN should exist on CN or SAN.
-
Sometimes, the WIFI client may fail to obtain the complete chain of this certificate signed by the public CA and still got the certificate warning at the Authentication Portal. That could be because the client's browser failed download the CA cert from the Internet as the Internet access was still not available. The solution for this situation can be found in following article:
