FortiGate Config Review
Overview
Reads a FortiGate CLI-style .conf backup (or two, to diff) and reports risk findings and changes in the same terms a senior Fortinet admin would flag during a change review. Not a replacement for FortiAnalyzer/FortiManager compliance scanning — it's a fast manual-review aid for one-off config checks.
When to Use
- Before pushing a config change to a production FortiGate
- Reviewing a
.confbackup pulled from a site for the first time - "What changed between these two backups?" after an incident or scheduled maintenance
- Onboarding a new site/client firewall and need a quick risk read
Safety rules (always)
- Read-only. Never connect to a FortiGate, never run commands on a device, never edit or overwrite a
.confbackup. This skill only reads files. - Redact before reading. Before opening any backup, run the bundled script (in
scripts/next to this SKILL.md):
Then read onlypython scripts/redact.py <backup>.conf<backup>.redacted.conf. It masks admin/LDAP/RADIUS passwords, VPN PSKs, private keys, SNMP communities and other secret fields with<REDACTED>. - If the script exits with code 2, it found a secret stored in plain text (no
ENC). Report that as an [ALTO] finding with the line numbers it printed — never quote the value. - If Python is unavailable, stop and tell the user; do not fall back to reading the raw backup.
Finding the right backup first
FortiGate backup filenames usually encode device, site, firmware and timestamp (e.g. FG100FTK00000000-CLIENTE01_MATRIZ_7-6_3704_202601011200.conf). Never trust file listing order or memory for "latest" — always ls -t *.conf (or sort by the timestamp embedded in the filename) to confirm which backup is actually newest before reviewing or diffing. If a project has its own governance doc (e.g. a CLAUDE.md naming a source-of-truth hierarchy), that doc wins over this default.
Review Checklist
Work through config firewall policy blocks first — that's where risk concentrates — then objects/admin.
| Check | Grep pattern | Why it matters |
|---|---|---|
| Broad allow rule | srcaddr "all" + dstaddr "all" + action accept in the same policy block | Classic any-any accept; should be scoped or justified in a comment |
| Logging off on an accept policy | action accept without a set logtraffic line (or set logtraffic disable) | No audit trail if that path is ever abused |
| Service left wide open | set service "ALL" | Should name the actual ports/services needed |
| No default-deny visible | Last policy in config firewall policy is not a deny/drop | Implicit-deny exists in FortiOS, but an explicit logged deny-all at the bottom is best practice for audit visibility |
| Admin access not restricted | config system admin entries without a set trusthost1 (or equivalent) | Admin GUI/CLI reachable from anywhere |
| Orphaned address/group objects | Object defined in config firewall address/addrgrp but never referenced in any firewall policy block | Dead config, audit noise, occasionally a sign of a removed rule that wasn't cleaned up |
| Firmware/build sanity | Header comment or #config-version= line | Flag if clearly outdated vs. the device's current known build |
| VPN phase1/phase2 proposals | config vpn ipsec phase1-interface / phase2-interface | Flag weak proposals (DES, MD5, PFS disabled) if present |
Diffing two backups
diff -u old.redacted.conf new.redacted.conf | grep -E '^[+-]' | grep -v '^[+-][+-][+-]'
Read the diff in blocks, not line-by-line — a single policy edit can span several lines (edit, set, next). Group consecutive +/- lines by the edit <id> or config <section> they fall under, then describe each changed block in one sentence: what policy/object, what changed, security-relevant or not.
Output format
Report findings grouped by severity, each with the exact config line quoted:
## Achados de risco
1. [ALTO] Política 12: srcaddr "all", dstaddr "all", service "ALL", accept, sem log — "edit 12" ... "set action accept" (sem "set logtraffic")
2. [MÉDIO] 3 objetos de endereço órfãos: OBJ-OLD-VPN-01, OBJ-TEST-TMP, OBJ-UNUSED-DC
## Diferenças entre backups (se aplicável)
1. Política 7: service alterado de "HTTPS" para "ALL" — alargamento de escopo, revisar
Common Mistakes
- Treating
lsdefault sort as "newest first" — it isn't; always confirm via timestamp. - Flagging every
srcaddr "all"as critical without checking ifdstaddris also unscoped and action isaccept— an "all" source to one specific internal host on one service is normal (e.g. inbound WAN rules). - Diffing without grouping by block — raw line diff on CLI config is noisy and easy to misread.