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

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

Common problems

Message you seeWhat it meansWhat 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 thisThe 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

Collect details for support

  1. 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.
  2. 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.
  3. 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.