Fortinet FortiManager and FortiGate troubleshooting
The Fortinet source of the Firewall policy module reads policy packages, firewall policies, the address and service objects they use, interfaces and zones, hit counts and, on request, recent traffic logs. It reads them from a FortiManager, or directly from a FortiGate. It needs the Enterprise edition, and it only reads: nothing is written to the appliances.
Use FortiManager when you have one. Add a FortiGate directly when there is no FortiManager, or as a second connection for hit counts and logs that FortiManager cannot give (see Hit counts and logs).
Before you start
- FortiManager protocol and port. JSON-RPC over HTTPS, TCP 443 by default (the FortiManager admin port). cinqstack calls
https://<fortimanager>/jsonrpc. It only reads, apart from starting the hit-count task (only for a job with Ask FortiManager for hit counts on) and, for logs, the log search. - ARP table. A FortiGate's ARP table (
monitor/network/arp, a GET) is read with the policy, so IP addresses can show where each address was last seen. If the profile cannot read it, the run says so and the policy read is unaffected. cinqstack sends nothing to the addresses. - FortiGate protocol and port. The REST API over HTTPS, GET only, at
https://<fortigate>/api/v2/.... The default port is 443, but many FortiGates move the admin port (admin-sport) to 8443 or 10443. Put the real port on the connection. - TLS. If the appliance still has its factory self-signed certificate, untick Verify TLS certificate, or make the cinqstack host trust the appliance's CA.
- Where in cinqstack. Go to Security › Firewall policy. Admins add connections with the Connections button on that page and choose Vendor = FortiManager or FortiGate. The Fortinet vendors only appear while the Fortinet module is on under Settings › Modules and the licence includes it. The module keeps its internal name, so its addresses start with
/checkpoint/. - Jobs. Choose New job on the same page.
- Domain is the ADOM (FortiManager) or the VDOM (FortiGate). Leave it blank for every ADOM or every VDOM.
- Policy packages takes
package,folder/packageoradom/folder/packageon FortiManager, and VDOM names on a FortiGate. Leave it blank for everything. - NetBox. Recording FortiGates as devices needs the
fortinet_uidcustom field ("Fortinet device"). Create it in Settings › NetBox schema. If you have mapped a firmware version field, it receives the FortiOS version. New FortiGates are created with manufacturer Fortinet, platform FortiOS, the FortiGate serial as the NetBox serial, and a model from the platform string, such as "FortiGate 100F". You can override the model per device on the job. Existing NetBox devices are matched by serial first, then by the device that owns the management IP, then by name. - Services tag. Services the job writes to NetBox carry a tag, by default the job's own
cinqstack-fw-<job id>(leave the tag field empty). Services carrying that tag that the policy no longer allows are removed. Give every job its own tag, or jobs that share one stop removing services.
Read-only accounts
FortiManager
Use an API user with a key, which the connection's API user key field takes. Give it a read-only profile, such as Standard_User or your own profile that can read Device Manager, Policy & Objects and System.
config system admin user
edit cinqstack-api
set user_type api
set profile <read-only profile>
set adom <adom, or all_adoms>
set rpc-permit read
next
end
execute api-user generate-key cinqstack-api
A normal administrator with a username and password also works if it has set rpc-permit read. Without rpc-permit, every call fails with code -11.
FortiGate
Use a REST API administrator with a read-only profile, limited to the cinqstack host. Paste its token into the connection's REST API token field.
config system accprofile
edit cinqstack-ro
set fwgrp read
set netgrp read
set sysgrp read
set loggrp read
next
end
config system api-user
edit cinqstack
set accprofile cinqstack-ro
set vdom root
config trusthost
edit 1
set ipv4-trusthost <cinqstack address>/32
next
end
next
end
execute api-user generate-key cinqstack
Set vdom to every VDOM cinqstack should read. FortiOS 7.6 asks for the current admin password when it generates the key. Calls from an address that is not a trusted host get HTTP 403. Editing the API user invalidates its token, so generate a new one afterwards.
Hit counts and logs
- Hit counts through FortiManager are requested only when the job's Ask FortiManager for hit counts is on (off by default; the run log then says
<package>: hit counts not requestedand rules show "not reported"). They need the FortiGates connected to it, with the management tunnel up. If a package's FortiGate is not connected, the run log says<package>: hit counts unknown: no assigned devices found …. Its rules then show hits as "not reported" rather than 0, so no false "No hits" findings are raised. - Hit counts from a FortiGate come from its policy monitor (the run log says
hit counts from the FortiGate policy monitor). This also gives the count for the implicit deny. - Traffic logs through FortiManager need FortiAnalyzer features switched on in FortiManager.
- If FortiManager cannot give hit counts or logs, add the FortiGate itself as a second connection.
Common problems
| Message you see | What it means | What to do |
|---|---|---|
That firewall vendor is not available with the current licence or modules. | The Fortinet module is off, or the licence does not include it. | Turn on the module under Settings › Modules, or install a licence that includes it. |
A FortiGate needs its REST API token. | The FortiGate connection has no token. | Paste the API user's key into REST API token. |
Give an API key, or a username and password. | The FortiManager connection has no credentials. | Fill in an API user key, or both a username and a password. |
Cannot reach FortiManager: … or Cannot reach the FortiGate: … | The HTTPS request did not complete: the network, the port, or certificate checking. A certificate problem shows CERTIFICATE_VERIFY_FAILED in the message. A Test on the connections page says it as Cannot reach <host>:<port>: … (the network or the port) or Cannot connect to <host>:<port>: the TLS handshake failed. (the certificate), followed by what to check. | Check the address, the port (FortiGates often use 8443 or 10443) and firewalls. For a certificate error, untick Verify TLS certificate or trust the appliance's CA. |
/sys/login/user: login failed (-22) | FortiManager refused the username or password. A Test shows Cannot connect to <host>:<port>: the credentials were refused. | Check the account on FortiManager. |
FortiManager rejected the API key (HTTP 401) | The API user key is wrong or was revoked. A Test shows Cannot connect to <host>:<port>: the credentials were refused. | Generate a new key and paste it in. |
<url>: key rejected or no permission (the admin needs rpc-permit read, and the API user a profile that can read this) (-11) | The API key was rejected, or the account has no rpc-permit read, or its profile cannot read that ADOM or table. | Fix the administrator or its profile on FortiManager. |
<url>: Invalid url (-6) | The ADOM or package named in the connection or job does not exist, or is misspelt. | Check Domain and Policy packages. Packages in folders are written folder/package. |
The FortiGate rejected the API token (HTTP 401) | The token is wrong or expired. Editing the API user invalidates it. | Generate a new token. |
<path>: forbidden (HTTP 403): the API administrator's profile or trusted hosts do not allow this | The cinqstack address is not a trusted host of the API user, or the profile cannot read that group. | Add the cinqstack address under trusthost, or give the profile read access. |
<path>: VDOM <name> does not exist (HTTP 424) | Domain names a VDOM that the FortiGate does not have, or that the API user may not enter. | Fix the VDOM name or leave Domain blank. |
FortiManager has no log view for this ADOM (it needs FortiAnalyzer features, or add the FortiGate itself as a connection): … | Shown on a rule page when you ask for recent traffic through a FortiManager without FortiAnalyzer features. | Add the FortiGate as a connection, or turn on FortiAnalyzer features. |
No traffic logs readable on the FortiGate: … | Neither disk nor memory logs can be read. | Check the FortiGate's log settings (config log disk setting, config log memory setting) and that the profile has loggrp read. |
The Fortinet module is switched off or not licensed; this connection cannot be read until it is on again. | A job on a Fortinet connection ran after the module was switched off. | Turn the module back on, or remove the job. |
NetBox has no 'fortinet_uid' custom field yet: provision it in Settings › NetBox schema, then run again to record gateways as devices. | FortiGates were not written to NetBox. The rest of the analysis still ran. | Provision the field in Settings › NetBox schema and run again. |
… service(s) not in this policy were left alone: job(s) … write services with the same tag '…', so they may be theirs. Give each job its own tag (blank = the job's own). | Under "skipped" in the run's service plan. Another Firewall policy job writes services to NetBox with the same tag, so this job does not remove services its policy no longer allows: they may belong to the other job. | On each job's page, give it its own tag. An empty tag field means the job's own tag, cinqstack-fw-<job id>. |
… writes services with the same tag: neither job will remove services then, since they may be the other's. Give each job its own tag. | On the job page, under the tag field, with a "shared tag" pill. The same situation, seen before a run. | Clear the tag field (the job then uses cinqstack-fw-<job id>) or choose a tag no other job uses. |
Known limits
- Evaluation FortiGate-VMs and newer FortiManager. FortiGate-VMs on an evaluation licence cannot register to FortiManager 7.2.10 or later, 7.4.6 or later, or 7.6, because FortiManager rejects their factory certificate. Licensed FortiGates are not affected. In cinqstack, the device shows in FortiManager but its hit counts stay unknown. Read the FortiGate directly instead.
- Versions. FortiManager must run at least the FortiOS version of the FortiGates it manages.
- Relay edges. Update edges to a release that includes the Fortinet source before they run Fortinet jobs. An older edge fails the job with a Check Point login error against the FortiManager. See Relay troubleshooting.
- Audit trail. Everything cinqstack reads appears in the FortiManager event log as reads by the API user.
Collect details for support
- Open the job under Security › Firewall policy, use the arrow next to Run now and choose Run with debug log. A debug run also stores the collected snapshot in the log, and shows a bug icon in the run list.
- When the run finishes, open the run page (
/checkpoint/runs/<run id>) and download the log. Its address is/runs/checkpoint/<run id>/log.txt. - Only operators and admins see the debug detail, so download the log with one of those roles.
Send the log file, the cinqstack version, and the FortiManager or FortiOS version. The snapshot contains your firewall policies and object addresses, so agree with your security team before you share it. Never send the API key, token or password.
An admin can also download a diagnostics bundle under Settings › Support › Download diagnostics. The page lists every file in it before you download, so you can check what you send. It never contains passwords, API keys, NetBox tokens, the licence file, device configurations or photos.