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.
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 ?
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/
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?
User | Count |
---|---|
2609 | |
1390 | |
804 | |
664 | |
455 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.