Skip to main content

How to Upload & Configure SSL Certificates on FortiGate for External Captive Portals

Written by Matija Farkaš

When deploying an external guest captive portal on a FortiGate firewall, users often encounter frustrating "Your Connection is Not Private" or NET::ERR_CERT_COMMON_NAME_INVALID warnings during redirection. This happens when FortiGate serves its default self-signed factory certificate instead of a publicly trusted domain certificate during the HTTPS handshake.

This guide provides a step-by-step walkthrough on how to generate a compatible PKCS#12 (.pfx) certificate, upload it to FortiOS, and configure FortiGate CLI redirection parameters to guarantee seamless, error-free guest authentication.

Prerequisites & DNS Setup

  1. Wildcard / SAN Certificate: You must own a valid SSL certificate (wildcard or specific subdomain) issued by a publicly trusted Certificate Authority (e.g., Let's Encrypt, Sectigo, DigiCert).

  2. DNS Record: Create an A record in your external (or local split-brain) DNS mapping your chosen portal FQDN (e.g., guest.yourdomain.com) to the IP address of the FortiGate interface handling the captive portal traffic (e.g., 192.168.1.1).

Step 1: Prepare the PKCS#12 (.pfx) Certificate File

FortiOS often requires the private key, primary certificate, and intermediate/root CA bundle merged into a single package to construct the full trust chain properly.

If you have separate OpenSSL key and certificate files, generate a .pfx archive using OpenSSL:

Bash

openssl pkcs12 -export -out forti_cert.pfx \   -inkey privkey.pem \   -in STAR_domain_com.crt \   -certfile STAR_domain_com.ca-bundle \   -legacy

Step 2: Upload the Certificate to FortiGate

  1. Log into your FortiGate GUI.

  2. Go to System -> Certificates.

    (If Certificates is not visible, enable it under System $\rightarrow$ Feature Visibility).

  3. Click Import -> Local Certificate.

  4. Set Type to PKCS12 Certificate.

  5. Browse for your forti_cert.pfx file and enter the password you set during export.

  6. Give the certificate a clear name (e.g., Wildcard_YourDomain) and click Create.

Step 3: Configure Portal Redirects via CLI

NOTE: For all the CLI commands, access the terminal from the button in the top right corner

Open the FortiGate CLI (via Web GUI SSH console or direct terminal) and run the following commands to enforce HTTPS redirection using your trusted FQDN and certificate.

1.Configure Portal Address FQDN:Global Redirect Mapping.

Set the domain name that FortiGate will present to captive portal users during redirection:

Plaintext

config firewall auth-portal     set portal-addr "guest.yourdomain.com" end

2.Bind Certificate to Authentication Engine:SSL/TLS Handshake Configuration.

Instruct FortiGate to serve your custom uploaded certificate and force secure HTTP for guest authentication:

Plaintext

config user setting     set auth-cert "Wildcard_YourDomain"     set auth-secure-http enable end

Step 4: Verification & Testing

  1. Connect a test device to the Guest / Captive Portal SSID/VLAN.

  2. Open a browser and navigate to an unencrypted site (e.g., [http://neverssl.com](http://neverssl.com)).

  3. Confirm that you are cleanly redirected to [https://guest.yourdomain.com/](https://guest.yourdomain.com/)... with a green lock / valid SSL status and no browser certificate warnings.

Frequently Asked Questions (FAQ)

Why is my FortiGate captive portal showing a certificate warning even with a public SSL certificate?

This occurs when FortiGate is still configured to use its internal Fortinet_Factory certificate for authentication redirection. You must run set auth-cert <Your_Cert_Name> and set portal-addr <Your_FQDN> in the CLI so FortiGate knows which certificate and domain to present to clients during redirection.

Why do I get an "Invalid Certificate" error when importing my .pfx file into FortiGate?

This usually happens if the PKCS#12 file was created using OpenSSL 3.0+ without backward compatibility enabled. Re-export your .pfx file using the -legacy flag in OpenSSL to ensure FortiOS can parse the file's encryption algorithms.

In case you have more questions and are still having trouble with setting things up, feel free to reach out to our support over chat in the bottom right corner, or by writing to us at [email protected]

Did this answer your question?