Skip to main content
StephenS612
New Member
September 26, 2025
Question

Looking for a Fortinet Consultant

  • September 26, 2025
  • 4 replies
  • 1125 views

Having trouble with FortiGate REST API calls for automated policy updates. We're using Python scripts to bulk modify firewall rules but getting SSL certificate validation errors when connecting to our FortiGate cluster.

Individual policy queries work through the web interface, but programmatic access via API keeps failing on certificate handshake. Need someone experienced with FortiOS API authentication and certificate management.

Requires 2-3 hours remote session to resolve the SSL connectivity issues. Timeline is urgent - need functional by Wednesday for security policy rollout.

4 replies

funkylicious
SuperUser
SuperUser
September 26, 2025

hi,

not a Fortinet expert here, especially on the API/automation side.

are you using a API token ( authorization bearer ) for connecting to the firewall or with a username and password ?

can you share more info about the error or the request that you are using ?

"jack of all trades, master of none"
distillednetwork
Explorer II
September 26, 2025

Are you using a publicly signed certificate on the management interface, and if so, using that FQDN (not IP) to connect to the firewall?  If it's not a publicly signed cert, you will have to download it and then upload it to your server to explicitly trust it.  I'm not sure the exact libraries you are looking at, but this may help:

 

https://www.geeksforgeeks.org/python/ssl-certificate-verification-python-requests/

 

Markus_M
Staff & Editor
Staff & Editor
September 26, 2025

The API is basically HTTPS access. The API key is just doing authentication AFTER the HTTPS or rather TLS exchange. The policy update or whatever will be done AFTER that.

So your python script will be the HTTPS/TLS client to the FortiGate as TLS server. No idea what your client is, but I assume it offloads that task to the OS and as such - do you have certificate warnings with a browser that uses the FortiGate certificate store when access the FortiGate on the exact same address as your python script?

Colin2
New Member
September 29, 2025

Hi,

I work with FortiGate APIs regularly and have seen this SSL validation issue before.

Usually its either the certificate chain not being properly imported or Python not trusting the self-signed cert.

I can help you sort out the certificate trust store and get your bulk policy updates running smoothly. Should be straightforward to fix in a couple hours.

Feel free to reach out if you need a hand with this.

You can reach out to me on my email here
Colin